当前位置: 首页>>代码示例>>Python>>正文


Python fetch.SourceConfigError方法代码示例

本文整理汇总了Python中charmhelpers.fetch.SourceConfigError方法的典型用法代码示例。如果您正苦于以下问题:Python fetch.SourceConfigError方法的具体用法?Python fetch.SourceConfigError怎么用?Python fetch.SourceConfigError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在charmhelpers.fetch的用法示例。


在下文中一共展示了fetch.SourceConfigError方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _add_proposed

# 需要导入模块: from charmhelpers import fetch [as 别名]
# 或者: from charmhelpers.fetch import SourceConfigError [as 别名]
def _add_proposed():
    """Add the PROPOSED_POCKET as /etc/apt/source.list.d/proposed.list

    Uses lsb_release()['DISTRIB_CODENAME'] to determine the correct staza for
    the deb line.

    For intel architecutres PROPOSED_POCKET is used for the release, but for
    other architectures PROPOSED_PORTS_POCKET is used for the release.
    """
    release = lsb_release()['DISTRIB_CODENAME']
    arch = platform.machine()
    if arch not in six.iterkeys(ARCH_TO_PROPOSED_POCKET):
        raise SourceConfigError("Arch {} not supported for (distro-)proposed"
                                .format(arch))
    with open('/etc/apt/sources.list.d/proposed.list', 'w') as apt:
        apt.write(ARCH_TO_PROPOSED_POCKET[arch].format(release)) 
开发者ID:openstack,项目名称:charm-swift-proxy,代码行数:18,代码来源:ubuntu.py

示例2: _add_cloud_pocket

# 需要导入模块: from charmhelpers import fetch [as 别名]
# 或者: from charmhelpers.fetch import SourceConfigError [as 别名]
def _add_cloud_pocket(pocket):
    """Add a cloud pocket as /etc/apt/sources.d/cloud-archive.list

    Note that this overwrites the existing file if there is one.

    This function also converts the simple pocket in to the actual pocket using
    the CLOUD_ARCHIVE_POCKETS mapping.

    :param pocket: string representing the pocket to add a deb spec for.
    :raises: SourceConfigError if the cloud pocket doesn't exist or the
        requested release doesn't match the current distro version.
    """
    apt_install(filter_installed_packages(['ubuntu-cloud-keyring']),
                fatal=True)
    if pocket not in CLOUD_ARCHIVE_POCKETS:
        raise SourceConfigError(
            'Unsupported cloud: source option %s' %
            pocket)
    actual_pocket = CLOUD_ARCHIVE_POCKETS[pocket]
    with open('/etc/apt/sources.list.d/cloud-archive.list', 'w') as apt:
        apt.write(CLOUD_ARCHIVE.format(actual_pocket)) 
开发者ID:openstack,项目名称:charm-swift-proxy,代码行数:23,代码来源:ubuntu.py

示例3: _add_cloud_staging

# 需要导入模块: from charmhelpers import fetch [as 别名]
# 或者: from charmhelpers.fetch import SourceConfigError [as 别名]
def _add_cloud_staging(cloud_archive_release, openstack_release):
    """Add the cloud staging repository which is in
    ppa:ubuntu-cloud-archive/<openstack_release>-staging

    This function checks that the cloud_archive_release matches the current
    codename for the distro that charm is being installed on.

    :param cloud_archive_release: string, codename for the release.
    :param openstack_release: String, codename for the openstack release.
    :raises: SourceConfigError if the cloud_archive_release doesn't match the
        current version of the os.
    """
    _verify_is_ubuntu_rel(cloud_archive_release, openstack_release)
    ppa = 'ppa:ubuntu-cloud-archive/{}-staging'.format(openstack_release)
    cmd = 'add-apt-repository -y {}'.format(ppa)
    _run_with_retries(cmd.split(' ')) 
开发者ID:openstack,项目名称:charm-swift-proxy,代码行数:18,代码来源:ubuntu.py


注:本文中的charmhelpers.fetch.SourceConfigError方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。