This repository was archived by the owner on Sep 16, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 151
Improve error handling for users using the schema command #750
Merged
Merged
Changes from all commits
Commits
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 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 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 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 |
---|---|---|
|
@@ -45,16 +45,19 @@ def __init__(self, data, wfjt, include_id=False): | |
else: | ||
node_attrs[fd] = data[fd] | ||
node_attrs['workflow_job_template'] = wfjt | ||
ujt_ambiguity_msg = ( | ||
'You should provide exactly one of the attributes' | ||
' job_template, project, workflow, inventory_source, or unified_job_template.' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 for this clear message. Although I am not familiar with |
||
) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is way better wording! |
||
for ujt_name in ujt_attrs: | ||
if ujt_name not in node_attrs: | ||
continue | ||
if 'unified_job_template' not in node_attrs: | ||
node_attrs['unified_job_template'] = node_attrs.pop(ujt_name) | ||
else: | ||
raise BadRequest( | ||
'You should not provide more than one of the attributes' | ||
' job_template, project and inventory_source.' | ||
) | ||
raise BadRequest(ujt_ambiguity_msg) | ||
if 'unified_job_template' not in node_attrs: | ||
raise BadRequest(ujt_ambiguity_msg) | ||
self.unified_job_template = node_attrs.get('unified_job_template', None) | ||
self.node_attrs = node_attrs | ||
for rel in ['success_nodes', 'failure_nodes', 'always_nodes']: | ||
|
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is good. How about adding
workflow
above as well in the example https://github.com/ansible/tower-cli/pull/750/files#diff-e888d13496218a3618bbee8be0d2a7d1R114-R124 ? I see example already shows jt, project, inv_source, so we can addworkflow
there and make it a complete example. Just a suggestion.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hope you don't mind that I don't do that out of sheer laziness. I know that I've tested the content here is functional. The implication is that you can combine them all together, but we just don't want poke this library any more than we have to.