没有项目描述

paradino的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变量始终存储0值。为什么?   如何使用Java/REST将Azure blob从一个存储容器移动到另一个存储容器?   java将commons DBCP从1.2升级到1.4,我应该害怕吗?   java如何使用分隔符拆分字符串?   java使用数组读取json对象   java在groovy中切片字符串   交换数组java的两个邻域元素   java移动用于确定字符串是否为回文的逻辑   java Android应用程序在一个活动中崩溃   java Sparkjava将webapp文件夹设置为静态资源/模板的文件夹   java复杂条件表达式,用户易用。   java如何仅在表存在时从表中选择值   java I无法将数据从Recyclerview传递到其他活动   java数据结构最佳设计(大数据)   java Android从DatePickerDialogFragment中删除日历视图   java将数据从Firebase获取到片段   数组。sort()在java中运行不正常