混沌工具包cli的混沌工具包云插件
chaostoolkit-cloud的Python项目详细描述
混沌工具包-混沌工具包的云扩展
这是用于Chaos Toolkit的混沌工具包云扩展包。
目的
此包的目的是与中的Chaos Toolkit Cloud通信 订购日期:
- 发布实验
- 公布这些实验的执行情况
- 通过一组控件控制执行
安装
将此软件包安装为任何其他python软件包:
$ pip install -U chaostoolkit-cloud
用法
安装后,将添加login
、publish
、enable
和disable
。
到chaos
命令。
$ chaos Usage: chaos [OPTIONS] COMMAND [ARGS]...Options: --version Show the version and exit. --verbose Display debug level traces. --no-version-check Do not search for an updated version of the chaostoolkit. --change-dir TEXT Change directory before running experiment. --no-log-file Disable logging to file entirely. --log-file TEXT File path where to write the command's log. [default: chaostoolkit.log] --settings TEXT Path to the settings file. [default: /home/sylvain/.chaostoolkit/settings.yaml] --help Show this message and exit.Commands: disable Disable a Chaos Toolkit's extension client feature discover Discover capabilities and experiments. enable Enable a Chaos Toolkit's extension client feature info Display information about the Chaos Toolkit environment. init Initialize a new experiment from discovered capabilities. login Set the access token to communicate with Chaos Toolkit run Run the experiment loaded from SOURCE, either a local file or a... validate Validate the experiment at PATH.
使用Chaos工具箱登录
为了工作,您首先需要在 Chaos Toolkit Cloud。首先,去那里生成一个新的令牌。复制那个 从下一个命令询问时,标记并粘贴它:
$ chaos login
Chaos Toolkit Cloud url [https://console.chaostoolkit.com]:
Chaos Toolkit Cloud token:
Experiments and executions will be published to organization 'MyName'
Chaos Toolkit Cloud details saved at ~/.chaostoolkit/settings.yaml
现在可以使用了。
在运行时发布实验和执行
一旦安装了这个扩展,它就开始传输实验 以及他们对你账户中Chaos Toolkit Cloud的执行。
$ chaos run test.json
[2019-07-01 14:49:40 INFO] Validating the experiment's syntax
[2019-07-01 14:49:40 INFO] Experiment looks valid
[2019-07-01 14:49:40 INFO] Running experiment: Look token in file
[2019-07-01 14:49:40 INFO] Execution available at https://console.chaostoolkit.com/MyName/experiments/fc36eb45-4718-4c4a-a50e-503552116cf3/executions/c07afe83-b590-486f-b149-de3d6de7e155
[2019-07-01 14:49:40 INFO] Steady state hypothesis: Our hypothesis is tour token is part of the file
[2019-07-01 14:49:41 INFO] Probe: grep-file
[2019-07-01 14:49:41 INFO] Steady state hypothesis is met!
[2019-07-01 14:49:41 INFO] Action: remove-token
[2019-07-01 14:49:41 INFO] Steady state hypothesis: Our hypothesis is tour roken is part of the file
[2019-07-01 14:49:41 INFO] Probe: grep-file
[2019-07-01 14:49:42 INFO] Steady state hypothesis is met!
[2019-07-01 14:49:42 INFO] Let's rollback...
[2019-07-01 14:49:42 INFO] Rollback: remove-token
[2019-07-01 14:49:42 INFO] Action: remove-token
[2019-07-01 14:49:42 INFO] Experiment ended with status: completed
< H3>发布现有执行< EH3>publish
命令允许您手动推送实验
通常记录在混沌工具箱中的发现
帐户。
禁用策略检查
在实验的开发期间,您可能希望禁用检查 因为政策会减缓你的工作。它们并不总是相关的 或者。禁止扩展请求是否允许执行 继续:
$ chaos disable policies
显然,运行mirroring命令可以重新启用它们:
$ chaos enable policies
禁用发布实验和执行
如果需要暂时禁用发布功能
$ chaos disable publish
注意,禁用发布时,必须禁用整个扩展。
显然,运行镜像命令以再次启用发布:
$ chaos enable publish
贡献
这个项目的贡献者是受欢迎的,因为这是一个开源的工作 寻求discussions和持续改进。
从代码的角度来看,如果您希望贡献,您将需要运行 Python3.5+环境。然后,分叉这个存储库并提交一个pr。 project关注代码的可读性,并检查代码样式以使其与 在PEP8中定义的实践。请确保您提供了测试 每当你提交一个公关,所以我们保持代码的可靠性。
发展
如果您希望在此项目上进行开发,请确保安装开发 依赖关系。但首先,create a virtual environment然后安装 这些依赖。
$ pip install -r requirements-dev.txt -r requirements.txt
然后,将您的环境指向此目录:
$ pip install -e .
现在,您可以编辑这些文件,您的
环境,即使在本地从chaos
命令运行时也是如此。
测试
要运行项目的测试,请执行以下操作:
$ pytest