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


Python hookenv.status_set方法代码示例

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


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

示例1: install

# 需要导入模块: from charmhelpers.core import hookenv [as 别名]
# 或者: from charmhelpers.core.hookenv import status_set [as 别名]
def install(self):
        """Install packages or snaps related to this charm based on
        contents of self.packages or self.snaps attribute.
        """
        packages = fetch.filter_installed_packages(
            self.all_packages)
        if packages:
            hookenv.status_set('maintenance', 'Installing packages')
            fetch.apt_install(packages, fatal=True)

        if os_utils.snap_install_requested():
            if self.all_snaps:
                hookenv.status_set('maintenance', 'Installing snaps')
                os_utils.install_os_snaps(
                    os_utils.get_snaps_install_info_from_origin(
                        self.all_snaps,
                        self.config['openstack-origin'],
                        mode=self.snap_mode)
                )

        # AJK: we set this as charms can use it to detect installed state
        self.set_state('{}-installed'.format(self.name))
        self.update_api_ports()
        hookenv.status_set('maintenance',
                           'Installation complete - awaiting next status') 
开发者ID:openstack,项目名称:charms.openstack,代码行数:27,代码来源:core.py

示例2: report_ready

# 需要导入模块: from charmhelpers.core import hookenv [as 别名]
# 或者: from charmhelpers.core.hookenv import status_set [as 别名]
def report_ready(hadoop):
        hookenv.status_set('active', 'ready') 
开发者ID:juju-solutions,项目名称:layer-hadoop-client,代码行数:4,代码来源:hadoop_client.py

示例3: report_blocked

# 需要导入模块: from charmhelpers.core import hookenv [as 别名]
# 或者: from charmhelpers.core.hookenv import status_set [as 别名]
def report_blocked():
        hookenv.status_set('blocked', 'waiting for relation to hadoop plugin') 
开发者ID:juju-solutions,项目名称:layer-hadoop-client,代码行数:4,代码来源:hadoop_client.py

示例4: report_waiting_for_hadoop

# 需要导入模块: from charmhelpers.core import hookenv [as 别名]
# 或者: from charmhelpers.core.hookenv import status_set [as 别名]
def report_waiting_for_hadoop(hadoop):
        hookenv.status_set('waiting', 'waiting for plugin to become ready') 
开发者ID:juju-solutions,项目名称:layer-hadoop-client,代码行数:4,代码来源:hadoop_client.py

示例5: report_waiting_for_java

# 需要导入模块: from charmhelpers.core import hookenv [as 别名]
# 或者: from charmhelpers.core.hookenv import status_set [as 别名]
def report_waiting_for_java(hadoop):
        hookenv.status_set('waiting', 'waiting for java to become ready') 
开发者ID:juju-solutions,项目名称:layer-hadoop-client,代码行数:4,代码来源:hadoop_client.py

示例6: setup_prometheus

# 需要导入模块: from charmhelpers.core import hookenv [as 别名]
# 或者: from charmhelpers.core.hookenv import status_set [as 别名]
def setup_prometheus():
    if not is_state('basenode.complete'):
        hookenv.status_set('maintenance', 'Waiting for basenode to run')
        return
    hookenv.status_set('maintenance', 'Configuring software')
    set_datadir_perms()
    install_packages()
    set_state('prometheus.do-check-reconfig') 
开发者ID:tasdomas,项目名称:juju-charm-prometheus,代码行数:10,代码来源:prometheus.py

示例7: restart_prometheus

# 需要导入模块: from charmhelpers.core import hookenv [as 别名]
# 或者: from charmhelpers.core.hookenv import status_set [as 别名]
def restart_prometheus():
    if not host.service_running(SVCNAME):
        hookenv.log('Starting {}...'.format(SVCNAME))
        host.service_start(SVCNAME)
    else:
        hookenv.log('Restarting {}, config file changed...'.format(SVCNAME))
        host.service_restart(SVCNAME)
    hookenv.status_set('active', 'Ready')
    set_state('prometheus.started')
    remove_state('prometheus.do-restart')


# Relations 
开发者ID:tasdomas,项目名称:juju-charm-prometheus,代码行数:15,代码来源:prometheus.py

示例8: assess_status

# 需要导入模块: from charmhelpers.core import hookenv [as 别名]
# 或者: from charmhelpers.core.hookenv import status_set [as 别名]
def assess_status(self):
        """Determine the current application status for the charm"""
        hookenv.application_version_set(self.application_version)
        if not self.configuration_complete():
            hookenv.status_set('blocked',
                               'LDAP configuration incomplete')
        else:
            hookenv.status_set('active',
                               'Unit is ready') 
开发者ID:openstack,项目名称:charm-keystone-ldap,代码行数:11,代码来源:keystone_ldap.py

示例9: bootstrap

# 需要导入模块: from charmhelpers.core import hookenv [as 别名]
# 或者: from charmhelpers.core.hookenv import status_set [as 别名]
def bootstrap(self):
        """Generate Jenkins' initial config."""
        hookenv.log("Bootstrapping initial Jenkins configuration")

        config = hookenv.config()

        if not -1 <= config["jnlp-port"] <= 65535:
            err = "{} is not a valid setting for jnlp-port".format(
                config["jnlp-port"]
            )
            hookenv.log(err)
            hookenv.status_set("blocked", err)
            return False

        context = {
            "master_executors": config["master-executors"],
            "jnlp_port": config["jnlp-port"]}

        templating.render(
            "jenkins-config.xml", paths.CONFIG_FILE, context,
            owner="jenkins", group="nogroup")

        hookenv.open_port(PORT)

        # if we're using a set JNLP port, open it
        if config["jnlp-port"] > 0:
            hookenv.open_port(config["jnlp-port"])

        return True 
开发者ID:jenkinsci,项目名称:jenkins-charm,代码行数:31,代码来源:configuration.py

示例10: configure_openvswitch

# 需要导入模块: from charmhelpers.core import hookenv [as 别名]
# 或者: from charmhelpers.core.hookenv import status_set [as 别名]
def configure_openvswitch(self, odl_ovsdb):
        hookenv.log("Configuring OpenvSwitch with ODL OVSDB controller: %s" %
                    odl_ovsdb.connection_string())
        local_ip = ch_ip.get_address_in_network(
            self.config.get('os-data-network'),
            hookenv.unit_private_ip())
        ovs.set_config('local_ip', local_ip)
        ovs.set_config('controller-ips', odl_ovsdb.private_address(),
                       table='external_ids')
        ovs.set_config('host-id', socket.gethostname(),
                       table='external_ids')
        ovs.set_manager(odl_ovsdb.connection_string())
        hookenv.status_set('active', 'Unit is ready') 
开发者ID:openstack,项目名称:charm-openvswitch-odl,代码行数:15,代码来源:openvswitch_odl.py

示例11: unconfigure_openvswitch

# 需要导入模块: from charmhelpers.core import hookenv [as 别名]
# 或者: from charmhelpers.core.hookenv import status_set [as 别名]
def unconfigure_openvswitch(self, odl_ovsdb):
        hookenv.log("Unconfiguring OpenvSwitch")
        subprocess.check_call(['ovs-vsctl', 'del-manager'])
        bridges = subprocess.check_output(['ovs-vsctl',
                                           'list-br']).split()
        for bridge in bridges:
            subprocess.check_call(['ovs-vsctl',
                                   'del-controller', bridge])
        hookenv.status_set(
            'waiting',
            'Open vSwitch not configured with an ODL OVSDB controller') 
开发者ID:openstack,项目名称:charm-openvswitch-odl,代码行数:13,代码来源:openvswitch_odl.py

示例12: _add_dnsha_config

# 需要导入模块: from charmhelpers.core import hookenv [as 别名]
# 或者: from charmhelpers.core.hookenv import status_set [as 别名]
def _add_dnsha_config(self, hacluster):
        """Add a DNSHA object to self.resources

        @param hacluster instance of interface class HAClusterRequires
        """
        if not self.config.get(DNSHA_KEY):
            return
        settings = ['os-admin-hostname', 'os-internal-hostname',
                    'os-public-hostname', 'os-access-hostname']

        for setting in settings:
            hostname = self.config.get(setting)
            if hostname is None:
                hookenv.log(
                    'DNS HA: Hostname setting {} is None. Ignoring.'.format(
                        setting),
                    hookenv.DEBUG)
                continue
            m = re.search('os-(.+?)-hostname', setting)
            if m:
                endpoint_type = m.group(1)
                # resolve_address's ADDRESS_MAP uses 'int' not 'internal'
                if endpoint_type == 'internal':
                    endpoint_type = 'int'
            else:
                msg = (
                    'Unexpected DNS hostname setting: {}. Cannot determine '
                    'endpoint_type name'.format(setting))
                hookenv.status_set('blocked', msg)
                raise os_ha.DNSHAException(msg)
            ip = os_ip.resolve_address(
                endpoint_type=endpoint_type,
                override=False)
            hacluster.add_dnsha(self.name, ip, hostname, endpoint_type) 
开发者ID:openstack,项目名称:charms.openstack,代码行数:36,代码来源:classes.py

示例13: upgrade_if_available

# 需要导入模块: from charmhelpers.core import hookenv [as 别名]
# 或者: from charmhelpers.core.hookenv import status_set [as 别名]
def upgrade_if_available(self, interfaces_list):
        """Upgrade OpenStack if an upgrade is available

        :param interfaces_list: List of instances of interface classes
        :returns: None
        """
        if self.openstack_upgrade_available(self.release_pkg):
            hookenv.status_set('maintenance', 'Running openstack upgrade')
            self.do_openstack_pkg_upgrade()
            self.do_openstack_upgrade_config_render(interfaces_list)
            self.do_openstack_upgrade_db_migration() 
开发者ID:openstack,项目名称:charms.openstack,代码行数:13,代码来源:core.py

示例14: _assess_status

# 需要导入模块: from charmhelpers.core import hookenv [as 别名]
# 或者: from charmhelpers.core.hookenv import status_set [as 别名]
def _assess_status(self):
        """Assess the status of the unit and set the status and a useful
        message as appropriate.

        The 3 checks are:

         1. Check if the unit has been paused (using
            os_utils.is_unit_paused_set().
         2. Do a custom_assess_status_check() check.
         3. Check if the interfaces are all present (using the states that are
            set by each interface as it comes 'live'.
         4. Check that services that should be running are running.

        Each sub-function determins what checks are taking place.

        If custom assess_status() functionality is required then the derived
        class should override any of the 4 check functions to alter the
        behaviour as required.

        Note that if ports are NOT to be checked, then the derived class should
        override :meth:`ports_to_check()` and return an empty list.

        SIDE EFFECT: this function calls status_set(state, message) to set the
        workload status in juju.
        """
        # set the application version when we set the status (always)
        # NOTE(tinwood) this is not, strictly speaking, good code organisation,
        # as the 'application_version' property is in the classes.py file.
        # However, as this is ALWAYS a mixin on that class, we can get away
        # with this.
        hookenv.application_version_set(self.application_version)
        for f in [self.check_if_paused,
                  self.custom_assess_status_check,
                  self.check_interfaces,
                  self.check_services_running]:
            state, message = f()
            if state is not None:
                hookenv.status_set(state, message)
                return
        # No state was particularly set, so assume the unit is active
        hookenv.status_set('active', 'Unit is ready') 
开发者ID:openstack,项目名称:charms.openstack,代码行数:43,代码来源:core.py

示例15: install

# 需要导入模块: from charmhelpers.core import hookenv [as 别名]
# 或者: from charmhelpers.core.hookenv import status_set [as 别名]
def install(self):
        """Perform the normal charm install, and then kick off setting up the
        barbican_token in the softhsm2 token store.
        """
        super(BarbicanSoftHSMCharm, self).install()
        # now add the barbican user to the softhsm group so that the
        # barbican-worker can access the softhsm2.conf file.
        ch_core_host.add_user_to_group('barbican', 'softhsm')
        self.setup_token_store()
        hookenv.status_set(
            'waiting', 'Charm installed and token store configured') 
开发者ID:openstack,项目名称:charm-barbican-softhsm,代码行数:13,代码来源:softhsm.py


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