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 configuring bucket-name from args for RO commands #589 #590

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

azarnovdaniil
Copy link
Contributor

@azarnovdaniil azarnovdaniil commented May 29, 2023

Fixes #589

@sonarcloud
Copy link

sonarcloud bot commented Jun 28, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

No Coverage information No Coverage information
0.0% 0.0% Duplication

Copy link
Contributor

@adejanovski adejanovski left a comment

Choose a reason for hiding this comment

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

Hi @azarnovdaniil,

I left a couple blocking comments on this PR. The new bucket_name and prefix cli arguments are conflicting with the higher level ones (Click makes that pretty confusing btw...).
I think we should keep the original ones and expose them in the storage class for read access.
Thanks!

Comment on lines +182 to +183
@click.option('--bucket-name', help='Bucket with backup', required=False, default=None)
@click.option('--prefix', help='Backup prefix', required=False, default=None)
Copy link
Contributor

Choose a reason for hiding this comment

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

Issue: these two new arguments are creating confusion with the ones defined in the global settings (the ones that will be placed before the command name in the command line).

We'd rather need to remove these and expose both the bucket_name and the prefix as is in the storage object.
Then you can use them in your code through the storage object instead of having to pass it around the methods.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If I understand correctly your suggestion, I should move bucket_name and prefix into the storage config.
Here:
StorageConfig = collections.namedtuple( 'StorageConfig', ['bucket_name', 'key_file', 'prefix', 'fqdn', 'host_file_separator', 'storage_provider', 'base_path', 'max_backup_age', 'max_backup_count', 'api_profile', 'transfer_max_bandwidth', 'concurrent_transfers', 'multi_part_upload_threshold', 'host', 'region', 'port', 'secure', 'aws_cli_path', 'kms_id', 'backup_grace_period_in_days', 'use_sudo_for_restore', 'k8s_mode'] )
If yes, I had another idea in this PR. Changing config everywhere for a single restore is overkill, in the config, we have a configuration for long-term usages(like a regular backup), and changing the config for restore is a potential problem for the backup procedure(you should return config setting back, you should don't have conflicts between operations, etc).

@@ -427,7 +430,7 @@ def _build_restore_cmd(self):
command = 'mkdir -p {work}; cd {work} && medusa-wrapper {sudo} medusa {config} ' \
'--fqdn=%s -vvv restore-node ' \
'{in_place} {keep_auth} %s {verify} --backup-name {backup} --temp-dir {temp_dir} ' \
'{use_sstableloader} {keyspaces} {tables}' \
'{use_sstableloader} {keyspaces} {tables} {bucket_name} {prefix}' \
Copy link
Contributor

Choose a reason for hiding this comment

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

Issue: following up on my other comment, the --bucket-name and --prefix args need to be placed before the command name (here restore-node).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

'mkdir -p {work}; cd {work} && medusa-wrapper {sudo} medusa {config} ' \ '--fqdn=%s -vvv {bucket_name} {prefix} restore-node ' \ '{in_place} {keep_auth} %s {verify} --backup-name {backup} --temp-dir {temp_dir} ' \ '{use_sstableloader} {keyspaces} {tables}'

Like this?

Copy link
Contributor

Choose a reason for hiding this comment

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

No, like this:

mkdir -p {work}; cd {work} && medusa-wrapper {sudo} medusa {config} ' \ '--fqdn=%s -vvv  --bucket-name={bucket_name} --prefix={prefix} restore-node ' \ '{in_place} {keep_auth} %s {verify} --backup-name {backup} --temp-dir {temp_dir} ' \ '{use_sstableloader} {keyspaces} {tables}

Copy link

sonarcloud bot commented Jan 28, 2024

Quality Gate Failed Quality Gate failed

Failed conditions

7 Security Hotspots

See analysis details on SonarCloud

@rzvoncek
Copy link
Contributor

rzvoncek commented Apr 8, 2024

Hi @azarnovdaniil ! I've been doing some grooming and stumbled upon this. Is there something we could do to help you move this forward, provided you find this still useful?

@rzvoncek rzvoncek closed this Apr 8, 2024
@rzvoncek rzvoncek reopened this Apr 8, 2024
Copy link

sonarcloud bot commented Apr 8, 2024

Quality Gate Failed Quality Gate failed

Failed conditions
7 Security Hotspots

See analysis details on SonarCloud

@azarnovdaniil
Copy link
Contributor Author

@rzvoncek Hi! Probably will be easier to reopen this PR than resolve all conflicts with the fresh master branch.

@rzvoncek
Copy link
Contributor

Hi @azarnovdaniil ! I've finally managed to get to this. I took your branch and made one moster of a rebase, and a few small tweaks. I've ended up with #752, which is megeable, but I haven't tested it. I'm also going away till May, and sadly won't get to do more on this. While I'm gone, could you please give my PR a look to see if it works for you?
Greets!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add bucket-name cli argument for RO commands
3 participants