用于使用juju charm store api的python库。
theblues的Python项目详细描述
用于使用juju charmstore api的python库。
安装
安装Blues最简单的方法是通过pip:
$ pip install theblues
部分蓝调音乐需要使用杏仁饼(例如解析 charmstore.fetch_macaroon或与identitymanager.discharge交互。
要使用经过身份验证的Blues方面,例如Jimm,您需要能够 管理杏仁饼。布鲁斯音乐是围绕着libmacaroons发展起来的。在ubuntu上,你 可以从p p a获得libmacaroons:
$ sudo add-apt-repository ppa:yellow/ppa -y $ apt-get install libmacaroons0 python-macaroons libsodium13
没有这些,Blues不能向 魅力商店或其他服务,但可与魅力沟通 存储诸如查找魅力信息之类的内容。
用法
与charmstore的交互非常简单在 charmstore(例如,一个符咒或包裹):
>>> from theblues.charmstore import CharmStore >>> cs = CharmStore('https://api.jujucharms.com/v4') >>> entity = cs.entity('wordpress') >>> entity['Id'] u'cs:trusty/wordpress-2'
实体的数据包含在响应的meta项中,与 从charmstores返回的json:
>>> entity['Meta']['charm-metadata']['Name'] u'wordpress'
您还可以获取实体的文件:
>>> cs.files('wordpress')['hooks/install'] u'https://api.jujucharms.com/v4/wordpress/archive/hooks/install >>> hook = cs.files('wordpress', filename='hooks/install', read_file=True) >>> print hook #!/bin/bash set -xe ... <snipped for length> ... juju-log "So, environment is setup. We'll wait for some hooks to fire off before we get all crazy"
要查看所有可用的方法,请参阅完整的文档。
历史
0.5.1(2019-01-10)
添加在获取实体信息时定义默认包含的功能
0.5.0(2018-10-03)
提出请求:添加对包含杏仁饼头的支持
0.4.1(2018-09-20)
不要再依赖idm认证添加对杏仁饼的支持
0.3.9(2018-09-18)
使禁用统计信息收集成为可能 增加钱包和预算 使用http bakery。 将魅力动作数据添加到魅力数据
0.3.8(2016-11-23)
请求释放令牌时,请在idm查询中正确引用用户名
0.3.7(2016-11-03)
支持为向后兼容而重写默认URL。 接受实体ID上的cs:prefix
0.3.6(2016-10-03)
用JIMM API替换JEM API
0.3.5(2016-09-30)
为用户返回编码数组而释放。 更新makefile以在干净可靠的机器上工作。 开发通道的简单重命名。
0.3.4(2016-07-28)
统一超时。 确保我们没有意外的异常。 为用户终结点添加释放令牌。
0.3.3(2016-07-04)
添加支持案例创建。
0.3.2(2016-06-14)
添加对条款和计划的支持。
0.3.1(2016-05-10)
在API调用中包含所有者
0.3.0(2016-05-03)
将jem api调用更新到版本2。
0.2.2(2016-04-19)
在元搜索和资源URL方法中添加资源。
0.2.1(2016-04-15)
- 添加了Identity Manager和Juju Environment Manager API的代码
- 更新的文档
0.2.0(2016-03-24)
- 添加lgpl3许可证。
- 添加可选的通道参数。
- 让DEPS在Trusty-gt;Xenial上工作时不那么严格。
0.1.1(2016-01-25)
- 使用来自jumbundlelib的引用作为参数
- 添加列表终结点。
0.1.0(2015-12-04)
- 准备空的杏仁饼干。
0.0.5(2015-11-20)
- 公开公共信息。
- 修复导入
0.0.4(2015-06-10)
- 支持对charmstore请求设置超时。
0.0.3(2015-05-04)
- 将类型筛选器添加到charmstore搜索
0.0.2(2015-04-08)
- 将序列筛选器添加到charmstore搜索。
- 将来自charmstore的407 http错误处理为EntityNotFound
- 向自述文件添加简单用法示例。
- 对黑客的一些小改动。
- 小修小修。
0.0.1(2015-03-19)
- 初次发布