From 2c00d42ced76bed24a5cfc42a5ed6963ede34ae5 Mon Sep 17 00:00:00 2001 From: Jeff Bradberry Date: Mon, 9 Mar 2020 16:00:28 -0400 Subject: [PATCH] Only use a default password if an import user doesn't already exist --- awxkit/awxkit/cli/resource.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/awxkit/awxkit/cli/resource.py b/awxkit/awxkit/cli/resource.py index 821a74f27d..ad700cc23c 100644 --- a/awxkit/awxkit/cli/resource.py +++ b/awxkit/awxkit/cli/resource.py @@ -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)