-
Notifications
You must be signed in to change notification settings - Fork 37
feat: Add 'job run-rm' command #53
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
Merged
Merged
Changes from 6 commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
322d275
Add job rm command
CSharplie eb82b60
Add job rm command documentation
CSharplie 3aac586
Add confirmation before deleting and "--force" parameter
CSharplie 64e65fd
use utils_ui alias
CSharplie 661f13d
Print warning to delete and in progress message
CSharplie 70d1177
Add job run-rm subcommand
CSharplie 3807b0e
Remove unnecessary error block
CSharplie 4896042
Add job run-rm tests
CSharplie b183abb
Add single quotes to success message
CSharplie 28e3b51
Add missing dot to warning message
CSharplie 91edf26
Fix --id documentation
CSharplie 34f891c
Rename and refactor test
CSharplie 739f8b9
Add without --force tests
CSharplie 8c4afcc
Fix comments
CSharplie eb9e6c3
Merge branch 'main' of https://github.com/CSharplie/fabric-cli
CSharplie e52f036
Enhancement of test_run_schedule_rm_success parametrization
CSharplie f61e378
Fix warning message in assert
CSharplie 3a26792
add changie entry
CSharplie dad906a
Align with changelog
CSharplie f0d4ea6
Remove old cassettes
CSharplie 07ba36a
Merge branch 'main' of https://github.com/CSharplie/fabric-cli
CSharplie e06ec7e
Use temp folder to update file
CSharplie 40322f8
Use mock value for owner
CSharplie d84f5dd
use tmp_path fixture
CSharplie 5d43e48
Merge branch 'main' into main
ayeshurun File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| # Copyright (c) Microsoft Corporation. | ||
| # Licensed under the MIT License. | ||
|
|
||
| import json | ||
| from argparse import Namespace | ||
|
|
||
| from fabric_cli.client import fab_api_jobs as jobs_api | ||
| from fabric_cli.core import fab_constant | ||
| from fabric_cli.core.fab_exceptions import FabricCLIError | ||
| from fabric_cli.core.hiearchy.fab_hiearchy import Item | ||
| from fabric_cli.utils import fab_ui as utils_ui | ||
|
|
||
|
|
||
| def exec_command(args: Namespace, context: Item) -> None: | ||
| if not args.force: | ||
| utils_ui.print_warning(f"You are about to delete schedule '{args.schedule_id}' from '{context.full_name}' This action cannot be undone.") | ||
CSharplie marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| if args.force or utils_ui.prompt_confirm(): | ||
| utils_ui.print_grey(f"Removing job schedule '{args.schedule_id}'... from '{context.full_name}'") | ||
|
|
||
| response = jobs_api.remove_item_schedule(args) | ||
|
|
||
| if response.status_code == 200: | ||
| utils_ui.print_output_format( | ||
| args, | ||
| message=f"Job schedule {args.schedule_id} removed", | ||
CSharplie marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ) | ||
| else: | ||
CSharplie marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| try: | ||
| content = json.loads(response.text) | ||
| error_message = content.get("error", {}).get("message", "") | ||
| except json.JSONDecodeError: | ||
| error_message = response.text | ||
|
|
||
| raise FabricCLIError( | ||
| f"Failed to remove job schedule {args.schedule_id}: {error_message}", | ||
CSharplie marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| fab_constant.ERROR_API_FAILURE, | ||
| ) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -51,6 +51,7 @@ commands: | |
| run_list: | ||
| run_update: | ||
| run_sch: | ||
| run-rm: | ||
| run_status: | ||
| run_wait: | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.