本文整理汇总了Python中nova.config.parse_args函数的典型用法代码示例。如果您正苦于以下问题:Python parse_args函数的具体用法?Python parse_args怎么用?Python parse_args使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了parse_args函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: main
def main():
# Setup flags
config.parse_args(sys.argv)
if CONF.ssl_only and not os.path.exists(CONF.cert):
print("SSL only and %s not found" % CONF.cert)
return(-1)
# Check to see if tty html/js/css files are present
if not os.path.exists(CONF.web):
print("Can not find serial terminal html/js/css files at %s." \
% CONF.web)
sys.exit(-1)
# Create and start the NovaWebSockets proxy
server = websocketproxy.NovaWebSocketProxy(
listen_host=CONF.serialproxy_host,
listen_port=CONF.serialproxy_port,
source_is_ipv6=CONF.source_is_ipv6,
verbose=CONF.verbose,
cert=CONF.cert,
key=CONF.key,
ssl_only=CONF.ssl_only,
daemon=CONF.daemon,
record=CONF.record,
web=CONF.web,
target_host='ignore',
target_port='ignore',
wrap_mode='exit',
wrap_cmd=None,
connect_info_validator=validate_connection)
server.start_server()
开发者ID:Snergster,项目名称:virl-salt,代码行数:32,代码来源:serialproxy.py
示例2: main
def main():
"""Parse environment and arguments and call the appropriate action."""
config.parse_args(sys.argv,
default_config_files=jsonutils.loads(os.environ['CONFIG_FILE']))
logging.setup("nova")
global LOG
LOG = logging.getLogger('nova.dhcpbridge')
objects.register_all()
if not CONF.conductor.use_local:
block_db_access()
objects_base.NovaObject.indirection_api = \
conductor_rpcapi.ConductorAPI()
if CONF.action.name in ['add', 'del', 'old']:
msg = (_("Called '%(action)s' for mac '%(mac)s' with ip '%(ip)s'") %
{"action": CONF.action.name,
"mac": CONF.action.mac,
"ip": CONF.action.ip})
LOG.debug(msg)
CONF.action.func(CONF.action.mac, CONF.action.ip)
else:
try:
network_id = int(os.environ.get('NETWORK_ID'))
except TypeError:
LOG.error(_("Environment variable 'NETWORK_ID' must be set."))
return(1)
print(init_leases(network_id))
rpc.cleanup()
开发者ID:VinceOnGit,项目名称:nova,代码行数:32,代码来源:dhcpbridge.py
示例3: main
def main():
# Setup flags
CONF.set_default('web', '/usr/share/novnc')
config.parse_args(sys.argv)
if CONF.ssl_only and not os.path.exists(CONF.cert):
print("SSL only and %s not found" % CONF.cert)
return(-1)
# Check to see if novnc html/js/css files are present
if not os.path.exists(CONF.web):
print("Can not find novnc html/js/css files at %s." % CONF.web)
return(-1)
# Create and start the NovaWebSockets proxy
server = websocketproxy.NovaWebSocketProxy(
listen_host=CONF.novncproxy_host,
listen_port=CONF.novncproxy_port,
source_is_ipv6=CONF.source_is_ipv6,
verbose=CONF.verbose,
cert=CONF.cert,
key=CONF.key,
ssl_only=CONF.ssl_only,
daemon=CONF.daemon,
record=CONF.record,
web=CONF.web,
target_host='ignore',
target_port='ignore',
wrap_mode='exit',
wrap_cmd=None)
server.start_server()
开发者ID:DrZaarlon,项目名称:nova,代码行数:31,代码来源:novncproxy.py
示例4: main
def main():
config.parse_args(sys.argv)
logging.setup("nova")
utils.monkey_patch()
server = s3server.get_wsgi_server()
service.serve(server)
service.wait()
开发者ID:674009287,项目名称:nova,代码行数:7,代码来源:objectstore.py
示例5: main
def main():
# Setup flags
CONF.set_default('web', '/usr/share/novnc')
config.parse_args(sys.argv)
logging.setup("nova")
if CONF.ssl_only and not os.path.exists(CONF.cert):
print("SSL only and %s not found" % CONF.cert)
return(-1)
# Check to see if novnc html/js/css files are present
if not os.path.exists(CONF.web):
print("Can not find novnc html/js/css files at %s." % CONF.web)
return(-1)
logging.setup("nova")
gmr.TextGuruMeditation.setup_autorun(version)
# Create and start the NovaWebSockets proxy
server = websocketproxy.NovaWebSocketProxy(
listen_host=CONF.novncproxy_host,
listen_port=CONF.novncproxy_port,
source_is_ipv6=CONF.source_is_ipv6,
verbose=CONF.verbose,
cert=CONF.cert,
key=CONF.key,
ssl_only=CONF.ssl_only,
daemon=CONF.daemon,
record=CONF.record,
traffic=CONF.verbose and not CONF.daemon,
web=CONF.web,
file_only=True,
RequestHandlerClass=websocketproxy.NovaProxyRequestHandler)
server.start_server()
开发者ID:AsherBond,项目名称:nova,代码行数:35,代码来源:novncproxy.py
示例6: main
def main():
config.parse_args(sys.argv)
logging.setup("nova")
utils.monkey_patch()
server = service.Service.create(binary='nova-cert', topic=CONF.cert_topic)
service.serve(server)
service.wait()
开发者ID:AnyBucket,项目名称:nova,代码行数:7,代码来源:cert.py
示例7: main
def main():
# Setup flags
config.parse_args(sys.argv)
if CONF.ssl_only and not os.path.exists(CONF.cert):
exit_with_error("SSL only and %s not found" % CONF.cert)
logging.setup("nova")
gmr.TextGuruMeditation.setup_autorun(version)
# Create and start the NovaWebSockets proxy
server = websocketproxy.NovaWebSocketProxy(
listen_host=CONF.serial_console.serialproxy_host,
listen_port=CONF.serial_console.serialproxy_port,
source_is_ipv6=CONF.source_is_ipv6,
verbose=CONF.verbose,
cert=CONF.cert,
key=CONF.key,
ssl_only=CONF.ssl_only,
daemon=CONF.daemon,
record=CONF.record,
traffic=CONF.verbose and not CONF.daemon,
file_only=True,
RequestHandlerClass=websocketproxy.NovaProxyRequestHandler)
server.start_server()
开发者ID:EdLeafe,项目名称:nova,代码行数:25,代码来源:serialproxy.py
示例8: init_application
def init_application(name):
conf_files = _get_config_files()
config.parse_args([], default_config_files=conf_files)
logging.setup(CONF, "nova")
try:
_setup_service(CONF.host, name)
except exception.ServiceTooOld as exc:
return error_application(exc, name)
service.setup_profiler(name, CONF.host)
# dump conf at debug (log_options option comes from oslo.service)
# FIXME(mriedem): This is gross but we don't have a public hook into
# oslo.service to register these options, so we are doing it manually for
# now; remove this when we have a hook method into oslo.service.
CONF.register_opts(service_opts.service_opts)
if CONF.log_options:
CONF.log_opt_values(
logging.getLogger(__name__),
logging.DEBUG)
conf = conf_files[0]
return deploy.loadapp('config:%s' % conf, name=name)
开发者ID:arbrandes,项目名称:nova,代码行数:25,代码来源:wsgi_app.py
示例9: start_fixture
def start_fixture(self):
self.conf = CONF
self.conf.set_override('auth_strategy', 'noauth2')
# Be explicit about all three database connections to avoid
# potential conflicts with config on disk.
self.conf.set_override('connection', "sqlite://", group='database')
self.conf.set_override('connection', "sqlite://",
group='api_database')
self.conf.set_override('connection', "sqlite://",
group='placement_database')
config.parse_args([], default_config_files=None, configure_db=False,
init_rpc=False)
self.placement_db_fixture = fixtures.Database('placement')
# NOTE(cdent): api and main database are not used but we still need
# to manage them to make the fixtures work correctly and not cause
# conflicts with other tests in the same process.
self.api_db_fixture = fixtures.Database('api')
self.main_db_fixture = fixtures.Database('main')
self.placement_db_fixture.reset()
self.api_db_fixture.reset()
self.main_db_fixture.reset()
os.environ['RP_UUID'] = uuidutils.generate_uuid()
os.environ['RP_NAME'] = uuidutils.generate_uuid()
开发者ID:muraliran,项目名称:nova,代码行数:25,代码来源:fixtures.py
示例10: main
def main(hosts):
# not entirely sure what happens here, but once this is
# run we have access to all the CONF keys/values
config.parse_args([])
conductor_api = api.API()
#ctxt = context.RequestContext(user_id="admin", project_id="admin",
# is_admin=True)
ctxt = context.get_admin_context()
# can't filter by {'host': None} for whatever reason :-/
filters = {'vm_state': 'error'}
if hosts == 'one':
filters['host'] = api.CONF.host
try:
instances = conductor_api.instance_get_all_by_filters(ctxt, filters)
except common.Timeout:
print "status timeout"
sys.exit(1)
count = 0
for i in instances:
# we skip these instances as they'll be accounted for when run from
# the compute node
if hosts == "all" and i['host'] is not None:
continue
count += 1
print "status success"
print "metric error int32 %d" % count
开发者ID:mattt416,项目名称:rcbops-maas-plugins,代码行数:33,代码来源:error_instances.py
示例11: main
def main():
config.parse_args(sys.argv)
logging.setup(CONF, "nova")
utils.monkey_patch()
objects.register_all()
if 'osapi_compute' in CONF.enabled_apis:
# NOTE(mriedem): This is needed for caching the nova-compute service
# version.
objects.Service.enable_min_version_cache()
log = logging.getLogger(__name__)
gmr.TextGuruMeditation.setup_autorun(version)
launcher = service.process_launcher()
started = 0
for api in CONF.enabled_apis:
should_use_ssl = api in CONF.enabled_ssl_apis
try:
server = service.WSGIService(api, use_ssl=should_use_ssl)
launcher.launch_service(server, workers=server.workers or 1)
started += 1
except exception.PasteAppNotFound as ex:
log.warning("%s. ``enabled_apis`` includes bad values. "
"Fix to remove this warning.", ex)
if started == 0:
log.error('No APIs were started. '
'Check the enabled_apis config option.')
sys.exit(1)
launcher.wait()
开发者ID:Juniper,项目名称:nova,代码行数:31,代码来源:api.py
示例12: proxy
def proxy(host, port):
# Setup flags
config.parse_args(sys.argv)
if CONF.ssl_only and not os.path.exists(CONF.cert):
exit_with_error("SSL only and %s not found" % CONF.cert)
# Check to see if tty html/js/css files are present
if CONF.web and not os.path.exists(CONF.web):
exit_with_error("Can not find html/js files at %s." % CONF.web)
logging.setup("nova")
gmr.TextGuruMeditation.setup_autorun(version)
# Create and start the NovaWebSockets proxy
websocketproxy.NovaWebSocketProxy(
listen_host=host,
listen_port=port,
source_is_ipv6=CONF.source_is_ipv6,
verbose=CONF.verbose,
cert=CONF.cert,
key=CONF.key,
ssl_only=CONF.ssl_only,
daemon=CONF.daemon,
record=CONF.record,
traffic=CONF.verbose and not CONF.daemon,
web=CONF.web,
file_only=True,
RequestHandlerClass=websocketproxy.NovaProxyRequestHandler
).start_server()
开发者ID:dtroyer,项目名称:nova,代码行数:31,代码来源:baseproxy.py
示例13: main
def main():
config.parse_args(sys.argv)
logging.setup("nova")
LOG = logging.getLogger('nova.virt.baremetal.deploy_helper')
app = BareMetalDeploy()
srv = simple_server.make_server('', 10000, app)
srv.serve_forever()
开发者ID:AnyBucket,项目名称:nova,代码行数:7,代码来源:baremetal_deploy_helper.py
示例14: main
def main():
config.parse_args(sys.argv)
logging.setup("nova")
wsgi_server = xvp_proxy.get_wsgi_server()
service.serve(wsgi_server)
service.wait()
开发者ID:674009287,项目名称:nova,代码行数:7,代码来源:xvpvncproxy.py
示例15: setUp
def setUp(self):
super(ConfFixture, self).setUp()
self.conf.set_default("api_paste_config", paths.state_path_def("etc/nova/api-paste.ini"))
self.conf.set_default("host", "fake-mini")
self.conf.set_default("compute_driver", "nova.virt.fake.SmallFakeDriver")
self.conf.set_default("fake_network", True)
self.conf.set_default("flat_network_bridge", "br100")
self.conf.set_default("floating_ip_dns_manager", "nova.tests.unit.utils.dns_manager")
self.conf.set_default("instance_dns_manager", "nova.tests.unit.utils.dns_manager")
self.conf.set_default("network_size", 8)
self.conf.set_default("num_networks", 2)
self.conf.set_default("use_ipv6", True)
self.conf.set_default("vlan_interface", "eth0")
self.conf.set_default("auth_strategy", "noauth2")
config.parse_args([], default_config_files=[], configure_db=False)
self.conf.set_default("connection", "sqlite://", group="database")
self.conf.set_default("connection", "sqlite://", group="api_database")
self.conf.set_default("sqlite_synchronous", False, group="database")
self.conf.set_default("sqlite_synchronous", False, group="api_database")
self.conf.set_default("fatal_exception_format_errors", True)
self.conf.set_default("enabled", True, "osapi_v21")
self.conf.set_default("force_dhcp_release", False)
self.conf.set_default("periodic_enable", False)
policy_opts.set_defaults(self.conf)
self.addCleanup(utils.cleanup_dns_managers)
self.addCleanup(ipv6.api.reset_backend)
开发者ID:octupszhang,项目名称:nova,代码行数:26,代码来源:conf_fixture.py
示例16: main
def main():
"""Parse environment and arguments and call the appropriate action."""
config.parse_args(sys.argv, default_config_files=jsonutils.loads(os.environ["CONFIG_FILE"]))
logging.setup(CONF, "nova")
global LOG
LOG = logging.getLogger("nova.dhcpbridge")
objects.register_all()
if not CONF.conductor.use_local:
block_db_access()
objects_base.NovaObject.indirection_api = conductor_rpcapi.ConductorAPI()
else:
LOG.warning(_LW("Conductor local mode is deprecated and will " "be removed in a subsequent release"))
if CONF.action.name in ["add", "del", "old"]:
LOG.debug(
"Called '%(action)s' for mac '%(mac)s' with ip '%(ip)s'",
{"action": CONF.action.name, "mac": CONF.action.mac, "ip": CONF.action.ip},
)
CONF.action.func(CONF.action.mac, CONF.action.ip)
else:
try:
network_id = int(os.environ.get("NETWORK_ID"))
except TypeError:
LOG.error(_LE("Environment variable 'NETWORK_ID' must be set."))
return 1
print(init_leases(network_id))
rpc.cleanup()
开发者ID:jorgevgut,项目名称:nova,代码行数:31,代码来源:dhcpbridge.py
示例17: main
def main():
config.parse_args(sys.argv)
logging.setup("nova")
server = service.Service.create(binary='nova-consoleauth',
topic=CONF.consoleauth_topic)
service.serve(server)
service.wait()
开发者ID:674009287,项目名称:nova,代码行数:7,代码来源:consoleauth.py
示例18: main
def main():
# Setup flags
config.parse_args(sys.argv)
if CONF.ssl_only and not os.path.exists(CONF.cert):
print("SSL only and %s not found." % CONF.cert)
return(-1)
# Check to see if spice html/js/css files are present
if not os.path.exists(CONF.web):
print("Can not find spice html/js/css files at %s." % CONF.web)
return(-1)
gmr.TextGuruMeditation.setup_autorun(version)
# Create and start the NovaWebSockets proxy
server = websocketproxy.NovaWebSocketProxy(
listen_host=CONF.spice.html5proxy_host,
listen_port=CONF.spice.html5proxy_port,
source_is_ipv6=CONF.source_is_ipv6,
verbose=CONF.verbose,
cert=CONF.cert,
key=CONF.key,
ssl_only=CONF.ssl_only,
daemon=CONF.daemon,
record=CONF.record,
web=CONF.web,
target_host='ignore',
target_port='ignore',
wrap_mode='exit',
wrap_cmd=None)
server.start_server()
开发者ID:B-Rich,项目名称:nova-1,代码行数:32,代码来源:spicehtml5proxy.py
示例19: main
def main():
config.parse_args(sys.argv)
logging.setup("nova")
utils.monkey_patch()
server = service.WSGIService("ec2", max_url_len=16384)
service.serve(server, workers=server.workers)
service.wait()
开发者ID:rconradharris,项目名称:nova,代码行数:7,代码来源:api_ec2.py
示例20: main
def main():
# Setup flags
CONF = cfg.CONF
CONF.register_cli_opts(opts)
CONF.import_opt('debug', 'nova.openstack.common.log')
config.parse_args(sys.argv)
if CONF.ssl_only and not os.path.exists(CONF.cert):
print "SSL only and %s not found." % CONF.cert
return(-1)
# Check to see if spice html/js/css files are present
if not os.path.exists(CONF.web):
print "Can not find spice html/js/css files at %s." % CONF.web
return(-1)
# Create and start the NovaWebSockets proxy
server = websocketproxy.NovaWebSocketProxy(
listen_host=CONF.spicehtml5proxy_host,
listen_port=CONF.spicehtml5proxy_port,
source_is_ipv6=CONF.source_is_ipv6,
verbose=CONF.verbose,
cert=CONF.cert,
key=CONF.key,
ssl_only=CONF.ssl_only,
daemon=CONF.daemon,
record=CONF.record,
web=CONF.web,
target_host='ignore',
target_port='ignore',
wrap_mode='exit',
wrap_cmd=None)
server.start_server()
开发者ID:JacobMulero,项目名称:nova,代码行数:34,代码来源:spicehtml5proxy.py
注:本文中的nova.config.parse_args函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论