def __init__(self, sysname, config=None): self.sysname = sysname self.config = config self.dir = DirectoryStandalone(sysname=self.sysname, config=config) self.rr = ResourceRegistryStandalone(sysname=self.sysname, config=config) self._closed = False
def setUp(self): self.dir = DirectoryStandalone(sysname=bootstrap.get_sys_name(), config=bootstrap.CFG) self.rr = ResourceRegistryStandalone(sysname=bootstrap.get_sys_name(), config=bootstrap.CFG) self.iadm = InterfaceAdmin(bootstrap.get_sys_name(), config=bootstrap.CFG) self.addCleanup(self.iadm.close)
def auto_bootstrap_config(bootstrap_config, system_cfg): print "pyon: config: Auto bootstrap CFG into directory" from pyon.core.bootstrap import get_sys_name from pyon.ion.directory_standalone import DirectoryStandalone directory = DirectoryStandalone(sysname=get_sys_name(), config=bootstrap_config) de = directory.lookup("/Config/CFG") if not de: directory.register("/Config", "CFG", **system_cfg.copy())
def apply_remote_config(system_cfg): from pyon.core.bootstrap import get_sys_name from pyon.core.exception import Conflict from pyon.ion.directory_standalone import DirectoryStandalone directory = DirectoryStandalone(sysname=get_sys_name(), config=system_cfg) de = directory.lookup("/Config/CFG") if not de: raise Conflict("Expected /Config/CFG in directory. Correct Org??") apply_configuration(system_cfg, de)
def auto_bootstrap_interfaces(bootstrap_config): print "pyon: config: Auto bootstrap interfaces into directory" from pyon.core.bootstrap import get_sys_name from pyon.ion.directory_standalone import DirectoryStandalone directory = DirectoryStandalone(sysname=get_sys_name(), config=bootstrap_config) de = directory.lookup("/ServiceInterfaces") if not de: _bootstrap_object_defs(directory) _bootstrap_service_defs(directory)
def get_yaml_text(self, path): ''' Get the content of a file or datastore using a path to the data ''' if self.read_from_yaml_file: with open(path, 'r') as f: return f.read() else: self.dir = DirectoryStandalone(sysname=self.system_name) data = self.dir.lookup_by_path(path) # Return the first item for item in data: return (item.value['attributes']['definition']) return ''