如何使用 juju-deployer 从私有 git 存储库部署 juju charm?

如何使用 juju-deployer 从私有 git 存储库部署 juju charm?

我将 Charm 存储在私有 Git 存储库中。我正尝试使用juju-deployer它直接从该 Git 存储库部署 Charm。

假设 Git 存储库是[email protected]:charms.git,并且在该存储库中,我有一个位于目录中的 charm trusty/rsyslog。我希望能够juju-deployer像这样定义我的 YAML 文件:

        "rsyslog":
      charm: rsyslog
#      branch: "[email protected]:charms.git/trusty/rsyslog@4f18be16d9f920ebb7f725998e7d2d08bbdd64fe"
      branch: "http://10.10.10.10/charms.git/trusty/rsyslog@4f18be16d9f920ebb7f725998e7d2d08bbdd64fe"
      num_units: 1
      to: 0
      options:
        messages_rotate: 30
        nova_logs: true
        syslog_rotate: 30

但是我不断收到 juju-deployer (版本 0.5.1.-3) 的错误

    Traceback (most recent call last):
  File "/usr/bin/juju-deployer", line 9, in <module>
    load_entry_point('juju-deployer==0.5.1', 'console_scripts', 'juju-deployer')()
  File "/usr/lib/python2.7/dist-packages/deployer/cli.py", line 135, in main
    run()
  File "/usr/lib/python2.7/dist-packages/deployer/cli.py", line 233, in run
    importer.Importer(env, deployment, options).run()
  File "/usr/lib/python2.7/dist-packages/deployer/action/importer.py", line 294, in run
    self.get_charms()
  File "/usr/lib/python2.7/dist-packages/deployer/action/importer.py", line 146, in get_charms
    no_local_mods=self.options.no_local_mods)
  File "/usr/lib/python2.7/dist-packages/deployer/deployment.py", line 170, in fetch_charms
    for charm in self.get_charms():
  File "/usr/lib/python2.7/dist-packages/deployer/deployment.py", line 162, in get_charms
    yield Charm.from_service(k, self.repo_path, self.series, v)
  File "/usr/lib/python2.7/dist-packages/deployer/charm.py", line 96, in from_service
    return cls(name, charm_path, branch, rev, build, store_url)
  File "/usr/lib/python2.7/dist-packages/deployer/charm.py", line 30, in __init__
    self.vcs = self.get_vcs()
  File "/usr/lib/python2.7/dist-packages/deployer/charm.py", line 44, in get_vcs
    "Could not determine vcs backend for %s" % self.branch)
ValueError: Could not determine vcs backend for http://10.10.10.10/charms.git/trusty/rsyslog

如果我尝试使用上面 YAML 文件中注释掉的行,那么它会给我一个不同的错误:

2015-09-15 08:10:08  Branching charm git @ precise/rsyslog
2015-09-15 08:10:08 Could not branch git to precise/rsyslog
 fatal: repository 'git' does not exist
2015-09-15 08:10:08 Deployment stopped. run time: 0.27

这个错误很奇怪,因为我的 YAML 文件中没有提到任何精确的信息。

答案1

对于 git,branch:字符串应该:

  • 以 'git' 开头,或者
  • 包含“github.com”,或
  • 包含“git.launchpad.net”,或
  • 是 git repo 的本地路径

如果字符串包含“@”符号(可选),则“@”后面的所有内容将被视为克隆后要签出的修订。

相关内容