예제 #1
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
예제 #2
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
예제 #3
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
예제 #4
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
예제 #5
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)
         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
예제 #6
0
 def _config_adjust_api_reg(self, contents, fn):
     gparams = ghelper.get_shared_params(**self.options)
     with io.BytesIO(contents) as stream:
         config = cfg.create_parser(cfg.RewritableConfigParser, self)
         config.readfp(stream)
         config.set('DEFAULT', 'debug', self.get_bool_option('verbose'))
         config.set('DEFAULT', 'verbose', self.get_bool_option('verbose'))
         if fn in [REG_CONF]:
             config.set('DEFAULT', 'bind_port', gparams['endpoints']['registry']['port'])
         else:
             config.set('DEFAULT', 'bind_port', gparams['endpoints']['public']['port'])
         config.set('DEFAULT', '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.remove_option('DEFAULT', 'log_file')
         config.set('paste_deploy', 'flavor', self.get_option('paste_flavor'))
         for (k, v) in self._fetch_keystone_params().items():
             config.set('keystone_authtoken', k, v)
         if fn in [API_CONF]:
             config.set('DEFAULT', 'default_store', 'file')
             img_store_dir = sh.joinpths(self.get_option('component_dir'), 'images')
             config.set('DEFAULT', 'filesystem_store_datadir', img_store_dir)
             LOG.debug("Ensuring file system store directory %r exists and is empty." % (img_store_dir))
             if sh.isdir(img_store_dir):
                 sh.deldir(img_store_dir)
             sh.mkdirslist(img_store_dir, tracewriter=self.tracewriter, adjust_suids=True)
         return config.stringify(fn)
예제 #7
0
 def _config_adjust_api_reg(self, contents, fn):
     gparams = ghelper.get_shared_params(**self.options)
     with io.BytesIO(contents) as stream:
         config = cfg.create_parser(cfg.RewritableConfigParser, self)
         config.readfp(stream)
         config.set('DEFAULT', 'debug', self.get_bool_option('verbose'))
         config.set('DEFAULT', 'verbose', self.get_bool_option('verbose'))
         if fn in [REG_CONF]:
             config.set('DEFAULT', 'bind_port', gparams['endpoints']['registry']['port'])
         else:
             config.set('DEFAULT', 'bind_port', gparams['endpoints']['public']['port'])
         config.set('DEFAULT', '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.remove_option('DEFAULT', 'log_file')
         config.set('paste_deploy', 'flavor', self.get_option('paste_flavor'))
         for (k, v) in self._fetch_keystone_params().items():
             config.set('keystone_authtoken', k, v)
         if fn in [API_CONF]:
             config.set('DEFAULT', 'default_store', 'file')
             img_store_dir = sh.joinpths(self.get_option('component_dir'), 'images')
             config.set('DEFAULT', 'filesystem_store_datadir', img_store_dir)
             LOG.debug("Ensuring file system store directory %r exists and is empty." % (img_store_dir))
             if sh.isdir(img_store_dir):
                 sh.deldir(img_store_dir)
             sh.mkdirslist(img_store_dir, tracewriter=self.tracewriter, adjust_suids=True)
         return config.stringify(fn)
예제 #8
0
 def _config_adjust_api(self, contents, fn):
     params = ghelper.get_shared_params(**self.options)
     with io.BytesIO(contents) as stream:
         config = cfg.create_parser(cfg.RewritableConfigParser, self)
         config.readfp(stream)
         img_store_dir = sh.joinpths(self.get_option('component_dir'),
                                     'images')
         config.set('DEFAULT', 'debug', self.get_bool_option('verbose', ))
         config.set('DEFAULT', 'verbose', self.get_bool_option('verbose'))
         config.set('DEFAULT', 'default_store', 'file')
         config.set('DEFAULT', 'filesystem_store_datadir', img_store_dir)
         config.set('DEFAULT', 'bind_port',
                    params['endpoints']['public']['port'])
         config.set(
             'DEFAULT', '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.remove_option('DEFAULT', 'log_file')
         config.set('paste_deploy', 'flavor',
                    self.get_option('paste_flavor'))
         LOG.debug(
             "Ensuring file system store directory %r exists and is empty."
             % (img_store_dir))
         sh.deldir(img_store_dir)
         self.tracewriter.dirs_made(*sh.mkdirslist(img_store_dir))
         return config.stringify(fn)
예제 #9
0
 def _config_adjust_paste(self, contents, fn):
     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
예제 #10
0
 def _config_adjust_logging(self, contents, fn):
     with io.BytesIO(contents) as stream:
         config = cfg.create_parser(cfg.RewritableConfigParser, self)
         config.readfp(stream)
         config.set('logger_root', 'level', 'DEBUG')
         config.set('logger_root', 'handlers', "devel,production")
         contents = config.stringify(fn)
     return contents
예제 #11
0
 def _config_adjust_logging(self, contents, fn):
     with io.BytesIO(contents) as stream:
         config = cfg.create_parser(cfg.RewritableConfigParser, self)
         config.readfp(stream)
         config.set('logger_root', 'level', 'DEBUG')
         config.set('logger_root', 'handlers', "stdout")
         contents = config.stringify(fn)
     return contents
예제 #12
0
 def _config_adjust_paste(self, contents, fn):
     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
예제 #13
0
 def _config_adjust_logging(self, contents, fn):
     with io.BytesIO(contents) as stream:
         config = cfg.create_parser(cfg.RewritableConfigParser, self)
         config.readfp(stream)
         config.set("logger_root", "level", "DEBUG")
         config.set("logger_root", "handlers", "stdout")
         contents = config.stringify(fn)
     return contents
예제 #14
0
파일: base.py 프로젝트: aababilov/anvil
 def config_adjust(self, contents, name):
     adjuster = self.config_adjusters.get(name)
     if adjuster:
         if isinstance(contents, unicode):
             contents = contents.encode("utf-8")
         with io.BytesIO(contents) as stream:
             config = cfg.create_parser(cfg.RewritableConfigParser, self.installer)
             config.readfp(stream)
             adjuster(cfg.DefaultConf(config))
             contents = config.stringify(name)
     return contents
예제 #15
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)
         for (k, v) in self._fetch_keystone_params().items():
             config.set('filter:authtoken', k, v)
         contents = config.stringify(fn)
     return contents
예제 #16
0
 def config_adjust(self, contents, name):
     adjuster = self.config_adjusters.get(name)
     if adjuster:
         if isinstance(contents, unicode):
             contents = contents.encode("utf-8")
         with io.BytesIO(contents) as stream:
             config = cfg.create_parser(cfg.RewritableConfigParser,
                                        self.installer)
             config.readfp(stream)
             adjuster(cfg.DefaultConf(config))
             contents = config.stringify(name)
     return contents
예제 #17
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)
         for (k, v) in self._fetch_keystone_params().items():
             config.set('filter:authtoken', k, v)
         contents = config.stringify(fn)
     return contents
예제 #18
0
 def _config_adjust_registry(self, contents, fn):
     params = ghelper.get_shared_params(**self.options)
     with io.BytesIO(contents) as stream:
         config = cfg.create_parser(cfg.RewritableConfigParser, self)
         config.readfp(stream)
         config.set('DEFAULT', 'debug', self.get_bool_option('verbose'))
         config.set('DEFAULT', 'verbose', self.get_bool_option('verbose'))
         config.set('DEFAULT', 'bind_port', params['endpoints']['registry']['port'])
         config.set('DEFAULT', '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.remove_option('DEFAULT', 'log_file')
         config.set('paste_deploy', 'flavor', self.get_option('paste_flavor'))
         return config.stringify(fn)
     return contents
예제 #19
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'])

            # 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
예제 #20
0
 def _config_adjust_api(self, contents, fn):
     params = ghelper.get_shared_params(**self.options)
     with io.BytesIO(contents) as stream:
         config = cfg.create_parser(cfg.RewritableConfigParser, self)
         config.readfp(stream)
         img_store_dir = sh.joinpths(self.get_option('component_dir'), 'images')
         config.set('DEFAULT', 'debug', self.get_bool_option('verbose',))
         config.set('DEFAULT', 'verbose', self.get_bool_option('verbose'))
         config.set('DEFAULT', 'default_store', 'file')
         config.set('DEFAULT', 'filesystem_store_datadir', img_store_dir)
         config.set('DEFAULT', 'bind_port', params['endpoints']['public']['port'])
         config.set('DEFAULT', '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.remove_option('DEFAULT', 'log_file')
         config.set('paste_deploy', 'flavor', self.get_option('paste_flavor'))
         LOG.debug("Ensuring file system store directory %r exists and is empty." % (img_store_dir))
         sh.deldir(img_store_dir)
         self.tracewriter.dirs_made(*sh.mkdirslist(img_store_dir))
         return config.stringify(fn)
예제 #21
0
 def _config_adjust_registry(self, contents, fn):
     params = ghelper.get_shared_params(**self.options)
     with io.BytesIO(contents) as stream:
         config = cfg.create_parser(cfg.RewritableConfigParser, self)
         config.readfp(stream)
         config.set('DEFAULT', 'debug', self.get_bool_option('verbose'))
         config.set('DEFAULT', 'verbose', self.get_bool_option('verbose'))
         config.set('DEFAULT', 'bind_port',
                    params['endpoints']['registry']['port'])
         config.set(
             'DEFAULT', '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.remove_option('DEFAULT', 'log_file')
         config.set('paste_deploy', 'flavor',
                    self.get_option('paste_flavor'))
         return config.stringify(fn)
     return contents
예제 #22
0
 def __init__(self, name, installer):
     self.installer = installer
     self.backing = cfg.create_parser(cfg.BuiltinConfigParser, self.installer)
     self.name = name
예제 #23
0
 def __init__(self, name, installer):
     self.installer = installer
     self.backing = cfg.create_parser(cfg.BuiltinConfigParser,
                                      self.installer)
     self.name = name