ceph_key: drop unused result parameter

This parameter is not used anywhere in this function, so we can drop it.

Signed-off-by: Guillaume Abrioux <gabrioux@redhat.com>
pull/7431/head
Guillaume Abrioux 2023-05-31 11:03:42 +00:00 committed by Teoman ONAY
parent 5622a033a9
commit aaa9f1d291
2 changed files with 23 additions and 14 deletions

View File

@ -284,7 +284,16 @@ def generate_ceph_authtool_cmd(cluster, name, secret, caps, dest, container_imag
return cmd return cmd
def create_key(module, result, cluster, user, user_key, name, secret, caps, import_key, dest, container_image=None): # noqa: E501 def create_key(module,
cluster,
user,
user_key,
name,
secret,
caps,
import_key,
dest,
container_image=None):
''' '''
Create a CephX key Create a CephX key
''' '''
@ -597,7 +606,7 @@ def run_module():
module.exit_json(**result) module.exit_json(**result)
if (key_exist == 0 and (secret != _secret or caps != _caps)) or key_exist != 0: # noqa: E501 if (key_exist == 0 and (secret != _secret or caps != _caps)) or key_exist != 0: # noqa: E501
rc, cmd, out, err = exec_commands(module, create_key( rc, cmd, out, err = exec_commands(module, create_key(
module, result, cluster, user, user_key_path, name, secret, caps, import_key, file_path, container_image)) # noqa: E501 module, cluster, user, user_key_path, name, secret, caps, import_key, file_path, container_image)) # noqa: E501
if rc != 0: if rc != 0:
result["stdout"] = "Couldn't create or update {0}".format(name) result["stdout"] = "Couldn't create or update {0}".format(name)
result["stderr"] = err result["stderr"] = err

View File

@ -173,7 +173,6 @@ class TestCephKeyModule(object):
fake_module = "fake" fake_module = "fake"
fake_user = 'client.admin' fake_user = 'client.admin'
fake_user_key = '/etc/ceph/fake.client.admin.keyring' fake_user_key = '/etc/ceph/fake.client.admin.keyring'
fake_result = " fake"
fake_cluster = "fake" fake_cluster = "fake"
fake_name = "client.fake" fake_name = "client.fake"
fake_secret = "super-secret" fake_secret = "super-secret"
@ -191,15 +190,15 @@ class TestCephKeyModule(object):
['ceph', '-n', fake_user, '-k', fake_user_key, '--cluster', fake_cluster, 'auth', ['ceph', '-n', fake_user, '-k', fake_user_key, '--cluster', fake_cluster, 'auth',
'import', '-i', fake_file_destination], 'import', '-i', fake_file_destination],
] ]
result = ceph_key.create_key(fake_module, fake_result, fake_cluster, fake_user, fake_user_key, result = ceph_key.create_key(fake_module, fake_cluster, fake_user, fake_user_key,
fake_name, fake_secret, fake_caps, fake_import_key, fake_file_destination) fake_name, fake_secret, fake_caps, fake_import_key,
fake_file_destination)
assert result == expected_command_list assert result == expected_command_list
def test_create_key_container(self): def test_create_key_container(self):
fake_module = "fake" fake_module = "fake"
fake_user = 'client.admin' fake_user = 'client.admin'
fake_user_key = '/etc/ceph/fake.client.admin.keyring' fake_user_key = '/etc/ceph/fake.client.admin.keyring'
fake_result = "fake"
fake_cluster = "fake" fake_cluster = "fake"
fake_name = "client.fake" fake_name = "client.fake"
fake_secret = "super-secret" fake_secret = "super-secret"
@ -241,15 +240,15 @@ class TestCephKeyModule(object):
'--cluster', fake_cluster, '--cluster', fake_cluster,
'auth', 'import', 'auth', 'import',
'-i', fake_file_destination]] '-i', fake_file_destination]]
result = ceph_key.create_key(fake_module, fake_result, fake_cluster, fake_user, fake_user_key, fake_name, result = ceph_key.create_key(fake_module, fake_cluster, fake_user, fake_user_key, fake_name,
fake_secret, fake_caps, fake_import_key, fake_file_destination, fake_container_image) fake_secret, fake_caps, fake_import_key, fake_file_destination,
fake_container_image)
assert result == expected_command_list assert result == expected_command_list
def test_create_key_non_container_no_import(self): def test_create_key_non_container_no_import(self):
fake_module = "fake" fake_module = "fake"
fake_user = 'client.admin' fake_user = 'client.admin'
fake_user_key = '/etc/ceph/fake.client.admin.keyring' fake_user_key = '/etc/ceph/fake.client.admin.keyring'
fake_result = "fake"
fake_cluster = "fake" fake_cluster = "fake"
fake_name = "client.fake" fake_name = "client.fake"
fake_secret = "super-secret" fake_secret = "super-secret"
@ -277,15 +276,15 @@ class TestCephKeyModule(object):
'osd', 'osd',
'allow rwx', ] 'allow rwx', ]
] ]
result = ceph_key.create_key(fake_module, fake_result, fake_cluster, fake_user, fake_user_key, result = ceph_key.create_key(fake_module, fake_cluster, fake_user, fake_user_key,
fake_name, fake_secret, fake_caps, fake_import_key, fake_file_destination) # noqa E501 fake_name, fake_secret, fake_caps, fake_import_key,
fake_file_destination) # noqa E501
assert result == expected_command_list assert result == expected_command_list
def test_create_key_container_no_import(self): def test_create_key_container_no_import(self):
fake_module = "fake" fake_module = "fake"
fake_user = 'client.admin' fake_user = 'client.admin'
fake_user_key = '/etc/ceph/fake.client.admin.keyring' fake_user_key = '/etc/ceph/fake.client.admin.keyring'
fake_result = "fake"
fake_cluster = "fake" fake_cluster = "fake"
fake_name = "client.fake" fake_name = "client.fake"
fake_secret = "super-secret" fake_secret = "super-secret"
@ -320,8 +319,9 @@ class TestCephKeyModule(object):
'--cap', '--cap',
'osd', 'osd',
'allow rwx']] 'allow rwx']]
result = ceph_key.create_key(fake_module, fake_result, fake_cluster, fake_user, fake_user_key, fake_name, result = ceph_key.create_key(fake_module, fake_cluster, fake_user, fake_user_key, fake_name,
fake_secret, fake_caps, fake_import_key, fake_file_destination, fake_container_image) fake_secret, fake_caps, fake_import_key, fake_file_destination,
fake_container_image)
assert result == expected_command_list assert result == expected_command_list
def test_delete_key_non_container(self): def test_delete_key_non_container(self):