Пример #1
0
    def _bootstrap(self,
                   blueprint_path,
                   inputs_path=None,
                   install_plugins=None,
                   keep_up_on_failure=False,
                   validate_only=False,
                   task_retries=5,
                   task_retry_interval=90,
                   subgraph_retries=2,
                   verbose=False,
                   create_rest_client_func=None):

        if install_plugins is None:
            install_plugins = test_environment.install_plugins

        cfy = get_cfy()
        cfy.init(reset_context=True)

        with YamlPatcher(CLOUDIFY_CONFIG_PATH) as patch:
            prop_path = ('local_provider_context.'
                         'cloudify.workflows.subgraph_retries')
            patch.set_value(prop_path, subgraph_retries)

        if not validate_only:
            # TODO: add manager_blueprint_path and inputs path arguments to
            # openstack_plugin
            try:
                self.before_bootstrap(
                    manager_blueprint_path=blueprint_path,
                    inputs_path=inputs_path)
            except TypeError:
                self.before_bootstrap()

        cfy.bootstrap(
            blueprint_path,
            inputs=inputs_path,
            install_plugins=install_plugins,
            keep_up_on_failure=keep_up_on_failure,
            validate_only=validate_only,
            task_retries=task_retries,
            task_retry_interval=task_retry_interval,
            verbose=verbose,
        )

        if not validate_only:
            self._upload_plugins()
            self._running_env_setup(get_profile_context().manager_ip,
                                    create_rest_client_func)
            # A hacky workaround where a test bootstraps a manager
            # using simple manager blueprint and provider context does
            # not contain a 'resources' key as expected by openstack's
            # handler after_bootstrap method.
            # should be probably handled better.
            if 'simple' not in path(blueprint_path).basename():
                self.after_bootstrap(get_profile_context().provider_context)
Пример #2
0
def get_manager_key():
    if NEW_CLI:
        profile = get_profile_context()
        return profile.manager_key
    else:
        cli_settings = load_cloudify_working_dir_settings()
        return cli_settings.get_management_key()
Пример #3
0
def _get_credentials_and_use_manager(credentials, container_ip):
    cfy.profiles.use(container_ip, skip_credentials_validation=True)
    # Using sh.cfy directly to avoid extra output
    sh.cfy.profiles.set(manager_username=credentials['manager_username'],
                        manager_password=credentials['manager_password'],
                        manager_tenant=credentials['manager_tenant'],
                        ssh_user='******',
                        ssh_key=configuration.ssh_key_path)
    cli_env.profile = cli_env.get_profile_context(container_ip)
Пример #4
0
def update_profile_context():
    cli_env.profile = cli_env.get_profile_context(get_manager_ip())
Пример #5
0
 def get_provider_context(self, profile_name=None):
     return get_profile_context(profile_name).provider_context
Пример #6
0
 def get_manager_ip(self, profile_name=None):
     return get_profile_context(profile_name).manager_ip
Пример #7
0
def update_profile_context():
    cli_env.profile = cli_env.get_profile_context(get_manager_ip())