mirror of
https://github.com/ansible/awx.git
synced 2026-01-11 01:57:35 -03:30
Only use a default password if an import user doesn't already exist
This commit is contained in:
parent
d191edcaf1
commit
2c00d42ced
@ -201,8 +201,6 @@ class Import(CustomCommand):
|
||||
options = self._options[resource]
|
||||
for asset in assets:
|
||||
post_data = {}
|
||||
if resource == 'users' and 'password' not in asset:
|
||||
post_data['password'] = 'password'
|
||||
for field, value in asset.items():
|
||||
if field in ('related', 'natural_key'):
|
||||
continue
|
||||
@ -213,6 +211,9 @@ class Import(CustomCommand):
|
||||
|
||||
page = self.get_by_natural_key(asset['natural_key'], fetch=False)
|
||||
if page is None:
|
||||
if resource == 'users':
|
||||
# We should only impose a default password if the resource doesn't exist.
|
||||
post_data.setdefault('password', 'password')
|
||||
page = endpoint.post(post_data)
|
||||
else:
|
||||
page = page.put(post_data)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user