Skip to main content

No project description provided

Project description

Intro

This project shows you how to set up the NOW CLI and use it to interact with a ServiceNow instance either locally from your workstation or from a CI/CD Pipeline like Jenkins

Prerequisites

  • Python3 Installed
  • PiPy Account to deploy package

Installation

  • Clone Project

    git clone git@github.com:advlab/cronus.git nowcli
    cd nowcli
    
  • Install Package from Source

    sudo python3 setup.py install
    

    NOTE: Once the package is deployed to the PyPI repository you can install the latest package using the standard pip3 command (e.g. pip3 install nowcli)

  • Uninstall Package

    sudo pip3 uninstall -y nowcli
    

Deploy Package to PiPi

  • Install Twine

    pip3 install twine
    
  • Create Source Distribution

    python3 setup.py sdist
    
  • Deploy Package

    twine upload dist/*
    

Operation

  • Create default profile in ~/.now/credentials

    $now configure
    
  • Setup additional profiles (e.g. newyork) and use your instance specifics

    $ now -p newyork configure
    table_api [/api/now/table]:
    cmdb_api [/api/x_snc_labs_atlas/v1/register/services]: 
    em_api [/api/x_snc_labs_atlas/v1/create/event]: 
    server []: https://newyorkdemo01.service-now.com
    username []: admin
    password []: changeit
    
  • Register Service (e.g. startreck.json)

    $ now -p newyork -d startreck.json cmdb register-services
    Called CMDB...
    {'result': {'code': '200', 'type': 'register_services', 'message': 'Services created in ServiceNow: 4'}}
    
  • Create Event

  • Resolve Incident

Payloads

  • startreck.json

    {
    "name": "USS Enteprise NCC-1701",
    "comments": "NCC-1701 Constitution Class Starship",
    "services": [{
            "name": "ncc1701",
            "uri": "http://ncc1701.net"
        },
        {
            "name": "weapons",
            "uri": "http://weapons.ncc1701.net"
        },
        {
            "name": "phasers",
            "uri": "http://phasers.ncc1701.net"
        },
        {
            "name": "lifesuppport",
            "uri": "http://lifesupport.ncc1701.net"
        }
    ],
    "relationships": [{
            "parent": null,
            "child": "ncc1701"
        },
        {
            "parent": "ncc1701",
            "child": "weapons"
        },
        {
            "parent": "weapons",
            "child": "phasers"
        },
        {
            "parent": "ncc1701",
            "child": "lifesuppport"
        }
    ]
    }
    

Reference

Python 3

This section describes how to install Python 3.7.2 in Ubuntu 18.04 / 18.10

  • Install Python 3

    sudo add-apt-repository ppa:ubuntu-toolchain-r/ppa
    sudo apt install -y python3.7
    
  • Install Pip

    sudo apt install -y python3-pip
    
  • To check versions

    apt list --installed | grep python
    
  • Install Unit Tester

    pip3 install nose
    
  • Install Nose Tester

    sudo apt install python-nose
    
  • Run Unit Tester

    nosetests --with-xunit tests/test_project.py
    
  • Freeze Requirements

    pip3 freeze > requirements.txt
    

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nowcli-1.0.1.tar.gz (6.1 kB view details)

Uploaded Source

Built Distribution

nowcli-1.0.1-py3.6.egg (12.1 kB view details)

Uploaded Source

File details

Details for the file nowcli-1.0.1.tar.gz.

File metadata

  • Download URL: nowcli-1.0.1.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.1 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.7

File hashes

Hashes for nowcli-1.0.1.tar.gz
Algorithm Hash digest
SHA256 c9275203e8ee9455cad0cd19bbb58a2ef588f7e325225cf4f4f4ebca4a5b7d7e
MD5 682ee31bc5252250ecb45c31203bf45e
BLAKE2b-256 e5700c7038461bb39767ea396f0faf8c7565b85e2aecdd20f73b67126f035ea3

See more details on using hashes here.

Provenance

File details

Details for the file nowcli-1.0.1-py3.6.egg.

File metadata

  • Download URL: nowcli-1.0.1-py3.6.egg
  • Upload date:
  • Size: 12.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.1 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.6.7

File hashes

Hashes for nowcli-1.0.1-py3.6.egg
Algorithm Hash digest
SHA256 c961193f595d0c464958bd30790df8e3db4f5ec5743b186e8d4d89682c0745fb
MD5 f7b00ca4ebe555e640d47d67b042a2b5
BLAKE2b-256 8a6b4b83e68ee2ebe73fbf5d56e1f64756192bfadb8b53609d7ae5965307ae82

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page