Skip to content
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

New lookup plugin snow: Lookup record data from Service-Now #30804

Closed
wants to merge 1 commit into from

Conversation

garbled1
Copy link
Contributor

SUMMARY

Add a lookup plugin to search and find record data in Service-Now

ISSUE TYPE
  • Feature Pull Request
COMPONENT NAME

lib/ansible/plugins/lookup/snow.py

ANSIBLE VERSION
ansible 2.5.0 (snow_lookup 7c7e7fbfd3) last updated 2017/09/23 20:33:55 (GMT +000)
  config file = None
  configured module search path = [u'/home/ec2-user/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /home/ec2-user/ansible/lib/ansible
  executable location = /home/ec2-user/ansible/bin/ansible
  python version = 2.7.12 (default, Sep  1 2016, 22:14:00) [GCC 4.8.3 20140911 (Red Hat 4.8.3-9)]
ADDITIONAL INFORMATION

Plugin to allow scanning of records in service now.

---
- hosts: localhost
  connection: local
  vars:
    snow_context:
      table: incident
      instance: dev18962
      username: ansible_test
      password: my_password
      result_fields: [number]
  tasks:

    - name: Example of with_snow using record numbers and context
      debug:
        var: item
        verbosity: 0
      with_snow:
        - context: "{{snow_context}}"
        - INC0000055
        - INC0000054
    
    - name: check for incident numbered INC0000055
      debug: msg={{ lookup("snow", "INC0000055", context=snow_context) }}

    - name: Find all records in the incident table that are on hold, full variable definition
      debug: msg={{ lookup("snow", "2", instance='dev18962',
                    username='ansible_test', password='my_password',
                    table='incident', lookup_field='state', result_fields=['sys_id']) }}

@ansibot ansibot added affects_2.5 This issue/PR affects Ansible v2.5 feature_pull_request needs_triage Needs a first human triage before being processed. plugins/lookup support:core This issue/PR relates to code supported by the Ansible Engineering Team. needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. labels Sep 23, 2017
@garbled1
Copy link
Contributor Author

I'm not sure I understand why this is unstable. ?

@alikins alikins added c:plugins/lookup new_plugin This PR includes a new plugin. and removed needs_triage Needs a first human triage before being processed. labels Sep 25, 2017
@mattclay
Copy link
Member

@garbled1 I've restarted the tests. The unstable result appears to be unrelated to your changes.

@garbled1
Copy link
Contributor Author

Looks like the failure was something to do with installing an rpm on fedora and the pkg index. So unrelated I think?

@mattclay
Copy link
Member

mattclay commented Oct 3, 2017

@garbled1 Yes, I've restarted CI again. Hopefully we won't hit the timeout this time.

@ansibot ansibot removed the needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. label Oct 3, 2017
@ansibot ansibot added the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label Oct 11, 2017
@garbled1
Copy link
Contributor Author

Looks like the CI is good on this one now, is it awaiting review?

@ansibot ansibot added feature This issue/PR relates to a feature request. and removed feature_pull_request labels Mar 2, 2018
@ansibot ansibot added support:community This issue/PR relates to code supported by the Ansible community. and removed support:core This issue/PR relates to code supported by the Ansible Engineering Team. labels Sep 19, 2018
@ansibot ansibot added the community_review In order to be merged, this PR must follow the community review workflow. label Oct 25, 2018
@Akasurde
Copy link
Member

@n3pjk Could you please review this and let me know ? Thanks

@Akasurde Akasurde self-assigned this Oct 20, 2019
@n3pjk
Copy link
Contributor

n3pjk commented Oct 20, 2019

This looks like an alternative approach to snow_record_find (SRF). I think SRF has a more robust query building capability, and one can retrieve a set of SNow records and use the standard 'with: "{{ snow_records }}"' to process. Also, the login context is more tightly bound to the query in SRF.

In the conversation I had with @garbled1 re SRF, I recall him saying he didn't know why SRF wasn't also included. Perhaps this was another take on the same problem? I'm wondering if this is still needed.

In any case, this needs to have OAuth support added. It can't use ServiceNowClient as it isn't a full-fledged module.

@Akasurde
Copy link
Member

Closing this in-favor of snow_record_find (SRF) module. @garbled1 Thanks for the contribution. @n3pjk Thanks for the review.

@Akasurde Akasurde closed this Oct 22, 2019
@ansible ansible locked and limited conversation to collaborators Nov 19, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.5 This issue/PR affects Ansible v2.5 c:plugins/lookup community_review In order to be merged, this PR must follow the community review workflow. feature This issue/PR relates to a feature request. new_plugin This PR includes a new plugin. plugins/lookup stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. support:community This issue/PR relates to code supported by the Ansible community.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants