Skip to main content

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

Metadata

Release files for tangoctl 0.10.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tangoctl 0.10.0
File Size Uploaded
tangoctl-0.10.0.tar.gz 40.3 kB Details

Release files / tangoctl-0.10.0.tar.gz

Download URL tangoctl-0.10.0.tar.gz
Size 40.3 kB
Tags Source
SHA-256 checksum
How to use checksums
0fd9f586aaad39f482e165ed9a8f2bad66bec1decefc48eac93801e6693bf414
BLAKE2b-256 checksum
How to use checksums
33e3e80e7c2cb0cb346605ad69c51584669f4d4e9ed17700a3153c152e792c42
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.9.2

Release history Release notifications | RSS feed

This release

0.10.0 This release

1 release file

0.9.0

1 release file

0.8.0

1 release file

0.7.0

1 release file

0.6.0

1 release file

0.5.0

1 release file

0.4.0

1 release file

0.3.8

1 release file

0.3.7

1 release file

0.3.6

1 release file

0.3.4

1 release file

0.3.3

1 release file

0.3.2

1 release file

0.3.1

1 release file

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page