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

Add spacecmd function: cryptokey_update #6544

Merged
merged 4 commits into from
Jul 17, 2023

Conversation

blu-base
Copy link
Contributor

@blu-base blu-base commented Jan 29, 2023

What does this PR change?

spacecmd has function for most API calls for managing SSL/GPG keys, such as creating and deleting. There also is an API call to update keys. However, the function to update a key is missing in spacecmd.

This PR adds the function cryptokey_update to update SSL/GPG keys in the same way as creating them via spacecmd.

Discussion point:
This mostly duplicates code present in the cryptokey_create function, respectively the method do_cryptokey_create in /spacecmd/src/spacecmd/cryptokey.py and its test. It might be advantageous to extract the common logic between the create, and update function. Would you suggest further such work?

GUI diff

No difference.

  • DONE

Documentation

  • Doc strings for new python functions

  • Documentation issue was created: Pending

  • DONE

Test coverage

  • Unit tests were added

  • DONE

Links

  • DONE

Changelogs

spacecmd.changes: - Add spacecmd function: cryptokey_update

Make sure the changelogs entries you are adding are compliant with https://github.com/uyuni-project/uyuni/wiki/Contributing#changelogs and https://github.com/uyuni-project/uyuni/wiki/Contributing#uyuni-projectuyuni-repository

If you don't need a changelog check, please mark this checkbox:

  • No changelog needed

If you uncheck the checkbox after the PR is created, you will need to re-run changelog_test (see below)

Re-run a test

If you need to re-run a test, please mark the related checkbox, it will be unchecked automatically once it has re-run:

  • Re-run test "changelog_test"
  • Re-run test "backend_unittests_pgsql"
  • Re-run test "java_pgsql_tests"
  • Re-run test "schema_migration_test_pgsql"
  • Re-run test "susemanager_unittests"
  • Re-run test "javascript_lint"
  • Re-run test "spacecmd_unittests"

@blu-base
Copy link
Contributor Author

Oh well, the bot is the same opinion, this is too much duplication...

Copy link
Contributor

@ycedres ycedres left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much for the PR.
Maybe what you could do to reduce code duplicaton is writing the common code between do_cryptokey_create and do_cryptokey_create in a separate function. In that way you would have one call to this common function followed by a call to self.client.kickstart.keys.create or self.client.kickstart.keys.update.

@meaksh
Copy link
Member

meaksh commented Jul 5, 2023

Thank you very much for the PR. Maybe what you could do to reduce code duplicaton is writing the common code between do_cryptokey_create and do_cryptokey_create in a separate function. In that way you would have one call to this common function followed by a call to self.client.kickstart.keys.create or self.client.kickstart.keys.update.

Oops, there was a typo on the previous message.

I think what @ycedres meant here is that you could refactor common code between do_cryptokey_create and do_cryptokey_update to avoid code code duplication.

@blu-base any chance to make these changes?

Thanks in advance!

@blu-base
Copy link
Contributor Author

blu-base commented Jul 8, 2023

I was having trouble setting up a test environment with sumaform. I lacked training in terraform, so it was time-consuming to figure out my configuration issues.

Leave me a few days to improve this pr.

@blu-base blu-base force-pushed the spacecmd_update_ssl branch 2 times, most recently from 73fc7ba to 48d23b6 Compare July 9, 2023 16:48
Adding the private function `_crypto_key_options` in spacecmd's
cryptokey module to minimize code duplication in the previously
introduced `do_cryptokey_update` function
@blu-base
Copy link
Contributor Author

blu-base commented Jul 9, 2023

This should be ready for another look.

Copy link
Member

@meaksh meaksh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the changes. LGTM!

@meaksh meaksh merged commit 88b6b3c into uyuni-project:master Jul 17, 2023
28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants