Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ceph_key: restore file mode after a key is fetched #4736

Merged
merged 1 commit into from Nov 14, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 5 additions & 3 deletions library/ceph_key.py
Expand Up @@ -541,6 +541,8 @@ def run_module():
add_file_common_args=True,
)

file_args = module.load_file_common_arguments(module.params)

# Gather module parameters in variables
state = module.params['state']
name = module.params.get('name')
Expand Down Expand Up @@ -596,6 +598,8 @@ def run_module():
keyring_filename = cluster + "." + name + ".keyring"
file_path = os.path.join(dest, keyring_filename)

file_args['path'] = file_path

# We allow 'present' to override any existing key
# ONLY if a secret is provided
# if not we skip the creation
Expand All @@ -607,13 +611,11 @@ def run_module():
result["stdout"] = "skipped, since {0} already exists, we only fetched the key at {1}. If you want to update a key use 'state: update'".format( # noqa E501
name, file_path)
result['rc'] = rc
module.set_fs_attributes_if_different(file_args, False)
module.exit_json(**result)

rc, cmd, out, err = exec_commands(module, create_key(
module, result, cluster, name, secret, caps, import_key, file_path, container_image)) # noqa E501

file_args = module.load_file_common_arguments(module.params)
file_args['path'] = file_path
module.set_fs_attributes_if_different(file_args, False)
elif state == "update":
if not caps:
Expand Down