コード例 #1
0
ファイル: keystone.py プロジェクト: jeffbudz/Openstack-Anvil
 def _config_adjust_root(self, contents, fn):
     params = khelper.get_shared_params(**utils.merge_dicts(self.options, khelper.get_shared_passwords(self)))
     with io.BytesIO(contents) as stream:
         config = cfg.create_parser(cfg.RewritableConfigParser, self)
         config.readfp(stream)
         config.set("DEFAULT", "admin_token", params["service_token"])
         config.set("DEFAULT", "admin_port", params["endpoints"]["admin"]["port"])
         config.set("DEFAULT", "public_port", params["endpoints"]["public"]["port"])
         config.set("DEFAULT", "verbose", True)
         config.set("DEFAULT", "debug", True)
         config.set("catalog", "driver", "keystone.catalog.backends.sql.Catalog")
         config.remove_option("DEFAULT", "log_config")
         config.set(
             "sql",
             "connection",
             dbhelper.fetch_dbdsn(
                 dbname=DB_NAME,
                 utf8=True,
                 dbtype=self.get_option("db", "type"),
                 **utils.merge_dicts(self.get_option("db"), dbhelper.get_shared_passwords(self))
             ),
         )
         config.set("ec2", "driver", "keystone.contrib.ec2.backends.sql.Ec2")
         contents = config.stringify(fn)
     return contents
コード例 #2
0
ファイル: keystone.py プロジェクト: dkulishenko/anvil
 def post_start(self):
     if not sh.isfile(self.init_fn) and self.get_bool_option('do-init'):
         self.wait_active()
         LOG.info("Running commands to initialize keystone.")
         (fn, contents) = utils.load_template(self.name, INIT_WHAT_FN)
         LOG.debug("Initializing with contents of %s", fn)
         params = {}
         params['keystone'] = khelper.get_shared_params(**utils.merge_dicts(self.options, khelper.get_shared_passwords(self)))
         params['glance'] = ghelper.get_shared_params(ip=self.get_option('ip'), **self.get_option('glance'))
         params['nova'] = nhelper.get_shared_params(ip=self.get_option('ip'), **self.get_option('nova'))
         params['quantum'] = qhelper.get_shared_params(ip=self.get_option('ip'), **self.get_option('quantum'))
         params['cinder'] = chelper.get_shared_params(ip=self.get_option('ip'), **self.get_option('cinder'))
         wait_urls = [
             params['keystone']['endpoints']['admin']['uri'],
             params['keystone']['endpoints']['public']['uri'],
         ]
         for url in wait_urls:
             utils.wait_for_url(url)
         init_what = utils.load_yaml_text(contents)
         init_what = utils.expand_template_deep(self._filter_init(init_what), params)
         khelper.Initializer(params['keystone']['service_token'],
                             params['keystone']['endpoints']['admin']['uri']).initialize(**init_what)
         # Writing this makes sure that we don't init again
         sh.write_file(self.init_fn, utils.prettify_yaml(init_what))
         LOG.info("If you wish to re-run initialization, delete %s", colorizer.quote(self.init_fn))
コード例 #3
0
 def _config_adjust_root(self, contents, fn):
     params = khelper.get_shared_params(**utils.merge_dicts(self.options,
                                                            khelper.get_shared_passwords(self)))
     with io.BytesIO(contents) as stream:
         config = cfg.create_parser(cfg.RewritableConfigParser, self)
         config.readfp(stream)
         config.set('DEFAULT', 'admin_token', params['service_token'])
         config.set('DEFAULT', 'admin_port', params['endpoints']['admin']['port'])
         config.set('DEFAULT', 'public_port', params['endpoints']['public']['port'])
         config.set('DEFAULT', 'verbose', True)
         config.set('DEFAULT', 'debug', True)
         if self.get_bool_option('enable-pki'):
             config.set('signing', 'token_format', 'PKI')
             for (k, v) in PKI_FILES.items():
                 path = sh.joinpths(self.link_dir, v)
                 config.set('signing', k, path)
         else:
             config.set('signing', 'token_format', 'UUID')
         config.set('catalog', 'driver', 'keystone.catalog.backends.sql.Catalog')
         config.remove_option('DEFAULT', 'log_config')
         config.set('sql', 'connection', dbhelper.fetch_dbdsn(dbname=DB_NAME,
                                                              utf8=True,
                                                              dbtype=self.get_option('db', 'type'),
                                                              **utils.merge_dicts(self.get_option('db'),
                                                                                  dbhelper.get_shared_passwords(self))))
         config.set('ec2', 'driver', "keystone.contrib.ec2.backends.sql.Ec2")
         contents = config.stringify(fn)
     return contents
コード例 #4
0
ファイル: nova.py プロジェクト: nsavin/Openstack-Anvil
    def _config_adjust_paste(self, contents, fn):
        params = khelper.get_shared_params(
            ip=self.get_option("ip"),
            service_user="******",
            **utils.merge_dicts(self.get_option("keystone"), khelper.get_shared_passwords(self))
        )

        with io.BytesIO(contents) as stream:
            config = cfg.create_parser(cfg.RewritableConfigParser, self)
            config.readfp(stream)

            config.set("filter:authtoken", "auth_host", params["endpoints"]["admin"]["host"])
            config.set("filter:authtoken", "auth_port", params["endpoints"]["admin"]["port"])
            config.set("filter:authtoken", "auth_protocol", params["endpoints"]["admin"]["protocol"])

            config.set("filter:authtoken", "service_host", params["endpoints"]["internal"]["host"])
            config.set("filter:authtoken", "service_port", params["endpoints"]["internal"]["port"])
            config.set("filter:authtoken", "service_protocol", params["endpoints"]["internal"]["protocol"])

            config.set("filter:authtoken", "admin_tenant_name", params["service_tenant"])
            config.set("filter:authtoken", "admin_user", params["service_user"])
            config.set("filter:authtoken", "admin_password", params["service_password"])

            contents = config.stringify(fn)
        return contents
コード例 #5
0
    def _config_adjust_paste(self, contents, fn):
        params = khelper.get_shared_params(
            ip=self.get_option('ip'),
            service_user='******',
            **utils.merge_dicts(self.get_option('keystone'),
                                khelper.get_shared_passwords(self)))

        with io.BytesIO(contents) as stream:
            config = cfg.create_parser(cfg.RewritableConfigParser, self)
            config.readfp(stream)

            config.set('filter:authtoken', 'auth_host',
                       params['endpoints']['admin']['host'])
            config.set('filter:authtoken', 'auth_port',
                       params['endpoints']['admin']['port'])
            config.set('filter:authtoken', 'auth_protocol',
                       params['endpoints']['admin']['protocol'])

            config.set('filter:authtoken', 'service_host',
                       params['endpoints']['internal']['host'])
            config.set('filter:authtoken', 'service_port',
                       params['endpoints']['internal']['port'])
            config.set('filter:authtoken', 'service_protocol',
                       params['endpoints']['internal']['protocol'])

            config.set('filter:authtoken', 'admin_tenant_name',
                       params['service_tenant'])
            config.set('filter:authtoken', 'admin_user',
                       params['service_user'])
            config.set('filter:authtoken', 'admin_password',
                       params['service_password'])

            contents = config.stringify(fn)
        return contents
コード例 #6
0
ファイル: keystone.py プロジェクト: jeffbudz/Openstack-Anvil
 def post_start(self):
     if not sh.isfile(self.init_fn) and self.get_bool_option("do-init"):
         self.wait_active()
         LOG.info("Running commands to initialize keystone.")
         (fn, contents) = utils.load_template(self.name, INIT_WHAT_FN)
         LOG.debug("Initializing with contents of %s", fn)
         params = {}
         params["keystone"] = khelper.get_shared_params(
             **utils.merge_dicts(self.options, khelper.get_shared_passwords(self))
         )
         params["glance"] = ghelper.get_shared_params(ip=self.get_option("ip"), **self.get_option("glance"))
         params["nova"] = nhelper.get_shared_params(ip=self.get_option("ip"), **self.get_option("nova"))
         wait_urls = [
             params["keystone"]["endpoints"]["admin"]["uri"],
             params["keystone"]["endpoints"]["public"]["uri"],
         ]
         for url in wait_urls:
             utils.wait_for_url(url)
         init_what = utils.load_yaml_text(contents)
         init_what = utils.expand_template_deep(self._filter_init(init_what), params)
         khelper.Initializer(
             params["keystone"]["service_token"], params["keystone"]["endpoints"]["admin"]["uri"]
         ).initialize(**init_what)
         # Writing this makes sure that we don't init again
         sh.write_file(self.init_fn, utils.prettify_yaml(init_what))
         LOG.info("If you wish to re-run initialization, delete %s", colorizer.quote(self.init_fn))
コード例 #7
0
 def _config_adjust_root(self, contents, fn):
     params = khelper.get_shared_params(**utils.merge_dicts(
         self.options, khelper.get_shared_passwords(self)))
     with io.BytesIO(contents) as stream:
         config = cfg.create_parser(cfg.RewritableConfigParser, self)
         config.readfp(stream)
         config.set('DEFAULT', 'admin_token', params['service_token'])
         config.set('DEFAULT', 'admin_port',
                    params['endpoints']['admin']['port'])
         config.set('DEFAULT', 'public_port',
                    params['endpoints']['public']['port'])
         config.set('DEFAULT', 'verbose', True)
         config.set('DEFAULT', 'debug', True)
         if self.get_bool_option('enable-pki'):
             config.set('signing', 'token_format', 'PKI')
             for (k, v) in PKI_FILES.items():
                 path = sh.joinpths(self.link_dir, v)
                 config.set('signing', k, path)
         else:
             config.set('signing', 'token_format', 'UUID')
         config.set('catalog', 'driver',
                    'keystone.catalog.backends.sql.Catalog')
         config.remove_option('DEFAULT', 'log_config')
         config.set(
             'sql', 'connection',
             dbhelper.fetch_dbdsn(dbname=DB_NAME,
                                  utf8=True,
                                  dbtype=self.get_option('db', 'type'),
                                  **utils.merge_dicts(
                                      self.get_option('db'),
                                      dbhelper.get_shared_passwords(self))))
         config.set('ec2', 'driver',
                    "keystone.contrib.ec2.backends.sql.Ec2")
         contents = config.stringify(fn)
     return contents
コード例 #8
0
 def post_start(self):
     if not sh.isfile(self.init_fn) and self.get_bool_option('do-init'):
         self.wait_active()
         LOG.info("Running commands to initialize keystone.")
         (fn, contents) = utils.load_template(self.name, INIT_WHAT_FN)
         LOG.debug("Initializing with contents of %s", fn)
         params = {}
         params['keystone'] = khelper.get_shared_params(**utils.merge_dicts(self.options, khelper.get_shared_passwords(self)))
         params['glance'] = ghelper.get_shared_params(ip=self.get_option('ip'), **self.get_option('glance'))
         params['nova'] = nhelper.get_shared_params(ip=self.get_option('ip'), **self.get_option('nova'))
         params['neutron'] = net_helper.get_shared_params(ip=self.get_option('ip'), **self.get_option('neutron'))
         params['cinder'] = chelper.get_shared_params(ip=self.get_option('ip'), **self.get_option('cinder'))
         wait_urls = [
             params['keystone']['endpoints']['admin']['uri'],
             params['keystone']['endpoints']['public']['uri'],
         ]
         for url in wait_urls:
             utils.wait_for_url(url)
         init_what = utils.load_yaml_text(contents)
         init_what = utils.expand_template_deep(init_what, params)
         try:
             init_how = khelper.Initializer(params['keystone']['service_token'],
                                            params['keystone']['endpoints']['admin']['uri'])
             init_how.initialize(**init_what)
         except RuntimeError:
             LOG.exception("Failed to initialize keystone, is the keystone client library available?")
         else:
             # Writing this makes sure that we don't init again
             sh.write_file(self.init_fn, utils.prettify_yaml(init_what))
             LOG.info("If you wish to re-run initialization, delete %s", colorizer.quote(self.init_fn))
コード例 #9
0
ファイル: keystone.py プロジェクト: samitny/Openstack-Anvil
 def env_exports(self):
     params = khelper.get_shared_params(**utils.merge_dicts(self.options,
                                                            khelper.get_shared_passwords(self)))
     to_set = {}
     to_set['OS_PASSWORD'] = params['admin_password']
     to_set['OS_TENANT_NAME'] = params['demo_tenant']
     to_set['OS_USERNAME'] = params['demo_user']
     to_set['OS_AUTH_URL'] = params['endpoints']['public']['uri']
     to_set['SERVICE_ENDPOINT'] = params['endpoints']['admin']['uri']
     return to_set
コード例 #10
0
ファイル: glance.py プロジェクト: yiyinianhua/Openstack-Anvil
 def post_start(self):
     comp.PythonRuntime.post_start(self)
     if self.get_bool_option('load-images'):
         # Install any images that need activating...
         self.wait_active()
         params = {}
         params['glance'] = ghelper.get_shared_params(**self.options)
         params['keystone'] = khelper.get_shared_params(ip=self.get_option('ip'),
                                                        service_user='******',
                                                        **utils.merge_dicts(self.get_option('keystone'),
                                                                            khelper.get_shared_passwords(self)))
         ghelper.UploadService(params).install(self._get_image_urls())
コード例 #11
0
ファイル: glance.py プロジェクト: yiyinianhua/Openstack-Anvil
 def _config_adjust_paste(self, contents, fn):
     params = khelper.get_shared_params(ip=self.get_option('ip'),
                                        service_user='******',
                                        **utils.merge_dicts(self.get_option('keystone'), 
                                                            khelper.get_shared_passwords(self)))
     with io.BytesIO(contents) as stream:
         config = cfg.create_parser(cfg.RewritableConfigParser, self)
         config.readfp(stream)
         for (k, v) in self._fetch_keystone_params().items():
             config.set('filter:authtoken', k, v)
         contents = config.stringify(fn)
     return contents
コード例 #12
0
ファイル: keystone.py プロジェクト: jeffbudz/Openstack-Anvil
 def env_exports(self):
     params = khelper.get_shared_params(**utils.merge_dicts(self.options, khelper.get_shared_passwords(self)))
     to_set = OrderedDict()
     to_set["OS_PASSWORD"] = params["admin_password"]
     to_set["OS_TENANT_NAME"] = params["admin_tenant"]
     to_set["OS_USERNAME"] = params["admin_user"]
     to_set["OS_AUTH_URL"] = params["endpoints"]["public"]["uri"]
     to_set["SERVICE_ENDPOINT"] = params["endpoints"]["admin"]["uri"]
     for (endpoint, details) in params["endpoints"].items():
         if endpoint.find("templated") != -1:
             continue
         to_set[("KEYSTONE_%s_URI" % (endpoint.upper()))] = details["uri"]
     return to_set
コード例 #13
0
 def env_exports(self):
     params = khelper.get_shared_params(**utils.merge_dicts(self.options,
                                                            khelper.get_shared_passwords(self)))
     to_set = OrderedDict()
     to_set['OS_PASSWORD'] = params['admin_password']
     to_set['OS_TENANT_NAME'] = params['admin_tenant']
     to_set['OS_USERNAME'] = params['admin_user']
     to_set['OS_AUTH_URL'] = params['endpoints']['public']['uri']
     for (endpoint, details) in params['endpoints'].items():
         if endpoint.find('templated') != -1:
             continue
         to_set[("KEYSTONE_%s_URI" % (endpoint.upper()))] = details['uri']
     return to_set
コード例 #14
0
ファイル: keystone.py プロジェクト: dkulishenko/anvil
 def env_exports(self):
     params = khelper.get_shared_params(**utils.merge_dicts(self.options,
                                                            khelper.get_shared_passwords(self)))
     to_set = OrderedDict()
     to_set['OS_PASSWORD'] = params['admin_password']
     to_set['OS_TENANT_NAME'] = params['admin_tenant']
     to_set['OS_USERNAME'] = params['admin_user']
     to_set['OS_AUTH_URL'] = params['endpoints']['public']['uri']
     for (endpoint, details) in params['endpoints'].items():
         if endpoint.find('templated') != -1:
             continue
         to_set[("KEYSTONE_%s_URI" % (endpoint.upper()))] = details['uri']
     return to_set
コード例 #15
0
ファイル: glance.py プロジェクト: yiyinianhua/Openstack-Anvil
 def _config_adjust_paste(self, contents, fn):
     params = khelper.get_shared_params(
         ip=self.get_option('ip'),
         service_user='******',
         **utils.merge_dicts(self.get_option('keystone'),
                             khelper.get_shared_passwords(self)))
     with io.BytesIO(contents) as stream:
         config = cfg.create_parser(cfg.RewritableConfigParser, self)
         config.readfp(stream)
         for (k, v) in self._fetch_keystone_params().items():
             config.set('filter:authtoken', k, v)
         contents = config.stringify(fn)
     return contents
コード例 #16
0
ファイル: glance.py プロジェクト: gerardo8a/Openstack-Anvil
 def post_start(self):
     comp.PythonRuntime.post_start(self)
     if self.get_bool_option('load-images'):
         # Install any images that need activating...
         self.wait_active()
         params = {}
         params['glance'] = ghelper.get_shared_params(**self.options)
         params['keystone'] = khelper.get_shared_params(
             ip=self.get_option('ip'),
             service_user='******',
             **utils.merge_dicts(self.get_option('keystone'),
                                 khelper.get_shared_passwords(self)))
         ghelper.UploadService(params).install(self._get_image_urls())
コード例 #17
0
ファイル: glance.py プロジェクト: mgosalia/Openstack-Anvil
 def _fetch_keystone_params(self):
     params = khelper.get_shared_params(ip=self.get_option('ip'),
                                        service_user='******',
                                        **utils.merge_dicts(self.get_option('keystone'),
                                                            khelper.get_shared_passwords(self)))
     return {
         'auth_host': params['endpoints']['admin']['host'],
         'auth_port': params['endpoints']['admin']['port'],
         'auth_protocol': params['endpoints']['admin']['protocol'],
         # This uses the public uri not the admin one...
         'auth_uri': params['endpoints']['public']['uri'],
         'admin_tenant_name': params['service_tenant'],
         'admin_user': params['service_user'],
         'admin_password': params['service_password'],
     }
コード例 #18
0
 def _fetch_keystone_params(self):
     params = khelper.get_shared_params(ip=self.get_option('ip'),
                                        service_user='******',
                                        **utils.merge_dicts(self.get_option('keystone'),
                                                            khelper.get_shared_passwords(self)))
     return {
         'auth_host': params['endpoints']['admin']['host'],
         'auth_port': params['endpoints']['admin']['port'],
         'auth_protocol': params['endpoints']['admin']['protocol'],
         # This uses the public uri not the admin one...
         'auth_uri': params['endpoints']['public']['uri'],
         'admin_tenant_name': params['service_tenant'],
         'admin_user': params['service_user'],
         'admin_password': params['service_password'],
     }
コード例 #19
0
ファイル: keystone.py プロジェクト: apugachev-gd/anvil
 def _config_adjust_root(self, config):
     params = khelper.get_shared_params(**utils.merge_dicts(self.installer.options,
                                                            khelper.get_shared_passwords(self.installer)))
     config.add('admin_token', params['service_token'])
     config.add('admin_port', params['endpoints']['admin']['port'])
     config.add('public_port', params['endpoints']['public']['port'])
     config.add('verbose', True)
     config.add('debug', True)
     if self.installer.get_bool_option('enable-pki'):
         config.add_with_section('signing', 'token_format', 'PKI')
         for (k, v) in PKI_FILES.items():
             path = sh.joinpths(self.link_dir, v)
             config.add_with_section('signing', k, path)
     else:
         config.add_with_section('signing', 'token_format', 'UUID')
     config.add_with_section('catalog', 'driver', 'keystone.catalog.backends.sql.Catalog')
     config.remove('DEFAULT', 'log_config')
     config.add_with_section('sql', 'connection', self.fetch_dbdsn())
     config.add_with_section('ec2', 'driver', "keystone.contrib.ec2.backends.sql.Ec2")
コード例 #20
0
ファイル: glance.py プロジェクト: timjr/Openstack-Anvil
    def _config_adjust_paste(self, contents, fn):
        params = khelper.get_shared_params(ip=self.get_option('ip'),
                                           service_user='******',
                                           **utils.merge_dicts(self.get_option('keystone'), 
                                                               khelper.get_shared_passwords(self)))
        with io.BytesIO(contents) as stream:
            config = cfg.RewritableConfigParser()
            config.readfp(stream)
            config.set('filter:authtoken', 'auth_host', params['endpoints']['admin']['host'])
            config.set('filter:authtoken', 'auth_port', params['endpoints']['admin']['port'])
            config.set('filter:authtoken', 'auth_protocol', params['endpoints']['admin']['protocol'])

            # This uses the public uri not the admin one...
            config.set('filter:authtoken', 'auth_uri', params['endpoints']['public']['uri'])

            config.set('filter:authtoken', 'admin_tenant_name', params['service_tenant'])
            config.set('filter:authtoken', 'admin_user', params['service_user'])
            config.set('filter:authtoken', 'admin_password', params['service_password'])
            contents = config.stringify(fn)
        return contents
コード例 #21
0
ファイル: keystone.py プロジェクト: timjr/Openstack-Anvil
 def _config_adjust_root(self, contents, fn):
     params = khelper.get_shared_params(**utils.merge_dicts(self.options,
                                                            khelper.get_shared_passwords(self)))
     with io.BytesIO(contents) as stream:
         config = cfg.RewritableConfigParser()
         config.readfp(stream)
         config.set('DEFAULT', 'admin_token', params['service_token'])
         config.set('DEFAULT', 'admin_port', params['endpoints']['admin']['port'])
         config.set('DEFAULT', 'public_port', params['endpoints']['public']['port'])
         config.set('DEFAULT', 'verbose', True)
         config.set('DEFAULT', 'debug', True)
         config.set('catalog', 'driver', 'keystone.catalog.backends.sql.Catalog')
         config.remove_option('DEFAULT', 'log_config')
         config.set('sql', 'connection', dbhelper.fetch_dbdsn(dbname=DB_NAME,
                                                              utf8=True,
                                                              dbtype=self.get_option('db', 'type'),
                                                              **utils.merge_dicts(self.get_option('db'),
                                                                                  dbhelper.get_shared_passwords(self))))
         config.set('ec2', 'driver', "keystone.contrib.ec2.backends.sql.Ec2")
         contents = config.stringify(fn)
     return contents
コード例 #22
0
ファイル: keystone.py プロジェクト: apugachev-gd/anvil
 def _config_adjust_root(self, config):
     params = khelper.get_shared_params(
         **utils.merge_dicts(self.installer.options,
                             khelper.get_shared_passwords(self.installer)))
     config.add('admin_token', params['service_token'])
     config.add('admin_port', params['endpoints']['admin']['port'])
     config.add('public_port', params['endpoints']['public']['port'])
     config.add('verbose', True)
     config.add('debug', True)
     if self.installer.get_bool_option('enable-pki'):
         config.add_with_section('signing', 'token_format', 'PKI')
         for (k, v) in PKI_FILES.items():
             path = sh.joinpths(self.link_dir, v)
             config.add_with_section('signing', k, path)
     else:
         config.add_with_section('signing', 'token_format', 'UUID')
     config.add_with_section('catalog', 'driver',
                             'keystone.catalog.backends.sql.Catalog')
     config.remove('DEFAULT', 'log_config')
     config.add_with_section('sql', 'connection', self.fetch_dbdsn())
     config.add_with_section('ec2', 'driver',
                             "keystone.contrib.ec2.backends.sql.Ec2")
コード例 #23
0
ファイル: base.py プロジェクト: AsherBond/anvil
 def get_keystone_params(self, service_user):
     return khelper.get_shared_params(
         ip=self.installer.get_option('ip'),
         service_user=service_user,
         **utils.merge_dicts(self.installer.get_option('keystone'),
                             khelper.get_shared_passwords(self.installer)))
コード例 #24
0
 def get_keystone_params(self, service_user):
     return khelper.get_shared_params(
         ip=self.installer.get_option('ip'),
         service_user=service_user,
         **utils.merge_dicts(self.installer.get_option('keystone'),
                             khelper.get_shared_passwords(self.installer)))