本文整理汇总了Python中spoke.lib.config.setup函数的典型用法代码示例。如果您正苦于以下问题:Python setup函数的具体用法?Python setup怎么用?Python setup使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setup函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_config_object_reuse
def test_config_object_reuse(self):
"""Call setup multiple times; parse the config file only once."""
test_config_filename = '/tmp/spoke_test_config_object_reuse.conf'
test_config_file = open(test_config_filename, 'w')
test_config_file.write(self.test_config)
test_config_file.close()
config.gConfig = None
self.config = config.setup(test_config_filename)
os.remove(test_config_filename)
self.config = config.setup()
self.assertTrue(self.config.has_section('testsection1'))
开发者ID:KrisSaxton,项目名称:spoke,代码行数:11,代码来源:test_config.py
示例2: __init__
def __init__(self, org_name):
"""Get config, setup logging and LDAP connection."""
SpokeLDAP.__init__(self)
self.config = config.setup()
self.log = logger.setup(__name__)
self.search_scope = 2 # ldap.SUB
self.retrieve_attr = None
self.org_name = org_name
self.org = self._get_org(self.org_name)
self.org_dn = self.org['data'][0].__getitem__(0)
self.org_attrs = self.org['data'][0].__getitem__(1)
self.org_classes = self.org_attrs['objectClass']
self.container_attr = self.config.get('ATTR_MAP', 'container_attr', 'ou')
self.host_container = self.config.get('HOST', 'host_container', 'hosts')
self.host_container_dn = '%s=%s,%s' % (self.container_attr, \
self.host_container, self.org_dn)
self.host_class = self.config.get('HOST', 'host_class', 'aenetHost')
self.host_key = self.config.get('HOST', 'host_key', 'cn')
self.host_uuid_attr = self.config.get('HOST', 'host_uuid_attr', 'aenetHostUUID')
self.host_name_attr = self.config.get('HOST', 'host_name_attr', 'aenetHostName')
self.host_cpu_attr = self.config.get('HOST', 'host_cpu_attr', 'aenetHostCPU')
self.host_mem_attr = self.config.get('HOST', 'host_mem_attr', 'aenetHostMem')
self.host_extra_opts_attr = self.config.get('HOST',
'host_extra_opts_attr', 'aenetHostExtraOpts')
self.host_family_attr = self.config.get('HOST', 'host_family_attr', 'aenetHostFamily')
self.host_network_layout_attr = self.config.get('HOST',
'host_network_layout_attr', 'aenetHostNetworkLayout')
self.host_storage_layout_attr = self.config.get('HOST',
'host_storage_layout_attr', 'aenetHostStorageLayout')
self.host_type_attr = self.config.get('HOST', 'host_type_attr', 'aenetHostType')
开发者ID:mattmb,项目名称:spoke,代码行数:30,代码来源:host.py
示例3: __init__
def __init__(self, methodName):
"""Setup config data and LDAP connection."""
unittest.TestCase.__init__(self, methodName)
common_config = '../../contrib/spoke.conf'
custom_config = '/tmp/spoke.conf'
config_files = (common_config, custom_config)
self.config = config.setup(config_files)
self.log = logger.log_to_console()
self.base_dn = self.config.get('LDAP', 'basedn')
self.search_scope = 2 # ldap.SCOPE_SUBTREE
self.retrieve_attr = None
self.org_name = 'SpokeListTest'
self.org_attr = self.config.get('ATTR_MAP', 'org_attr')
self.org_def_children = self.config.get('ATTR_MAP', 'org_def_children')
self.org_children = self.org_def_children.split(',')
self.container_attr = self.config.get('ATTR_MAP', 'container_attr')
self.list_container = self.config.get('ATTR_MAP', 'user_container')
self.list_class = self.config.get('ATTR_MAP', 'smtp_class')
self.list_key = self.config.get('ATTR_MAP', 'user_key')
self.list_address_attr = self.config.get('ATTR_MAP', 'smtp_address')
self.list_destination_attr = self.config.get('ATTR_MAP', 'smtp_destination')
self.list_enable_attr = self.config.get('ATTR_MAP', 'smtp_enable')
self.list_pri_address_attr = self.config.get('ATTR_MAP', 'smtp_pri_address')
self.list_address = '[email protected]'
self.list_member = '[email protected]'
开发者ID:KrisSaxton,项目名称:spoke,代码行数:25,代码来源:test_list.py
示例4: __init__
def __init__(self, dhcp_server, group=None, host=None):
"""Get config, setup logging and LDAP connection."""
SpokeLDAP.__init__(self)
self.config = config.setup()
self.log = logger.setup(self.__module__)
self.base_dn = self.config.get('DHCP', 'dhcp_basedn')
self.search_scope = 2 # ldap.SUB
self.retrieve_attr = None
self.dhcp_options_class = 'dhcpOptions'
self.dhcp_service_class = 'dhcpService'
self.dhcp_option_attr = 'dhcpOption'
self.dhcp_conf_suffix = self.config.get('DHCP', 'dhcp_conf_suffix', '-config')
self.dhcp_server = dhcp_server
self.service_name = self.dhcp_server + self.dhcp_conf_suffix
self.dhcp_service = self._get_dhcp_service(self.dhcp_server)
self.dhcp_service_dn = self.dhcp_service['data'][0].__getitem__(0)
self.target_dn = self.dhcp_service_dn
if group is not None:
self.dhcp_group_name = group
self.dhcp_group = self._get_dhcp_group(self.dhcp_server, \
self.dhcp_group_name)
self.dhcp_group_dn = self.dhcp_group['data'][0].__getitem__(0)
self.target_dn = self.dhcp_group_dn
if host is not None:
self.dhcp_host_name = host
self.dhcp_host = self._get_dhcp_host(self.dhcp_server, \
self.dhcp_group_name, self.dhcp_host_name)
self.dhcp_host_dn = self.dhcp_host['data'][0].__getitem__(0)
self.target_dn = self.dhcp_host_dn
开发者ID:mattmb,项目名称:spoke,代码行数:29,代码来源:dhcp.py
示例5: __init__
def __init__(self, methodName):
"""Setup config data and redis connection."""
unittest.TestCase.__init__(self, methodName)
common_config = '../../contrib/spoke.conf'
custom_config = '/tmp/spoke.conf'
config_files = (common_config, custom_config)
self.config = config.setup(config_files)
self.ca_name = 'test-ca'
self.ca_cn = 'Test Certificate Authority'
self.ca_def_duration = self.config.get('CA', 'ca_def_duration')
self.ca_base_dir = self.config.get('CA', 'ca_base_dir')
self.ca_dir = os.path.join(self.ca_base_dir, self.ca_name)
self.ca_key_rdir = self.config.get('CA', 'ca_key_dir')
self.ca_cert_rdir = self.config.get('CA', 'ca_cert_dir')
self.ca_req_rdir = self.config.get('CA', 'ca_req_dir')
self.ca_cert_name = self.config.get('CA', 'ca_pub_cert')
self.ca_key_name = self.config.get('CA', 'ca_priv_key')
self.ca_index_name = self.config.get('CA', 'ca_index')
self.ca_serial_name = self.config.get('CA', 'ca_serial')
self.ca_key_dir = os.path.join(self.ca_dir, self.ca_key_rdir)
self.ca_cert_dir = os.path.join(self.ca_dir, self.ca_cert_rdir)
self.ca_req_dir = os.path.join(self.ca_dir, self.ca_req_rdir)
self.ca_tree = [(self.ca_dir,
[self.ca_cert_rdir, self.ca_key_rdir, self.ca_req_rdir],
[self.ca_serial_name]),
(self.ca_cert_dir, [], [self.ca_cert_name]),
(self.ca_key_dir, [], [self.ca_key_name]),
(self.ca_req_dir, [], [])]
self.ca_key_file = os.path.join(self.ca_key_dir, self.ca_key_name)
self.ca_cert_file = os.path.join(self.ca_cert_dir, self.ca_cert_name)
开发者ID:mattmb,项目名称:spoke,代码行数:30,代码来源:test_ca.py
示例6: __init__
def __init__(self, org_name, user_id):
"""Get config, setup logging and LDAP connection."""
SpokeLDAP.__init__(self)
self.config = config.setup()
self.log = logging.getLogger(__name__)
self.base_dn = self.config.get('LDAP', 'basedn')
self.search_scope = 0 #ldap.SCOPE_BASE
self.org_attr = self.config.get('ATTR_MAP', 'org_attr', 'o')
self.org_def_children = self.config.get('ATTR_MAP', \
'org_def_children', 'people,groups,dns,hosts')
self.org_children = self.org_def_children.split(',')
self.user_login = self.config.get('ATTR_MAP', 'user_login', 'aenetAccountLoginName')
self.user_id = user_id
self.user = self._get_user(org_name, self.user_id)
self.user_dn = self.user['data'][0].__getitem__(0)
self.user_attrs = self.user['data'][0].__getitem__(1)
self.user_classes = self.user_attrs['objectClass']
self.imap_class = self.config.get('ATTR_MAP', 'imap_class', 'aenetCyrus')
self.imap_enable = self.config.get('ATTR_MAP', 'imap_enable', 'aenetCyrusEnabled')
self.imap_mailbox = self.config.get('ATTR_MAP', 'imap_mailbox', 'aenetCyrusMailboxName')
self.imap_domain = self.config.get('ATTR_MAP', 'imap_domain', 'aenetCyrusMailboxDomain')
self.imap_partition = self.config.get('ATTR_MAP', 'imap_partition', 'aenetCyrusMailboxPartition')
self.imap_partition_def = self.config.get('ATTR_MAP', \
'imap_partition_def', 'partition-default')
self.smtp_class = self.config.get('ATTR_MAP', 'smtp_class', 'aenetPostfix')
self.smtp_address = self.config.get('ATTR_MAP', 'smtp_address', 'aenetPostfixEmailAccept')
self.smtp_destination = self.config.get('ATTR_MAP', \
'smtp_destination', 'aenetPostfixEmailDeliver')
self.smtp_enable = self.config.get('ATTR_MAP', 'smtp_enable', 'aenetPostfixEnabled')
self.smtp_pri_address = self.config.get('ATTR_MAP', \
'smtp_pri_address', 'aenetPostfixEmailAddress')
开发者ID:KrisSaxton,项目名称:spoke,代码行数:31,代码来源:email.py
示例7: __init__
def __init__(self, methodName):
"""Setup config data and LDAP connection."""
unittest.TestCase.__init__(self, methodName)
common_config = '../../contrib/spoke.conf'
custom_config = '/tmp/spoke.conf'
config_files = (common_config, custom_config)
self.config = config.setup(config_files)
self.log = logger.log_to_console()
self.org_name = 'SpokeOrgTest'
self.base_dn = self.config.get('DHCP', 'dhcp_basedn')
self.search_scope = 2 # ldap.SUB
self.retrieve_attr = None
self.dhcp_server_class = 'dhcpServer'
self.dhcp_service_class = 'dhcpService'
self.dhcp_subnet_class = 'dhcpSubnet'
self.dhcp_options_class = 'dhcpOptions'
self.dhcp_group_class = 'dhcpGroup'
self.dhcp_host_class = 'dhcpHost'
self.dhcp_option_attr = 'dhcpOption'
self.dhcp_statement_attr = 'dhcpStatement'
self.dhcp_mac_attr = 'dhcpHWAddress'
self.dhcp_conf_suffix = self.config.get('DHCP', 'dhcp_conf_suffix')
self.dhcp_server = 'test.dhcp.server.local'
self.dhcp_group = 'testgroup'
self.dhcp_host = 'testhost'
开发者ID:KrisSaxton,项目名称:spoke,代码行数:25,代码来源:test_dhcp.py
示例8: __init__
def __init__(self):
"""Bind to LDAP directory, return an ldap object."""
self.config = config.setup()
self.log = logger.setup(__name__)
self.search_scope = ldap.SCOPE_SUBTREE #(2)
self.server = self.config.get('LDAP', 'server')
self.port = self.config.get('LDAP', 'port', '389')
self.bind_dn = self.config.get('LDAP', 'binddn')
self.start_tls = self.config.get('LDAP', 'start_tls', False)
self.bind_password = self.config.get('LDAP', 'bindpw')
try:
self.LDAP = ldap.initialize('ldap://%s:%s' %
(self.server, self.port))
self.LDAP.protocol_version = 3 #ldap.VERSION3
if self.start_tls:
self.LDAP.start_tls_s()
self.LDAP.simple_bind_s(self.bind_dn, self.bind_password)
self.log.debug('Bound to LDAP server %s:%s as %s' %
(self.server, self.port, self.bind_dn))
except ldap.LDAPError:
trace = traceback.format_exc()
msg = 'Failed to bind to LDAP server %s:%s as %s' % \
(self.server,self.port, self.bind_dn)
raise error.SpokeLDAPError(msg, trace)
except Exception:
trace = traceback.format_exc()
msg = 'Unknown error'
raise error.SpokeError(msg, trace)
开发者ID:mattmb,项目名称:spoke,代码行数:28,代码来源:directory.py
示例9: __init__
def __init__(self, methodName):
"""Setup config data and LDAP connection."""
unittest.TestCase.__init__(self, methodName)
common_config = '../../contrib/spoke.conf'
custom_config = '/tmp/spoke.conf'
config_files = (common_config, custom_config)
self.config = config.setup(config_files)
self.log = logger.log_to_console()
self.base_dn = self.config.get('LDAP', 'basedn')
self.search_scope = 2 # ldap.SUB
self.retrieve_attr = None
self.container_attr = self.config.get('ATTR_MAP', 'container_attr')
self.org_name = 'SpokeOrgPwdTest'
self.org_attr = self.config.get('ATTR_MAP', 'org_attr')
self.org_def_children = self.config.get('ATTR_MAP', 'org_def_children')
self.org_children = self.org_def_children.split(',')
self.user_container = self.config.get('ATTR_MAP', 'user_container')
self.user_key = self.config.get('ATTR_MAP', 'user_key')
self.user_login = self.config.get('ATTR_MAP', 'user_login')
self.user_class = self.config.get('ATTR_MAP', 'user_class')
self.user_name = self.config.get('ATTR_MAP', 'user_name')
self.user_enable = self.config.get('ATTR_MAP', 'user_enable')
self.user_def_pwd = self.config.get('ATTR_MAP', 'user_def_pwd')
self.first = 'peter'
self.last = 'password'
self.user_id = self.first + self.last
self.email_dom = 'test.user.loc'
self.email_addr = self.user_id + '@' + self.email_dom
开发者ID:KrisSaxton,项目名称:spoke,代码行数:28,代码来源:test_password.py
示例10: __init__
def __init__(self, methodName):
"""Setup config data and LDAP connection."""
unittest.TestCase.__init__(self, methodName)
common_config = '../../contrib/spoke.conf'
custom_config = '/tmp/spoke.conf'
config_files = (common_config, custom_config)
self.config = config.setup(config_files)
self.base_dn = self.config.get('LDAP', 'basedn')
self.search_scope = 2 # ldap.SCOPE_SUBTREE
self.retrieve_attr = None
self.org_name = 'SpokeUserTest'
self.org_attr = self.config.get('ATTR_MAP', 'org_attr')
self.org_def_children = self.config.get('ATTR_MAP', 'org_def_children')
self.org_children = self.org_def_children.split(',')
self.container_attr = self.config.get('ATTR_MAP', 'container_attr')
self.user_container = self.config.get('ATTR_MAP', 'user_container')
self.user_key = self.config.get('ATTR_MAP', 'user_key')
self.user_login = self.config.get('ATTR_MAP', 'user_login')
self.user_class = self.config.get('ATTR_MAP', 'user_class')
self.user_name = self.config.get('ATTR_MAP', 'user_name')
self.user_enable = self.config.get('ATTR_MAP', 'user_enable')
self.first = 'timmy'
self.last = 'test'
self.user_id = self.first
self.email_dom = 'test.user.loc'
self.email_addr = self.user_id + '@' + self.email_dom
self.org_dn = '%s=%s,%s' % (self.org_attr, self.org_name, self.base_dn)
self.user_container_dn = '%s=%s,%s' % (self.container_attr, \
self.user_container, self.org_dn)
开发者ID:mattmb,项目名称:spoke,代码行数:29,代码来源:test_user.py
示例11: __init__
def __init__(self, ca_name):
"""Get config, setup logging."""
self.config = config.setup()
self.log = logger.log_to_console()
self.ca_name = common.is_shell_safe(ca_name)
self.ca_base_dir = self.config.get('CA', 'ca_base_dir')
self.ca_dir = os.path.join(self.ca_base_dir, self.ca_name)
self.ca_key_rdir = self.config.get('CA', 'ca_key_dir', 'private')
self.ca_cert_rdir = self.config.get('CA', 'ca_cert_dir', 'certs')
self.ca_req_rdir = self.config.get('CA', 'ca_req_dir', 'reqs')
self.ca_cert_name = self.config.get('CA', 'ca_pub_cert', 'ca-cert.pem')
self.ca_bundle_name = self.config.get('CA', 'ca_bundle', 'ca-bundle.pem')
self.ca_req_name = self.config.get('CA', 'ca_req', 'ca-req.pem')
self.ca_key_name = self.config.get('CA', 'ca_priv_key', 'ca-key.pem')
self.ca_index_name = self.config.get('CA', 'ca_index', 'index')
self.ca_serial_name = self.config.get('CA', 'ca_serial', 'serial')
self.ca_cert_dir = os.path.join(self.ca_dir, self.ca_cert_rdir)
self.ca_key_dir = os.path.join(self.ca_dir, self.ca_key_rdir)
self.ca_req_dir = os.path.join(self.ca_dir, self.ca_req_rdir)
self.ca_cert_file = os.path.join(self.ca_cert_dir, self.ca_cert_name)
self.ca_bundle_file = os.path.join(self.ca_base_dir,
self.ca_bundle_name)
self.ca_key_file = os.path.join(self.ca_key_dir, self.ca_key_name)
self.ca_req_file = os.path.join(self.ca_req_dir, self.ca_req_name)
self.ca_index_file = os.path.join(self.ca_cert_dir, self.ca_index_name)
self.ca_serial_file = os.path.join(self.ca_dir, self.ca_serial_name)
self.ca_key = os.path.join(self.ca_key_dir, self.ca_key_file)
self.ca_cert = os.path.join(self.ca_cert_dir, self.ca_cert_file)
self.req_dirs = [ self.ca_base_dir, self.ca_dir, self.ca_key_dir,
self.ca_req_dir, self.ca_cert_dir ]
self.req_files = [ self.ca_index_file, self.ca_serial_file,
self.ca_key_file, self.ca_cert_file ]
try:
ca_cert = X509.load_cert(self.ca_cert_file, format=1)
self.ca_cn = ca_cert.get_subject().CN
self.ca_cert_as_pem = ca_cert.as_pem()
except:
msg = 'CA cert file %s does not exist' % self.ca_cert_file
self.log.debug(msg)
self.ca_country = self.config.get('CA', 'ca_country', 'GB')
try:
self.ca_state = self.config.get('CA', 'ca_state')
except:
self.ca_state = None
self.ca_locality = self.config.get('CA', 'ca_locality', 'London')
self.ca_org = self.config.get('CA', 'ca_org', 'Acme Ltd')
self.ca_ou = self.config.get('CA', 'ca_ou', 'Certificate Services')
self.ca_email = self.config.get('CA', 'ca_email', '[email protected]')
self.ca_def_duration = self.config.get('CA', 'ca_def_duration', 1095)
self.ca_keypass = self.config.get('CA', 'ca_keypass', '')
# Try to get some more info from req/cert files if they are present
self.ca_info = self._get_ca_info()
try:
self.ca_cn = self.ca_info['ca_cn']
except:pass
try:
self.ca_cert_as_pem = self.ca_info['ca_cert_as_pem']
except:pass
开发者ID:KrisSaxton,项目名称:spoke,代码行数:60,代码来源:ca.py
示例12: __init__
def __init__(self, vg_name=None):
"""Get config, setup logging."""
self.config = config.setup()
self.log = logging.getLogger(__name__)
if not vg_name:
vg_name = self.config.get('LVM', 'lv_def_vg_name')
self.vg_name = common.is_shell_safe(vg_name)
self.lv_units = self.config.get('LVM', 'lv_units', 'g')
开发者ID:KrisSaxton,项目名称:spoke,代码行数:8,代码来源:lvm.py
示例13: __init__
def __init__(self, vm_name):
"""Get config and setup logging."""
self.config = config.setup()
self.log = logging.getLogger(__name__)
def _error_handler(self, err):
msg = "Ignoring Libvirt error %s)" % err
pass
# Prevent libvirt errors from reaching the console
libvirt.registerErrorHandler(_error_handler, None)
开发者ID:KrisSaxton,项目名称:spoke,代码行数:9,代码来源:vm_power.py
示例14: __init__
def __init__(self, methodName):
"""Setup config data and redis connection."""
unittest.TestCase.__init__(self, methodName)
common_config = '../../contrib/spoke.conf'
custom_config = '/tmp/spoke.conf'
config_files = (common_config, custom_config)
self.config = config.setup(config_files)
self.subnet = '192.168.1.0'
self.mask = 24
self.ip_ldap_key = self.config.get('IP', 'ip_ldap_key')
开发者ID:mattmb,项目名称:spoke,代码行数:10,代码来源:test_ip.py
示例15: __init__
def __init__(self, methodName):
"""Setup config data and Cyrus connection."""
unittest.TestCase.__init__(self, methodName)
common_config = '../../contrib/spoke.conf'
custom_config = '/tmp/spoke.conf'
config_files = (common_config, custom_config)
self.config = config.setup(config_files)
self.user = self.config.get('IMAP', 'user')
self.sep = '/'
self.mbx_name = '[email protected]'
开发者ID:mattmb,项目名称:spoke,代码行数:10,代码来源:test_mbx.py
示例16: test_write_read_log_message
def test_write_read_log_message(self):
"""Write message to log file; read it back."""
logger.gLog = None
self.config = config.setup(self.test_config_filename)
self.log = logger.setup(self.__module__)
test_phrase = 'This is a Spoke logger test'
self.log.critical(test_phrase)
lf = open(self.test_log_filename, 'r')
lines = lf.readlines()
lf.close()
res = lines[-1].find(test_phrase)
self.assert_(res > -1)
开发者ID:mattmb,项目名称:spoke,代码行数:12,代码来源:test_logger.py
示例17: __init__
def __init__(self, methodName):
"""Setup config data."""
unittest.TestCase.__init__(self, methodName)
common_config = '../../contrib/spoke.conf'
custom_config = '/tmp/spoke.conf'
config_files = (common_config, custom_config)
self.config = config.setup(config_files)
self.tftp_root = self.config.get('TFTP', 'tftp_root')
self.tftp_conf_dir = self.config.get('TFTP', 'tftp_conf_dir')
self.tftp_mac_prefix = self.config.get('TFTP', 'tftp_mac_prefix')
self.mac = '00:0C:29:57:3B:31'
self.template = 'testfile.template'
self.run_id = 23123132
self.tftp_dir = self.tftp_root + "/" + self.tftp_conf_dir + "/"
开发者ID:mattmb,项目名称:spoke,代码行数:14,代码来源:test_tftp.py
示例18: __init__
def __init__(self, methodName):
"""Setup config data and LDAP connection."""
unittest.TestCase.__init__(self, methodName)
common_config = '../../contrib/spoke.conf'
custom_config = '/tmp/spoke.conf'
config_files = (common_config, custom_config)
self.config = config.setup(config_files)
self.log = logger.log_to_console()
self.base_dn = self.config.get('LDAP', 'basedn')
self.search_scope = 2 # ldap.SCOPE_SUBTREE
self.retrieve_attr = None
self.org_name = 'spokehosttest'
self.org_attr = self.config.get('ATTR_MAP', 'org_attr')
self.org_def_children = self.config.get('ATTR_MAP', 'org_def_children')
self.org_children = self.org_def_children.split(',')
self.org_dn = '%s=%s,%s' % (self.org_attr, self.org_name, self.base_dn)
self.container_attr = self.config.get('ATTR_MAP', 'container_attr')
self.host_container = self.config.get('HOST', 'host_container')
self.host_container_dn = '%s=%s,%s' % (self.container_attr, \
self.host_container, self.org_dn)
self.host_class = self.config.get('HOST', 'host_class')
self.host_key = self.config.get('HOST', 'host_key')
self.host_uuid_attr = self.config.get('HOST', 'host_uuid_attr')
self.host_name_attr = self.config.get('HOST', 'host_name_attr')
self.host_cpu_attr = self.config.get('HOST', 'host_cpu_attr')
self.host_mem_attr = self.config.get('HOST', 'host_mem_attr')
self.host_extra_opts_attr = self.config.get('HOST',
'host_extra_opts_attr')
self.host_family_attr = self.config.get('HOST', 'host_family_attr')
self.host_network_layout_attr = self.config.get('HOST',
'host_network_layout_attr')
self.host_storage_layout_attr = self.config.get('HOST',
'host_storage_layout_attr')
self.host_type_attr = self.config.get('HOST', 'host_type_attr')
self.next_uuid_attr = self.config.get('UUID', 'next_uuid_attr')
self.next_uuid_dn = self.config.get('UUID', 'next_uuid_dn')
self.next_uuid_start = self.config.get('UUID', 'next_uuid_start')
self.host_name = 'testhost'
self.host_uuid = '1'
self.host_mem = '256'
self.host_mem_kb = '%s' % (int(self.host_mem)*1024)
self.host_cpu = '1'
self.host_extra_opts = 'test'
self.host_family = 'xen'
self.host_storage_layout = 'basic'
self.host_network_layout = 'with_internet'
self.host_type = 'full'
开发者ID:KrisSaxton,项目名称:spoke,代码行数:50,代码来源:test_host.py
示例19: __init__
def __init__(self, methodName):
"""Define test config data, write, parse and return config object."""
unittest.TestCase.__init__(self, methodName)
self.test_log_filename = '/tmp/spoke-test.log'
test_config = '''
[LOGGING]
log_filename = /tmp/spoke-test.log
log_level = debug
'''
self.test_config_filename = '/tmp/spoke_test_logger.conf'
test_config_file = open(self.test_config_filename, 'w')
test_config_file.write(test_config)
test_config_file.close()
self.config = config.setup(self.test_config_filename)
开发者ID:mattmb,项目名称:spoke,代码行数:14,代码来源:test_logger.py
示例20: __init__
def __init__(self):
"""Get config and setup loggings."""
self.config = config.setup()
self.log = logging.getLogger(__name__)
#This block gets interface and interface type from config file
self._lookupInterfaces()
#And this one does the same for disks.
self._lookupDisks()
self.search_headers = self.config.get('VM', 'search_headers', 'name,uuid')
self.headers = self.search_headers.split(',')
def _error_handler(self, err):
msg = "Ignoring Libvirt error %s)" % err
pass
# Prevent libvirt errors from reaching the console
libvirt.registerErrorHandler(_error_handler, None)
开发者ID:KrisSaxton,项目名称:spoke,代码行数:15,代码来源:vm_storage.py
注:本文中的spoke.lib.config.setup函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论