У меня возникла незнакомая проблема с модулем snow_record при попытке выполнить обновление. Вот моя книга:
- name: Grab the current SR record
block:
- name: Grab the current SR record
snow_record:
username: username
password: password
instance: instance.com
state: present
number: "{{SR_number}}"
table: sc_req_item
register: grabRecord
rescue:
- debug:
msg: "UNABLE to grab record via sys_id {{SR_sys_id}}"
- name: display the record if grabRecord is defined
debug:
msg: "{{grabRecord}}"
when: grabRecord is defined
- name: Update ticket to 'In Processing' after found required Record
block:
- name: Update ticket to 'In Processing' after found required Record
snow_record:
username: username
password: password
instance: instance
table: sc_req_item
state: present
number: "{{SR_number}}"
data:
u_switch_status_automation: "In Processing"
u_switch_description: "The Automation currently processing this SR"
register: inProcessResult
rescue:
- debug:
msg: "UNABLE TO UPDATE IN PROCESSING"
- name: display the record if inProcessResult is defined
debug:
msg: "{{inProcessResult}}"
when: inProcessResult is defined
Странная вещь в том, что я могу прочитать и захватить запись, но когда я пытаюсь обновить запись, она возвращает ошибку. Для получения дополнительной информации, роль / учетные данные, которые я использую, могут обновлять запись напрямую и вручную через сам сервис. Вот мой результат:
TASK [update_inProcessing : Grab the current SR record] ************************
[0;32mok: [localhost][0m
[0;32m[0m
TASK [update_inProcessing : display the record if grabRecord is defined] *******
[0;32mok: [localhost] => {[0m
[0;32m "msg": {[0m
[0;32m "changed": false, [0m
[0;32m "failed": false, [0m
[0;32m "instance": "instance.com", [0m
[0;32m "lookup_field": "number", [0m
[0;32m "number": "RITM000000013596", [0m
[0;32m "record": {[0m
[0;32m "active": "true", [0m
[0;32m "approval": "requested", [0m
[0;32m "approval_history": "", [0m
[0;32m "close_notes": "", [0m
[0;32m "closed_at": "", [0m
[0;32m "closed_by": "", [0m
[0;32m "description": "Test 1", [0m
[0;32m "due_date": "2020-05-19 23:25:11", [0m
[0;32m "escalation": "0", [0m
[0;32m "estimated_delivery": "", [0m
[0;32m "expected_start": "", [0m
[0;32m "follow_up": "", [0m
[0;32m "group_list": "", [0m
[0;32m "impact": "3", [0m
[0;32m "knowledge": "false", [0m
[0;32m "location": "", [0m
[0;32m "made_sla": "true", [0m
[0;32m "number": "RITM000000013596", [0m
[0;32m "opened_at": "2020-05-19 09:25:13", [0m
[0;32m "parent": "", [0m
[0;32m "price": "0", [0m
[0;32m "priority": "3", [0m
[0;32m "quantity": "1", [0m
[0;32m "stage": "request_approved", [0m
[0;32m "state": "1", [0m
[0;32m "sys_class_name": "sc_req_item", [0m
[0;32m "sys_created_by": "adminsr1", [0m
[0;32m "sys_created_on": "2020-05-19 09:25:13", [0m
[0;32m "u_category": "Desktop", [0m
[0;32m "u_change_request_required": "", [0m
[0;32m "u_change_ticket_number": "", [0m
[0;32m "u_new_custodian": "", [0m
[0;32m "u_new_hostname": "N1111SLDRW04774", [0m
[0;32m "u_new_location": "", [0m
[0;32m "u_switch_description": "For staging requested", [0m
[0;32m "u_switch_status_automation": "staging_requested", [0m
[0;32m "u_task_status": "Pending", [0m
[0;32m "u_technology": "", [0m
[0;32m "u_tender_ref_number": "", [0m
[0;32m "upon_approval": "proceed", [0m
[0;32m "upon_reject": "cancel", [0m
[0;32m "urgency": "3", [0m
[0;32m "user_input": "", [0m
[0;32m "watch_list": "", [0m
[0;32m "work_end": "", [0m
[0;32m "work_notes": "", [0m
[0;32m "work_notes_list": "", [0m
[0;32m "work_start": ""[0m
[0;32m }, [0m
[0;32m "table": "sc_req_item"[0m
[0;32m }[0m
[0;32m}[0m
[0;32m[0m
TASK [update_inProcessing : Update ticket to 'In Processing' after found required Record] ***
[0;31mfatal: [localhost]: FAILED! => {"changed": false, "instance": "instance.com", "lookup_field": "number", "msg": "Failed to update record: The request was successful but the content didn't contain the expected 'result'", "number": "RITM000000013596", "table": "sc_req_item"}[0m
[0;31m[0m
TASK [update_inProcessing : debug] *********************************************
[0;32mok: [localhost] => {[0m
[0;32m "msg": "UNABLE TO UPDATE IN PROCESSING"[0m
[0;32m}[0m
[0;32m[0m
TASK [update_inProcessing : display the record if inProcessResult is defined] ***
[0;32mok: [localhost] => {[0m
[0;32m "msg": {[0m
[0;32m "changed": false, [0m
[0;32m "failed": true, [0m
[0;32m "instance": "instance.com", [0m
[0;32m "lookup_field": "number", [0m
[0;32m "msg": "Failed to update record: The request was successful but the content didn't contain the expected 'result'", [0m
[0;32m "number": "RITM000000013596", [0m
[0;32m "table": "sc_req_item"[0m
[0;32m }[0m
[0;32m}[0m
[0;32m[0m