环境管理器cli工具。

envmgr-cli的Python项目详细描述


用于Environment Manager

的跨平台cli客户端
envmgr example

安装

pip install envmgr-cli

有关进一步的安装说明,请参见Configuration

用法

envmgr旨在提供直观的、可读的界面 围绕较低层Environment Manager Python Library

所有envmgr命令都公开在一组动词(geta)后面 状态,schedule一些停机时间,wait一个asg,等等)。动词是 总是提供给envmgr的第一个值,并且只有一个 每个命令的动词。

docopt

cli接口在docopt中描述。 发现和理解不同使用模式的最简单方法 可用的方法是简单地运行

envmgr --help

输出

默认情况下,envmgr命令将输出一个人性化的响应 用于一次测试单个命令。帮助编写脚本或 将结果链接在一起,所有命令也接受--json 将从环境返回原始json响应的参数 经理:

>> envmgr schedule asg my-asg on in prod
Scheduled 1 instance in my-asg to: ON

>> envmgr schedule asg my-asg on in prod --json
{"ChangedInstances": ["i-0afe2276909859130"], "ChangedAutoScalingGroups": ["my-asg"]}

示例

在下面的示例中,假设“prod-1”是一个环境,“awesomeservice”是一个 “我的ASG”是一个ASG,所有这些都已经在 环境经理。

# Get the health status of all instances of AwesomeService, in all slices:
envmgr get AwesomeService health in prod-1

# Get the the active slice information for the AwesomeService service in prod-1 environment:
envmgr get AwesomeService active slice in prod-1

# Get the status of the my-asg ASG in the prod-1 environment. Status is calculated as an aggregate of all instances in the ASG:
envmgr get asg my-asg status in prod-1

# Get the schedule value set on the my-asg ASG in the prod-1 environment. Note this will tell you what the schedule is configured to - not the current state according to the schedule:
envmgr get asg my-asg schedule in prod-1

# Get the current status of the deployment with ID a2fbb0c0-ed4c-11e6-85b1-2b6d1cb68994:
envmgr get deploy status a2fbb0c0-ed4c-11e6-85b1-2b6d1cb68994

# Block and wait until the deployment with ID a2fbb0c0-ed4c-11e6-85b1-2b6d1cb68994 either succeeds or fails:
envmgr wait-for deploy a2fbb0c0-ed4c-11e6-85b1-2b6d1cb68994

# Block and wait until all instances in the ASG my-asg are ready fordeployment (In Service):
envmgr wait-for asg my-asg in prod-1

# Block and wait until the service AwesomeService is running with all healthchecks passing:
envmgr wait-for healthy AwesomeService in prod-1

# Set the schedule of the ASG my-asg in prod-1 to be off permanently until further notice:
envmgr schedule asg my-asg off in prod-1

# Publish the file build-22.zip as version 1.2.9 of AwesomeService:
envmgr publish build-22.zip as AwesomeService 1.2.9

# Deploy the published version 1.2.9 of AwesomeService into the prod-1 environment:
envmgr deploy AwesomeService 1.2.9 in prod-1

# Toggle the upstreams for AwesomeService in the prod-1 environment:
envmgr toggle AwesomeService in prod-1

# Get the Windows patch status for servers belonging to A-Team in prod-1:
envmgr get A-team patch status in prod-1

配置

认证

所有对环境管理器的调用都需要身份验证,可以是 以两种方式之一提供。

将凭据导出为环境变量:

ENVMGR_USER=myusername
ENVMGR_PASS=mypa$$word

或者为每个commad提供一个--user--pass值:

envmgr get MyService health in prod --user="sarah" --pass="pa$$word"

注意:建议只在ci环境中使用此方法。

主机配置

已配置环境管理器实例的主机名 与您的凭证类似:

将主机名导出为环境变量:

ENVMGR_HOST=environmentmanager.acme.com

或者为每个命令提供主机名:

envmgr get MyService health in prod --host=environmentmanager.acme.com

开发

要安装所有测试依赖项并运行所有测试,只需运行:

python setup.py test [--adopts -v]

为了方便起见,还可以通过包含的makefile获取此文件:

make test

码头工人

如果需要,您可以使用我们的自动容器构建

使用量

docker run -it --rm \
-e ENVMGR_USER=user
-e ENVMGR_PASS=password
-e ENVMGR_HOST=foo.bar
trainline/envmgr-cli:latest envmgr {YOUR_ARGS}

示例

~$ docker run -it --rm trainline/envmgr-cli envmgr --version
1.9.1

建造

docker build -t {YOUR_NAME}/envmgr-cli .

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
用户界面java,使用gui连接到另一台计算机/服务器的文件系统   运行sbt的ubuntu返回错误:“javahome需要<path>参数”   java如何在Android中处理许多ImageView而不出现内存问题?   查询中非法字符的java相同URL失败   安卓取消引用可能会产生“java”。lang.NullPointerException'   java中的indexoutofboundsexception“java.lang.ArrayIndexOutOfBoundsException”错误   xml Java将dom保存到文件>文件在程序结束后由另一个进程打开   Java的垃圾收集器是如何工作的?   Java如何筛选值(列表)   java处理字符串我怎样才能像在真实的书籍中一样在上面部分生成“小数字”呢?   java SonarQube是否有一个API来获取所有项目分析的一部分?   java startActivity(intent)什么都不做   JAVAutil。扫描器类Java   java如何从Firebase更新电子邮件?UpdateMail方法已被弃用   java Hibernate。如何正确组织带有注释的onetomany关系?   在java中获得卷标和驱动器号之间的映射(而不是FileSystemView)的解决方法是什么   java查找文件的路径