Esempio n. 1
0
    def setUpClass(cls):
        auth = v3.Password(user_domain_name='Default',
                           username=cfg.common.user,
                           password=cfg.common.password,
                           project_domain_name='Default',
                           project_name=cfg.common.tenant,
                           auth_url=cfg.common.keystone_url)
        session = ks_session.Session(auth=auth)
        cls.keystone_client = ks_client.Client(session=session)
        cls.auth_ref = auth.get_auth_ref(session)
        cls.service_catalog = cls.auth_ref.service_catalog
        if utils.glare_enabled():
            glare_endpoint = "http://127.0.0.1:9494"
            artifacts_client = glare_client.Client(
                endpoint=glare_endpoint,
                token=cls.auth_ref.auth_token,
                insecure=False,
                key_file=None,
                ca_file=None,
                cert_file=None,
                type_name="murano",
                type_version=1)
        else:
            artifacts_client = None
        cls.murano_client = mclient.Client(
            artifacts_client=artifacts_client,
            endpoint_override=cfg.common.murano_url,
            session=session)

        cls.url_prefix = urlparse.urlparse(cfg.common.horizon_url).path or ''
        if cls.url_prefix.endswith('/'):
            cls.url_prefix = cls.url_prefix[:-1]
Esempio n. 2
0
    def _get_murano_client(token_id, tenant_id):
        murano_settings = config.CONF.murano

        endpoint_url = murano_settings.url
        if endpoint_url is None:
            keystone_settings = config.CONF.keystone
            keystone_client = keystoneclient.Client(
                endpoint=keystone_settings.auth_url,
                cacert=keystone_settings.ca_file or None,
                cert=keystone_settings.cert_file or None,
                key=keystone_settings.key_file or None,
                insecure=keystone_settings.insecure
            )

            if not keystone_client.authenticate(
                    auth_url=keystone_settings.auth_url,
                    tenant_id=tenant_id,
                    token=token_id):
                raise muranoclient_exc.HTTPUnauthorized()

            endpoint_url = keystone_client.service_catalog.url_for(
                service_type='application_catalog',
                endpoint_type=murano_settings.endpoint_type
            )

        return muranoclient.Client(
            endpoint=endpoint_url,
            key_file=murano_settings.key_file or None,
            cacert=murano_settings.cacert or None,
            cert_file=murano_settings.cert_file or None,
            insecure=murano_settings.insecure,
            token=token_id
        )
Esempio n. 3
0
def import_application_package(repo_url,package_name):
    
    try:
        auth_token = get_auth_token()
        #initializing MuranoClient
        mc = v1_client.Client(endpoint=endpoint, token= auth_token,timeout = 600)
        #mc.environments.list()
        #mc.environments.get(environment_id='b93d63bde2b3423cb1f8d5e54aeb99a3')
        
        args = InitArgs()    
        ###filename is URL###
        #args.filename = {"http://storage.apps.openstack.org/apps/io.murano.apps.apache.ApacheHttpServer.zip"}
        args.murano_repo_url = ''
        
        ###filename is name and repo_url###
        #args.filename = {"io.murano.apps.apache.ApacheHttpServer"}
        #args.murano_repo_url = 'http://storage.apps.openstack.org/'    
        args.filename = {package_name}
        args.murano_repo_url = repo_url
        
        ###filename is localpath###
        #args.filename = {"C:/Users/admin/Downloads/io.murano.apps.apache.ApacheHttpServer.zip"}
        #args.murano_repo_url = ''    
        args.categories = None
        args.is_public = False
        args.package_version = ''    
        args.exists_action = 'u' #(s)kip, (u)pdate, (a)bort    
        
        
        response = v1_shell.do_package_import(mc, args)
        
        '''
            Check whether the package imported properly
        '''        
        
        if os.path.exists(package_name):
            package_name = os.path.basename(package_name)
            package_name = os.path.splitext(package_name)[0]
            
        package_generator = mc.packages.filter(fqn = package_name)
        #pp = mc.packages.list()
        package_obj =  package_generator.next()        
        package_info = package_obj.__dict__
        print package_info
        #print package_info['id']
        #print package_info['class_definitions']['id']
        
        if package_info['id']: 
            return {'status': 'success', 'msg': 'Package imported successfully','response':package_info}       
        else:
            return {'status': 'failed', 'msg': 'Error occurred,while importing the package'}
        
    except Exception as e:
        LOG.error("Error  occurred,"
                          " while importing the package".format(e))
        return {'status': 'failed', 'msg': 'Error Occurred,while importing the package'}
        #raise   
    
    return {'status': 'success', 'msg': 'Package imported successfully'}
Esempio n. 4
0
def murano_client():
    ks_client = keystone_client()

    murano_url = ks_client.service_catalog.url_for(
        service_type='application_catalog')

    return muranoclient.Client(murano_url,
                               auth_url=AUTH_URL,
                               tenant=ks_client.project_id,
                               token=ks_client.auth_token)
Esempio n. 5
0
def test_pkg_ui():
    
    
    auth_token = get_auth_token()
        #initializing MuranoClient
    mc = v1_client.Client(endpoint=endpoint, token= auth_token,timeout = 600)  
    
    
    
    #app_id = '888102e1bae34046b2d531012441fa17'
    app_id = '09a49f9b984c4b91a169dcb6f67450b4'
    return mc.packages.get_ui(app_id,make_loader_cls())
Esempio n. 6
0
        def factory(keystone_client, auth_token):
            murano_settings = config.CONF.murano

            murano_url = \
                murano_settings.url or keystone_client.service_catalog.url_for(
                    service_type='application_catalog',
                    endpoint_type=murano_settings.endpoint_type)

            return muranoclient.Client(
                endpoint=murano_url,
                key_file=murano_settings.key_file or None,
                cacert=murano_settings.cacert or None,
                cert_file=murano_settings.cert_file or None,
                insecure=murano_settings.insecure,
                auth_url=keystone_client.auth_url,
                token=auth_token)
Esempio n. 7
0
 def client(self):
     last_glare_client = self._glare_client
     if CONF.engine.packages_service in ['glance', 'glare']:
         if CONF.engine.packages_service == 'glance':
             versionutils.report_deprecated_feature(
                 LOG, "'glance' packages_service option has been renamed "
                 "to 'glare', please update your configuration")
         artifacts_client = self._get_glare_client()
     else:
         artifacts_client = None
     if artifacts_client != last_glare_client:
         self._murano_client = None
     if not self._murano_client:
         parameters = auth_utils.get_session_client_parameters(
             service_type='application-catalog',
             execution_session=self._execution_session,
             conf='murano')
         self._murano_client = muranoclient.Client(
             artifacts_client=artifacts_client, **parameters)
     return self._murano_client
Esempio n. 8
0
        def factory(keystone_client, auth_token):
            murano_settings = CONF.murano

            murano_url = \
                murano_settings.url or keystone_client.service_catalog.url_for(
                    service_type='application_catalog',
                    endpoint_type=murano_settings.endpoint_type)

            if CONF.packages_opts.packages_service == 'glance':
                glance_settings = CONF.glance
                glance_url = (glance_settings.url
                              or keystone_client.service_catalog.url_for(
                                  service_type='image',
                                  endpoint_type=glance_settings.endpoint_type))

                arts = art_client.Client(endpoint=glance_url,
                                         token=auth_token,
                                         insecure=glance_settings.insecure,
                                         key_file=glance_settings.key_file
                                         or None,
                                         ca_file=glance_settings.ca_file
                                         or None,
                                         cert_file=glance_settings.cert_file
                                         or None,
                                         type_name='murano',
                                         type_version=1)
            else:
                arts = None

            return muranoclient.Client(endpoint=murano_url,
                                       key_file=murano_settings.key_file
                                       or None,
                                       ca_file=murano_settings.cacert or None,
                                       cert_file=murano_settings.cert_file
                                       or None,
                                       insecure=murano_settings.insecure,
                                       auth_url=keystone_client.auth_url,
                                       token=auth_token,
                                       artifacts_client=arts)
Esempio n. 9
0
def get_murano_client(**kwargs):
    return muranoclient.Client('')
Esempio n. 10
0
        return None

    return envs[0]


auth_url = sys.argv[1]
username = sys.argv[2]
tenant = sys.argv[3]
password = sys.argv[4]

keystone = keystoneclient.Client(username=username,
                                 tenant_name=tenant,
                                 password=password,
                                 auth_url=auth_url)

murano_url = keystone.service_catalog.url_for(
    service_type='application_catalog')

murano = muranoclient.Client(murano_url,
                             auth_url=auth_url,
                             tenant=keystone.project_id,
                             token=keystone.auth_token)

env = get_env_by_prefix(murano, "CF-LBaaS-")

if not env:
    print("Env already deleted.")
    exit(0)

murano.environments.delete(env.id)