没有项目描述

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 Cassandra复制因子大于节点数   java J2EE JTA事务回滚不适用于OSE Glassfish 4.0(Build 89)   java spring安全预认证用户登录   org的java类文件。反应流。从RxJava编译示例时未找到Publisher?   java在使用dataFormat作为POJO通过Camel调用Web服务时无法设置SOAP标头   Javafx类的java静态实例   java如何防止一个部件在关闭时覆盖另一个部件的位置   sql server无法从我的java代码连接到数据库   java在JList(Swing)中显示带有的ArrayList   从Java中的CXF服务获取WSAddressing数据   使用资产文件夹进行java简单json解析(本地)   java LDAPException未绑定的无效凭据   JavaJSFspring部署到weblogic   JAVA中字符数组中的特定元素排列?   如果脚本位于不同的目录中,则ant不会使用exec标记运行Javashell脚本