mirror of
https://github.com/ansible/awx.git
synced 2026-03-19 09:57:33 -02:30
Only use a default password if an import user doesn't already exist
This commit is contained in:
@@ -201,8 +201,6 @@ class Import(CustomCommand):
|
|||||||
options = self._options[resource]
|
options = self._options[resource]
|
||||||
for asset in assets:
|
for asset in assets:
|
||||||
post_data = {}
|
post_data = {}
|
||||||
if resource == 'users' and 'password' not in asset:
|
|
||||||
post_data['password'] = 'password'
|
|
||||||
for field, value in asset.items():
|
for field, value in asset.items():
|
||||||
if field in ('related', 'natural_key'):
|
if field in ('related', 'natural_key'):
|
||||||
continue
|
continue
|
||||||
@@ -213,6 +211,9 @@ class Import(CustomCommand):
|
|||||||
|
|
||||||
page = self.get_by_natural_key(asset['natural_key'], fetch=False)
|
page = self.get_by_natural_key(asset['natural_key'], fetch=False)
|
||||||
if page is None:
|
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)
|
page = endpoint.post(post_data)
|
||||||
else:
|
else:
|
||||||
page = page.put(post_data)
|
page = page.put(post_data)
|
||||||
|
|||||||
Reference in New Issue
Block a user