Skip to main content

tango system cli manager

Project description

tangoctl

Pypi Version Python Versions Build Status Coverage Status

A CLI built for Tango system administrators.

tangoctl aims to be to Tango what systemctl is to to systemd.

Actions speak louder than words. Here is a video:

tangoctl in action

Purpose

  • day to day Tango maintenance
  • help automate ansible, puppet or chef scripts
  • prepare automated test scripts for your own software
  • help write a custom bash completion for your tool

Features

  • server operations:
    • server info
    • tree of servers
    • list of servers
    • register/unregister servers
  • device operations:
    • device info
    • tree of devices
    • list of devices
    • register/unregister devices
    • execute commands
    • command info
    • read and write attributes
    • attribute info
    • read and write properties

Installation

pip install it on your favorite python environment:

$ pip install tangoctl

That's it!

Examples

# Display tree of servers:
tangoctl server tree

# Display list of devices:
tangoctl device list

# Read 'state' attribute from a device
tangoctl device attribute read -d sys/tg_test/1 -a state

# Execute command Init() on a device
tangoctl device command exec -d sys/tg_test/1 -c init

# Display 'double_spectrum' attribute information
tangoctl device attribute info -d sys/tg_test/1 -a double_spectrum

# Display list of device attributes:
tangoctl device attribute list -d sys/tg_test/1

Writting a custom bash completion for your server

Imagine you have a Tango server called LimaCCDs and you registered two instances in the database, maybe using tangoctl:

tangoctl server add LimaCCDs/basler1 -d id00/limaccds/basler1
tangoctl server add LimaCCDs/pilatus1 -d id00/limaccds/pilatus1

To have bash auto-complete every time you type LimaCCDs [tab] on the command line, place the following lines in a bash script:

# naive tango server autocomplete using tangoctl server ilist
_tango_server_complete()
{
    stype="${COMP_WORDS[0]}"
    sname="${COMP_WORDS[COMP_CWORD]}"
    echo $stype
    COMPREPLY=( $(tangoctl server ilist -t "${stype}" --instance="${sname}*") )
    return 0
}

complete -F _tango_server_complete Demo

and run it. Next time you type LimaCCDs [tab]] on the bash command line it will offer the existing LimaCCDs instances as completion options:

$ LimaCCDs [tab]
basler1 pilatus1

$ LimaCCDs pil[tab]
pilatus1

Check the bash completion documentation on how to add it permanently to your environment.

Special thanks to

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

tangoctl-0.4.0.tar.gz (26.4 kB view details)

Uploaded Source

File details

Details for the file tangoctl-0.4.0.tar.gz.

File metadata

  • Download URL: tangoctl-0.4.0.tar.gz
  • Upload date:
  • Size: 26.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0.post20200127 requests-toolbelt/0.8.0 tqdm/4.42.0 CPython/3.7.5

File hashes

Hashes for tangoctl-0.4.0.tar.gz
Algorithm Hash digest
SHA256 b54aa5482b1863b4419eeb6bd25219ebb80690481f47a28b37dee3b5b044fcbb
MD5 f7184f301aa9c74a0733da57cf672b50
BLAKE2b-256 e3b290de616539c2c24c4ab6e5fdba7a15a7dc8e23f922bd44909e4ebf18c971

See more details on using hashes here.

Supported by

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