-
Notifications
You must be signed in to change notification settings - Fork 2
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
#34 (Inventory Upload): Add output to determine inventory upload failure #35
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -103,23 +103,24 @@ | |||||||||||||
|
||||||||||||||
|
||||||||||||||
- name: Upload inventory - {{ ansible_hostname }} | ||||||||||||||
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 name belongs to the task not the block. The block will need a name however, possibly "Capture error and display trace information" |
||||||||||||||
ansible.builtin.uri: | ||||||||||||||
url: |- | ||||||||||||||
{{ lookup('env', 'ITSM_API') }}/api/device/inventory | ||||||||||||||
|
||||||||||||||
method: POST | ||||||||||||||
body_format: json | ||||||||||||||
src: "/tmp/{{ ansible_hostname }}.json" | ||||||||||||||
remote_src: true | ||||||||||||||
headers: | ||||||||||||||
Authorization: Token {{ lookup('env', 'ITSM_TOKEN') }} | ||||||||||||||
validate_certs: "{{ lookup('env', 'ITSM_VALIDATE_CERTS') | default(true) | bool }}" | ||||||||||||||
timeout: 300 | ||||||||||||||
status_code: | ||||||||||||||
- 200 | ||||||||||||||
- 201 | ||||||||||||||
no_log: > # Contains a secret that logging shows | ||||||||||||||
{{ nfc_pb_disable_log | default(true) }} | ||||||||||||||
block: | ||||||||||||||
- ansible.builtin.uri: | ||||||||||||||
Comment on lines
+106
to
+107
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.
Suggested change
add two blank lines between tasks, begin and end 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. task is missing name. return the name that it used to have |
||||||||||||||
url: "{{ lookup('env', 'ITSM_API') }}/api/device/inventory" | ||||||||||||||
method: POST | ||||||||||||||
body_format: json | ||||||||||||||
src: "/tmp/{{ ansible_hostname }}.json" | ||||||||||||||
remote_src: true | ||||||||||||||
headers: | ||||||||||||||
Authorization: Token {{ lookup('env', 'ITSM_TOKEN') }} | ||||||||||||||
validate_certs: "{{ lookup('env', 'ITSM_VALIDATE_CERTS') | default(true) | bool }}" | ||||||||||||||
status_code: | ||||||||||||||
- 200 | ||||||||||||||
- 201 | ||||||||||||||
no_log: > # Contains a secret that logging shows | ||||||||||||||
{{ nfc_pb_disable_log | default(true) }} | ||||||||||||||
rescue: | ||||||||||||||
Comment on lines
+120
to
+121
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.
Suggested change
add two blank lines between tasks, begin and end 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. Whilst the output will only be shown on error, which meets the intent of #34, the play will now, not fail. you'll need to add a task to ensure the play fails. |
||||||||||||||
- debug: | ||||||||||||||
Comment on lines
+121
to
+122
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.
Suggested change
add two blank lines between tasks, begin and end 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. use FQCN |
||||||||||||||
msg: "Error uploading inventory: HTTP status {{ result.status }} - {{ result.msg }}" | ||||||||||||||
|
||||||||||||||
|
||||||||||||||
always: | ||||||||||||||
|
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.
We use conventional commit format (with footer) for ALL commit messages, please fix your commit message.
within the commits foote close #34.
If not known, since you have a single commit only, you can use
git commit --amend
to fix the commit message. Then you'll have to usegit push --force
to update the remote