没有项目描述

clingmerv的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能否使用OpenJPA将一个实体持久化到多个持久化单元?   java如何访问当前按下的键   java singleton是否意味着哈希代码总是返回相同的值?   inputstream无法在Java中同时使用STDIN和STDERR读取程序输出   java运行时有多贵。getRuntime()与获取内存度量相结合   java AndroidStudio ListView适配器更新   java小程序请求未扩展实时会话   java是设置布尔值所必需的关键部分?   java比较两个字符串,并突出显示发现的不匹配项   java带抽屉布局,无论哪个屏幕处于活动状态,如何在按下后退键时关闭应用程序?   爪哇:颜色有什么区别。黑色和彩色。黑色   Velocity模板中子类的java访问方法   java如何快速学习Drools或其他规则引擎   从Java应用程序访问时缓存数据库查询结果   java cassandra nodetool JPLISAgent。c错误   java我正在解析一个没有pubDate的RSS提要,有没有其他方法可以确定一个项目是何时发布的?