Beispiel #1
0
def main():
    try:
        hooks.execute(sys.argv)
    except UnregisteredHookError as e:
        log('Unknown hook {} - skipping.'.format(e))
    set_os_workload_status(CONFIGS, REQUIRED_INTERFACES)
    os_application_version_set(VERSION_PACKAGE)
def assess_status():
    """Assess status of current unit."""
    os_application_version_set(VERSION_PACKAGE)
    set_os_workload_status(CONFIGS, REQUIRED_INTERFACES)

    try:
        bluestore_compression = CephBlueStoreCompressionContext()
        bluestore_compression.validate()
    except ValueError as e:
        status_set('blocked', 'Invalid configuration: {}'.format(str(e)))
Beispiel #3
0
def assess_status(configs):
    """Assess status of current unit
    Decides what the state of the unit should be based on the current
    configuration.
    SIDE EFFECT: calls set_os_workload_status(...) which sets the workload
    status of the unit.
    Also calls status_set(...) directly if paused state isn't complete.
    @param configs: a templating.OSConfigRenderer() object
    @returns None - this function is executed for its side-effect
    """
    assess_status_func(configs)()
    os_application_version_set(VERSION_PACKAGE)
Beispiel #4
0
def assess_status(configs):
    """Assess status of current unit
    Decides what the state of the unit should be based on the current
    configuration.
    SIDE EFFECT: calls set_os_workload_status(...) which sets the workload
    status of the unit.
    Also calls status_set(...) directly if paused state isn't complete.
    @param configs: a templating.OSConfigRenderer() object
    @returns None - this function is executed for its side-effect
    """
    assess_status_func(configs)()
    os_application_version_set(VERSION_PACKAGE)
def main():
    try:
        hooks.execute(sys.argv)
    except UnregisteredHookError as e:
        log('Unknown hook {} - skipping.'.format(e))
    required_interfaces = copy.deepcopy(REQUIRED_INTERFACES)
    if config('encrypt'):
        required_interfaces['vault'] = ['secrets-storage']
    set_os_workload_status(CONFIGS,
                           required_interfaces,
                           charm_func=assess_status)
    os_application_version_set(VERSION_PACKAGE)
Beispiel #6
0
def assess_status(configs):
    """Assess status of current unit
    Decides what the state of the unit should be based on the current
    configuration.
    SIDE EFFECT: calls set_os_workload_status(...) which sets the workload
    status of the unit.
    Also calls status_set(...) directly if paused state isn't complete.
    @param configs: a templating.OSConfigRenderer() object
    @returns None - this function is executed for its side-effect
    """
    check_restart_timestamps()
    exclude_services = []
    if is_unit_paused_set():
        exclude_services = ['openvswitch-switch']
    assess_status_func(configs, exclude_services)()
    os_application_version_set(VERSION_PACKAGE)
Beispiel #7
0
        #              this will need to be conditional on whether the
        #              configured driver is stateless or not.
        relation_set(relation_id=rel_id, stateless=True)


@hooks.hook('backup-backend-relation-changed')
def backup_backend_changed():
    # NOTE(jamespage) recall backup_backend as this only ever
    # changes post initial creation if the cinder charm is upgraded to a new
    # version of openstack.
    backup_backend_joined()


@hooks.hook('upgrade-charm')
@restart_on_change(restart_map())
def upgrade_charm():
    if 'ceph' in CONFIGS.complete_contexts():
        CONFIGS.write_all()
        set_ceph_env_variables(service=service_name())
        for rid in relation_ids('backup-backend'):
            backup_backend_joined(rid)


if __name__ == '__main__':
    try:
        hooks.execute(sys.argv)
    except UnregisteredHookError as e:
        log('Unknown hook {} - skipping.'.format(e))
    set_os_workload_status(CONFIGS, REQUIRED_INTERFACES)
    os_application_version_set(VERSION_PACKAGE)
    )


@hooks.hook('pre-series-upgrade')
def pre_series_upgrade():
    log("Running prepare series upgrade hook", "INFO")
    # In order to indicate the step of the series upgrade process for
    # administrators and automated scripts, the charm sets the paused and
    # upgrading states.
    set_unit_paused()
    set_unit_upgrading()


@hooks.hook('post-series-upgrade')
def post_series_upgrade():
    log("Running complete series upgrade hook", "INFO")
    # In order to indicate the step of the series upgrade process for
    # administrators and automated scripts, the charm clears the paused and
    # upgrading states.
    clear_unit_paused()
    clear_unit_upgrading()


if __name__ == '__main__':
    try:
        hooks.execute(sys.argv)
    except UnregisteredHookError as e:
        log('Unknown hook {} - skipping.'.format(e))
    set_os_workload_status(CONFIGS, REQUIRED_INTERFACES)
    os_application_version_set(VERSION_PACKAGE)
    relation_ids,
    log,
    status_set
)

from charmhelpers.contrib.openstack.utils import (
    set_os_workload_status,
    os_application_version_set,
)

from contexts import SolidFireSubordinateContext

hooks = Hooks()

@hooks.hook('storage-backend-relation-joined',
            'storage-backend-relation-changed')
def storage_backend(rel_id=None):
    relation_set(relation_id=None,
             backend_name=local_unit().replace('/','-'),
             subordinate_configuration = json.dumps(
                  SolidFireSubordinateContext()()),
             stateless=True, )

if __name__ == '__main__':
    try:
        hooks.execute(sys.argv)
    except UnregisteredHookError as e:
        log("Unknown Hook {} - skipping.".format(e))
    status_set('active',"Unit is ready")
    os_application_version_set('cinder-common')