当前位置: 首页>>代码示例>>Python>>正文


Python version.version_string函数代码示例

本文整理汇总了Python中manila.version.version_string函数的典型用法代码示例。如果您正苦于以下问题:Python version_string函数的具体用法?Python version_string怎么用?Python version_string使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了version_string函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: main

def main():
    """Parse options and call the appropriate class/method."""
    CONF.register_cli_opt(category_opt)
    script_name = sys.argv[0]
    if len(sys.argv) < 2:
        print(_("\nOpenStack manila version: %(version)s\n") %
              {'version': version.version_string()})
        print(script_name + " category action [<args>]")
        print(_("Available categories:"))
        for category in CATEGORIES:
            print("\t%s" % category)
        sys.exit(2)

    try:
        log.register_options(CONF)
        CONF(sys.argv[1:], project='manila',
             version=version.version_string())
        log.setup(CONF, "manila")
    except cfg.ConfigFilesNotFoundError as e:
        cfg_files = e.config_files
        print(_("Failed to read configuration file(s): %s") % cfg_files)
        sys.exit(2)

    fn = CONF.category.action_fn

    fn_args = fetch_func_args(fn)
    fn(*fn_args)
开发者ID:openstack,项目名称:manila,代码行数:27,代码来源:manage.py

示例2: main

def main():
    """Parse options and call the appropriate class/method."""
    CONF.register_cli_opt(category_opt)
    script_name = sys.argv[0]
    if len(sys.argv) < 2:
        print(_("\nOpenStack manila version: %(version)s\n") % {"version": version.version_string()})
        print(script_name + " category action [<args>]")
        print(_("Available categories:"))
        for category in CATEGORIES:
            print("\t%s" % category)
        sys.exit(2)

    try:
        log.register_options(CONF)
        CONF(sys.argv[1:], project="manila", version=version.version_string())
        log.setup(CONF, "manila")
    except cfg.ConfigFilesNotFoundError:
        cfgfile = CONF.config_file[-1] if CONF.config_file else None
        if cfgfile and not os.access(cfgfile, os.R_OK):
            st = os.stat(cfgfile)
            print(_("Could not read %s. Re-running with sudo") % cfgfile)
            try:
                os.execvp("sudo", ["sudo", "-u", "#%s" % st.st_uid] + sys.argv)
            except Exception:
                print(_("sudo failed, continuing as if nothing happened"))

        print(_("Please re-run manila-manage as root."))
        sys.exit(2)

    fn = CONF.category.action_fn

    fn_args = fetch_func_args(fn)
    fn(*fn_args)
开发者ID:ajarr,项目名称:manila,代码行数:33,代码来源:manage.py

示例3: main

def main():
    log.register_options(CONF)
    config.set_middleware_defaults()
    CONF(sys.argv[1:], project='manila',
         version=version.version_string())
    log.setup(CONF, "manila")
    LOG = log.getLogger('manila.all')

    msg = _('manila-all is deprecated in Newton and '
            'will be removed in Ocata.')
    versionutils.report_deprecated_feature(LOG, msg)

    utils.monkey_patch()
    launcher = service.process_launcher()
    # manila-api
    try:
        server = service.WSGIService('osapi_share')
        launcher.launch_service(server, workers=server.workers or 1)
    except (Exception, SystemExit):
        LOG.exception(_LE('Failed to load osapi_share'))

    for binary in ['manila-share', 'manila-scheduler', 'manila-api',
                   'manila-data']:
        try:
            launcher.launch_service(service.Service.create(binary=binary))
        except (Exception, SystemExit):
            LOG.exception(_LE('Failed to load %s'), binary)
    launcher.wait()
开发者ID:ISCAS-VDI,项目名称:manila-base,代码行数:28,代码来源:all.py

示例4: test_main_argv_lt_2

    def test_main_argv_lt_2(self, register_cli_opt):
        script_name = 'manila-manage'
        sys.argv = [script_name]
        CONF(sys.argv[1:], project='manila', version=version.version_string())
        exit = self.assertRaises(SystemExit, manila_manage.main)

        self.assertTrue(register_cli_opt.called)
        self.assertEqual(exit.code, 2)
开发者ID:jcsp,项目名称:manila,代码行数:8,代码来源:test_manage.py

示例5: main

def main():
    log.register_options(CONF)
    CONF(sys.argv[1:], project='manila',
         version=version.version_string())
    log.setup(CONF, "manila")
    utils.monkey_patch()
    server = service.Service.create(binary='manila-data')
    service.serve(server)
    service.wait()
开发者ID:ISCAS-VDI,项目名称:manila-base,代码行数:9,代码来源:data.py

示例6: _common_checks

 def _common_checks(self):
     self.assertEqual(CONF.project, 'manila')
     self.assertEqual(CONF.version, version.version_string())
     log.setup.assert_called_once_with(CONF, "manila")
     log.register_options.assert_called_once_with(CONF)
     log.getLogger.assert_called_once_with('manila.all')
     utils.monkey_patch.assert_called_once_with()
     service.process_launcher.assert_called_once_with()
     service.WSGIService.assert_called_once_with('osapi_share')
开发者ID:jcsp,项目名称:manila,代码行数:9,代码来源:test_all.py

示例7: main

def main():
    log.register_options(CONF)
    CONF(sys.argv[1:], project='manila',
         version=version.version_string())
    config.verify_share_protocols()
    log.setup(CONF, "manila")
    utils.monkey_patch()
    server = service.WSGIService('osapi_share')
    service.serve(server)
    service.wait()
开发者ID:aawm,项目名称:manila,代码行数:10,代码来源:api.py

示例8: _common_checks

 def _common_checks(self):
     self.assertEqual('manila', CONF.project)
     self.assertEqual(version.version_string(), CONF.version)
     log.setup.assert_called_once_with(CONF, "manila")
     log.register_options.assert_called_once_with(CONF)
     log.getLogger.assert_called_once_with('manila.all')
     self.assertEqual(versionutils.report_deprecated_feature.call_count, 1)
     utils.monkey_patch.assert_called_once_with()
     service.process_launcher.assert_called_once_with()
     service.WSGIService.assert_called_once_with('osapi_share')
开发者ID:ISCAS-VDI,项目名称:manila-base,代码行数:10,代码来源:test_all.py

示例9: setUp

 def setUp(self):
     super(ManilaCmdManageTestCase, self).setUp()
     sys.argv = ['manila-share']
     CONF(sys.argv[1:], project='manila', version=version.version_string())
     self.shell_commands = manila_manage.ShellCommands()
     self.host_commands = manila_manage.HostCommands()
     self.db_commands = manila_manage.DbCommands()
     self.version_commands = manila_manage.VersionCommands()
     self.config_commands = manila_manage.ConfigCommands()
     self.get_log_cmds = manila_manage.GetLogCommands()
     self.service_cmds = manila_manage.ServiceCommands()
开发者ID:jcsp,项目名称:manila,代码行数:11,代码来源:test_manage.py

示例10: main

def main():
    log.register_options(CONF)
    gmr_opts.set_defaults(CONF)
    CONF(sys.argv[1:], project='manila',
         version=version.version_string())
    log.setup(CONF, "manila")
    utils.monkey_patch()
    gmr.TextGuruMeditation.setup_autorun(version, conf=CONF)
    server = service.Service.create(binary='manila-data')
    service.serve(server)
    service.wait()
开发者ID:openstack,项目名称:manila,代码行数:11,代码来源:data.py

示例11: test_main

    def test_main(self, register_log_opts, register_cli_opt, config_opts_call):
        script_name = 'manila-manage'
        sys.argv = [script_name, 'config', 'list']
        action_fn = mock.MagicMock()
        CONF.category = mock.MagicMock(action_fn=action_fn)

        manila_manage.main()

        self.assertTrue(register_cli_opt.called)
        register_log_opts.assert_called_once_with(CONF)
        config_opts_call.assert_called_once_with(
            sys.argv[1:], project='manila', version=version.version_string())
        self.assertTrue(action_fn.called)
开发者ID:jcsp,项目名称:manila,代码行数:13,代码来源:test_manage.py

示例12: main

def main():
    log.register_options(CONF)
    gmr_opts.set_defaults(CONF)
    CONF(sys.argv[1:], project='manila',
         version=version.version_string())
    config.verify_share_protocols()
    log.setup(CONF, "manila")
    utils.monkey_patch()

    gmr.TextGuruMeditation.setup_autorun(version, conf=CONF)
    launcher = service.process_launcher()
    server = service.WSGIService('osapi_share')
    launcher.launch_service(server, workers=server.workers or 1)
    launcher.wait()
开发者ID:openstack,项目名称:manila,代码行数:14,代码来源:api.py

示例13: start

    def start(self):
        version_string = version.version_string()
        LOG.audit(_('Starting %(topic)s node (version %(version_string)s)'),
                  {'topic': self.topic, 'version_string': version_string})
        self.manager.init_host()
        self.model_disconnected = False
        ctxt = context.get_admin_context()
        try:
            service_ref = db.service_get_by_args(ctxt,
                                                 self.host,
                                                 self.binary)
            self.service_id = service_ref['id']
        except exception.NotFound:
            self._create_service_ref(ctxt)

        self.conn = rpc.create_connection(new=True)
        LOG.debug(_("Creating Consumer connection for Service %s") %
                  self.topic)

        rpc_dispatcher = self.manager.create_rpc_dispatcher()

        # Share this same connection for these Consumers
        self.conn.create_consumer(self.topic, rpc_dispatcher, fanout=False)

        node_topic = '%s.%s' % (self.topic, self.host)
        self.conn.create_consumer(node_topic, rpc_dispatcher, fanout=False)

        self.conn.create_consumer(self.topic, rpc_dispatcher, fanout=True)

        # Consume from all consumers in a thread
        self.conn.consume_in_thread()

        if self.report_interval:
            pulse = utils.LoopingCall(self.report_state)
            pulse.start(interval=self.report_interval,
                        initial_delay=self.report_interval)
            self.timers.append(pulse)

        if self.periodic_interval:
            if self.periodic_fuzzy_delay:
                initial_delay = random.randint(0, self.periodic_fuzzy_delay)
            else:
                initial_delay = None

            periodic = utils.LoopingCall(self.periodic_tasks)
            periodic.start(interval=self.periodic_interval,
                           initial_delay=initial_delay)
            self.timers.append(periodic)
开发者ID:aostapenko,项目名称:manila,代码行数:48,代码来源:service.py

示例14: test_main_sudo_failed

    def test_main_sudo_failed(self, register_cli_opt, log_setup,
                              register_log_opts, config_opts_call):
        script_name = 'manila-manage'
        sys.argv = [script_name, 'fake_category', 'fake_action']
        config_opts_call.side_effect = cfg.ConfigFilesNotFoundError(
            mock.sentinel._namespace)

        exit = self.assertRaises(SystemExit, manila_manage.main)

        self.assertTrue(register_cli_opt.called)
        register_log_opts.assert_called_once_with(CONF)
        config_opts_call.assert_called_once_with(
            sys.argv[1:], project='manila',
            version=version.version_string())
        self.assertFalse(log_setup.called)
        self.assertEqual(exit.code, 2)
开发者ID:jcsp,项目名称:manila,代码行数:16,代码来源:test_manage.py

示例15: main

def main():
    log.register_options(CONF)
    CONF(sys.argv[1:], project='manila',
         version=version.version_string())
    log.setup(CONF, "manila")
    utils.monkey_patch()
    launcher = service.process_launcher()
    if CONF.enabled_share_backends:
        for backend in CONF.enabled_share_backends:
            host = "%[email protected]%s" % (CONF.host, backend)
            server = service.Service.create(host=host,
                                            service_name=backend,
                                            binary='manila-share')
            launcher.launch_service(server)
    else:
        server = service.Service.create(binary='manila-share')
        launcher.launch_service(server)
    launcher.wait()
开发者ID:ISCAS-VDI,项目名称:manila-base,代码行数:18,代码来源:share.py


注:本文中的manila.version.version_string函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。