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

Fixed an issue with confirmation not handling uppercase ids #2145

Merged
merged 2 commits into from
May 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Set the default behavior, in case people don't have core.autocrlf set.
* text=auto
*.* text eol=lf

# Language aware diff headers
# https://tekin.co.uk/2020/10/better-git-diff-output-for-ruby-python-elixir-and-more
Expand Down
17 changes: 6 additions & 11 deletions SoftLayer/CLI/file/cancel.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,8 @@
@click.command(cls=SoftLayer.CLI.command.SLCommand, )
@click.argument('volume-id')
@click.option('--reason', help="An optional reason for cancellation")
@click.option('--immediate',
is_flag=True,
help="Cancels the file storage volume immediately instead "
"of on the billing anniversary")
@click.option('--immediate', is_flag=True,
help="Cancels the file storage volume immediately instead of on the billing anniversary")
@click.option('--force', default=False, is_flag=True, help="Force modify")
@environment.pass_env
def cli(env, volume_id, reason, immediate, force):
Expand All @@ -32,15 +30,12 @@ def cli(env, volume_id, reason, immediate, force):
if not (env.skip_confirmations or formatting.no_going_back(volume_id)):
raise exceptions.CLIAbort('Aborted.')

cancelled = file_storage_manager.cancel_file_volume(volume_id,
reason, immediate)
cancelled = file_storage_manager.cancel_file_volume(volume_id, reason, immediate)

if cancelled:
if immediate:
click.echo('File volume with id %s has been marked'
' for immediate cancellation' % volume_id)
click.echo(f'File volume with id {volume_id} has been marked for immediate cancellation')
else:
click.echo('File volume with id %s has been marked'
' for cancellation' % volume_id)
click.echo(f'File volume with id {volume_id} has been marked for cancellation')
else:
click.echo('Unable to cancle file volume %s' % volume_id)
click.echo(f'Unable to cancle file volume {volume_id}')
2 changes: 1 addition & 1 deletion SoftLayer/CLI/formatting.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ def no_going_back(confirmation):
prompt = f"This action cannot be undone! Type '{confirmation}' or press Enter to abort"

ans = click.prompt(prompt, default='', show_default=False)
if ans.lower() == str(confirmation):
if ans.lower() == str(confirmation).lower():
return True

return False
Expand Down
Loading
Loading