本文整理汇总了Python中configuration.Configuration.read_config方法的典型用法代码示例。如果您正苦于以下问题:Python Configuration.read_config方法的具体用法?Python Configuration.read_config怎么用?Python Configuration.read_config使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类configuration.Configuration
的用法示例。
在下文中一共展示了Configuration.read_config方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: do_destroy
# 需要导入模块: from configuration import Configuration [as 别名]
# 或者: from configuration.Configuration import read_config [as 别名]
def do_destroy(args):
"""Destroy a droplet based on configuration"""
config = Configuration()
if not config.read_config(args.config_file):
return False
destroy(config)
return True
示例2: do_create
# 需要导入模块: from configuration import Configuration [as 别名]
# 或者: from configuration.Configuration import read_config [as 别名]
def do_create(args):
"""Create a droplet based on configuration"""
config = Configuration()
if not config.read_config(args.config_file):
return False
create(config)
return True
示例3: Configuration
# 需要导入模块: from configuration import Configuration [as 别名]
# 或者: from configuration.Configuration import read_config [as 别名]
for action in actions:
action.wait()
print 'Action {} is {}'.format(action.type, action.status)
# Now get and upate the DNS record -- assumes a single A record, which we
# delete
domains = manager.get_all_domains()
for domain in domains:
if domain.name == config.domain_name:
records = domain.get_records()
for record in records:
if record.type == 'A':
record.destroy()
print 'Destroy of {} complete!'.format(config.domain_name)
return True
if __name__ == '__main__':
# Use argparse, even though just getting on arg for now
parser = argparse.ArgumentParser()
parser.add_argument('config_file', help='configuration file to use')
args = parser.parse_args()
# Read config file
config = Configuration()
if not config.read_config(args.config_file):
sys.exit(1)
destroy(config)
示例4: cleanup
# 需要导入模块: from configuration import Configuration [as 别名]
# 或者: from configuration.Configuration import read_config [as 别名]
# Main loop
@atexit.register
def cleanup():
debug_print("Closing devices and database...")
device_handle.close()
db_cursor.close()
if __name__ == "__main__":
if len(sys.argv) < 2:
sys.exit("Not enough arguments. Usage: %s <configuration file>")
random.seed()
instance_conf.read_config(sys.argv[1])
# Open database
db = MySQLdb.connect(host=instance_conf.db_host, port=instance_conf.db_port, db=instance_conf.db_database, user=instance_conf.db_username, passwd=instance_conf.db_password)
db_cursor = db.cursor()
# Open device
for k, v in instance_conf.devices:
device_arr[k] = (serial.Serial(k), ReadDeviceThread())
device_arr[k][1].set_device_handle(device_handle)
device_arr[k][1].set_data_buffer(data_buffer)
device_arr[k][1].set_data_buffer_lock(data_buffer_lock)
device_arr[k][1].start()
debug_print("Device running in thread: %s" % device_arr[k][1].getName())