예제 #1
0
 def __init__(self, app, ns, acct, proxy=None,
              strip_v1=False, account_first=False,
              **kwargs):
     super(HashedContainerMiddleware, self).__init__(
         app, acct, strip_v1=strip_v1, account_first=account_first)
     conf = {"namespace": ns, "proxyd_url": proxy}
     try:
         # New API (openio-sds >= 4.2)
         from oio.cli.common.clientmanager import ClientManager
         climgr = ClientManager(conf)
         self.con_builder = climgr.flatns_manager
     except ImportError:
         # Old API
         # pylint: disable=redefined-variable-type,no-member
         from oio.cli.clientmanager import ClientManager
         climgr = ClientManager(conf)
         self.con_builder = climgr.get_flatns_manager()
     for k, v in kwargs.items():
         if k in self.EXTRA_KEYWORDS:
             self.con_builder.__dict__[k] = int(v)
예제 #2
0
 def initialize_app(self, argv):
     super(OpenioAdminApp, self).initialize_app(argv)
     # For compatibility with "openio" CLI, we need this.
     options = {
         'namespace': self.options.ns,
         'account_name': self.options.account,
         'proxyd_url': self.options.proxyd_url,
         'admin_mode': self.options.admin_mode,
         'is_cli': True,
     }
     self.client_manager = ClientManager(options)
예제 #3
0
 def __init__(self,
              app,
              ns,
              acct,
              proxy=None,
              strip_v1=False,
              account_first=False):
     super(HashedContainerMiddleware,
           self).__init__(app,
                          acct,
                          strip_v1=strip_v1,
                          account_first=account_first)
     conf = {"namespace": ns, "proxyd_url": proxy}
     try:
         # New API (openio-sds >= 4.2)
         from oio.cli.common.clientmanager import ClientManager
         climgr = ClientManager(conf)
         self.con_builder = climgr.flatns_manager
     except ImportError:
         # Old API
         from oio.cli.clientmanager import ClientManager
         climgr = ClientManager(conf)
         self.con_builder = climgr.get_flatns_manager()
예제 #4
0
    def initialize_app(self, argv):
        super(OpenIOShell, self).initialize_app(argv)

        try:
            api = argv[0]
            module_name = 'oio.cli.%s.client' % api
            get_plugin_module(module_name)
            cmd_group = 'openio.%s' % api
            self.command_manager.add_command_group(cmd_group)
            LOG.debug('%s API: cmd group %s', api, cmd_group)
        except ImportError:
            for api in GROUP_LIST:
                cmd_group = 'openio.%s' % api
                self.command_manager.add_command_group(cmd_group)
                LOG.debug('%s API: cmd group %s', api, cmd_group)
        except IndexError:
            for api in GROUP_LIST:
                module_name = 'oio.cli.%s.client' % api
                get_plugin_module(module_name)
                cmd_group = 'openio.%s' % api
                self.command_manager.add_command_group(cmd_group)
                LOG.debug('%s API: cmd group %s', api, cmd_group)

        self.print_help_if_requested()

        options = {
            'namespace':
            self.options.ns,
            'account_name':
            self.options.account,
            'proxyd_url':
            self.options.proxyd_url,
            'admin_mode':
            self.options.admin_mode,
            'log_level':
            logging.getLevelName(logging.getLogger('').getEffectiveLevel()),
            'is_cli':
            True,
        }
        if self.options.dump_perfdata:
            options['perfdata'] = dict()
        self.client_manager = ClientManager(options)