Skip to content

Commit

Permalink
Merge pull request #2145 from allmightyspiff/issues2144
Browse files Browse the repository at this point in the history
Fixed an issue with confirmation not handling uppercase ids
  • Loading branch information
allmightyspiff authored May 2, 2024
2 parents 14b75d4 + 78e3abf commit 6ce7991
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 157 deletions.
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

0 comments on commit 6ce7991

Please sign in to comment.