diff --git a/awx/main/tasks.py b/awx/main/tasks.py index da8b971881..15c0dc9c6c 100644 --- a/awx/main/tasks.py +++ b/awx/main/tasks.py @@ -878,14 +878,14 @@ class BaseTask(object): if cred.has_inputs(field_names=('host', 'username', 'password')): path = os.path.split(private_data_dir)[0] with open(path + '/auth.json', 'w') as authfile: + os.chmod(authfile.name, stat.S_IRUSR | stat.S_IWUSR) + host = cred.get_input('host') username = cred.get_input('username') password = cred.get_input('password') token = "{}:{}".format(username, password) auth_data = {'auths': {host: {'auth': b64encode(token.encode('ascii')).decode()}}} authfile.write(json.dumps(auth_data, indent=4)) - authfile.close() - os.chmod(authfile.name, stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR) params["container_options"].append(f'--authfile={authfile.name}') else: raise RuntimeError('Please recheck that your host, username, and password fields are all filled.')