为Juju Charms加载外部资源的辅助工具
项目描述
Juju Resources 
Juju Resources为charms提供从外部源加载二进制资源的辅助工具,以及为网络受限部署创建外部资源镜像的工具。
这旨在作为Juju核心支持资源之前的一个临时解决方案,同时也用于原型化所需的功能。
完整的文档可在以下网址在线查看:http://pythonhosted.org/jujuresources/
安装
使用pip安装Juju Resources
pip安装jujuresources
Charm使用
使用Juju Resources的charm需要定义一个resources.yaml,例如
resources: my_resource: url: http://example.com/path/to/my_resource.tgz hash: b377b7cccdd281bc5e4c4071f80e84a3 hash_type: sha256 my_py: pypi: jujuresources>=0.2 optional_resources: my_optional_resource: url: http://example.com/path/to/my_optional_resource.tgz hash: 476881ef4012262dfc8adc645ee786c4 hash_type: sha256
然后,一旦charm安装了Juju Resources,它就可以在Python中获取和验证资源
from jujuresources import fetch, verify, install, config_get if not fetch(mirror_url=config_get('resources_mirror')): print "Mandatory resources did not download; check resources_mirror option" sys.exit(1) install('my_py') fetch('my_optional_resource', mirror_url=config_get('resources_mirror')) if verify('my_optional_resource'): install('my_optional_resource', destination='/usr/lib/myres', skip_top_level=True)
或通过命令行/bash
if ! juju-resources fetch -u `config-get resources_mirror`; then echo "Mandatory resources did not download; check resources_mirror option" exit 1 fi juju-resources install my_py juju-resources fetch -u `config-get resources_mirror` my_optional_resource if juju-resources verify my_optional_resource; then juju-resources install my_optional_resource -D /usr/lib/myres -s fi
镜像资源
如果您需要在有限网络访问的环境中部署charm,您可以在提前创建镜像,或者在具有访问权限的网关节点上创建
mkdir local_mirror juju-resources fetch --all -d local_mirror -r http://github.com/me/my-charm/blob/master/resources.yaml juju-resources serve -d local_mirror
您将运行一个轻量级的HTTP服务器,您可以将charms的resources_mirror(或等效)配置选项设置为指向它,为在远程resources.yaml(-r <url-or-file>)中定义的所有(--all,可选和必需)资源提供服务,这些资源存储在本地local_mirror目录中(-d local_mirror)。
请注意,charms需要能够访问您运行的镜像机器和端口,并且charms必须支持配置选项以将Juju资源指向镜像(以及处理它们在首次部署时可能不可用的资源)。
项目详情
关闭
jujuresources-0.4.0.tar.gz的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | dbade544066885c2db48d18eca4512c89ca5c38c81ff8bd5b8ff228166dedb72 |
|
MD5 | fd11f4664de4aa695bbffd70cc0d0252 |
|
BLAKE2b-256 | f55299d235b36fab485e4fbdc805806ab213b835aed1bd26ee19babf2309f8cf |