mirror of
https://github.com/ansible/awx.git
synced 2026-01-12 02:19:58 -03:30
Fix permission assignment on rendered registry auth files
- This file shouldnt need the executable bit - Should have been setting permissions before writing any data - No need to close the file since we're using open w/ a context manager
This commit is contained in:
parent
0cdf57f31f
commit
bcf911daf1
@ -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.')
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user