跳转到主要内容

tango系统命令行管理器

项目描述

tangoctl

Pypi Version Python Versions Build Status Coverage Status

Tango系统管理员构建的命令行界面。

tangoctl的目标是成为Tango的systemctl。

行动胜于言语。以下是一个视频

tangoctl in action

目的

  • 日常Tango维护
  • 帮助自动化Ansible、Puppet或Chef脚本
  • 为您的软件准备自动化测试脚本
  • 帮助为您的工具编写自定义的bash完成

特性

  • 服务器操作
    • 服务器信息
    • 服务器树
    • 服务器列表
    • 注册/注销服务器
  • 设备操作
    • 设备信息
    • 设备树
    • 设备列表
    • 注册/注销设备
    • 执行命令
    • 命令信息
    • 读写属性
    • 属性信息
    • 读写属性

安装

在您喜欢的Python环境中安装它

$ pip install tangoctl

就是这样!

示例

# 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

编写您的服务器自定义bash完成

假设您有一个名为Tango的服务器LimaCCDs,并在数据库中注册了两个实例,也许使用了tangoctl

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

要在命令行中每次键入 LimaCCDs [tab] 时自动完成,请将以下行放入一个bash脚本中

# 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

并运行它。下次您在bash命令行中键入 LimaCCDs [tab]] 时,它将提供现有的LimaCCDs实例作为完成选项

$ LimaCCDs [tab]
basler1 pilatus1

$ LimaCCDs pil[tab]
pilatus1

有关如何将其永久添加到您环境的说明,请参阅bash完成文档。

特别感谢

项目详情


下载文件

下载适合您平台的文件。如果您不确定要选择哪一个,请了解更多关于 安装包 的信息。

源分发

tangoctl-0.10.0.tar.gz (40.3 kB 查看哈希值)

上传时间

支持