Пример #1
0
 def read_data_from_yaml(self):
     """
     read mac address and bmc configuration information from **mac.yaml** file.
     """
     data = read_yaml_config(self.yaml_file)
     result = None
     if data:
         result = {}
         data = data["inventory"]
         for cluster in data:
             cluster_data = data[cluster]
             if "bmc" in cluster_data and "common" in cluster_data["bmc"]:
                 # process the common bmc data in cluster
                 common_bmc_data = cluster_data["bmc"]["common"]
                 host_range = common_bmc_data.pop("range", None)
                 hosts = expand_hostlist(host_range)
             mac_data = cluster_data["macaddr"]
             for host in mac_data:
                 if host in hosts:
                     temp_common_bmc_data = deepcopy(common_bmc_data)
                     if "bmc" in mac_data[host]:
                         # bmc config in individual host have a high
                         # priority than common config
                         temp_common_bmc_data.update(mac_data[host]["bmc"])
                     mac_data[host]["bmc"] = temp_common_bmc_data
             result[cluster] = mac_data
     return result
Пример #2
0
 def read_data_from_yaml(self):
     """
     read mac address and bmc configuration information from **mac.yaml** file.
     """
     data = read_yaml_config(self.yaml_file)
     result = None
     if data:
         result = {}
         data = data["inventory"]
         for cluster in data:
             cluster_data = data[cluster]
             if "bmc" in cluster_data and "common" in cluster_data["bmc"]:
                 # process the common bmc data in cluster
                 common_bmc_data = cluster_data["bmc"]["common"]
                 host_range = common_bmc_data.pop("range", None)
                 hosts = expand_hostlist(host_range)
             mac_data = cluster_data["macaddr"]
             for host in mac_data:
                 if host in hosts:
                     temp_common_bmc_data = deepcopy(common_bmc_data)
                     if "bmc" in mac_data[host]:
                         # bmc config in individual host have a high
                         # priority than common config
                         temp_common_bmc_data.update(mac_data[host]["bmc"])
                     mac_data[host]["bmc"] = temp_common_bmc_data
             result[cluster] = mac_data
     return result
Пример #3
0
 def config(self, filename=None):
     '''
     reads from the specified yaml file the server configuration
     :param filename: name of the yaml file
     '''
     self.configuration = read_yaml_config(inventory_config_filename, check=False)
     if self.configuration is None:
        self.configuration = {'dbname': "inventory"}
 def config(self, filename=None):
     '''
     reads from the specified yaml file the server configuration
     :param filename: name of the yaml file
     '''
     self.configuration = read_yaml_config(inventory_config_filename,
                                           check=False)
     if self.configuration is None:
         self.configuration = {'dbname': "inventory"}
Пример #5
0
 def load(self, filename):
     self._set_filename(filename)
     #d = OrderedDict(read_yaml_config(self['location'], check=True))
     d = read_yaml_config(self['location'], check=True)
     self.update(d)
    def __init__(self):
        """read config"""
        BaremetalProvisinerABC.__init__(self)

        self.filename = config_file("/cloudmesh_server.yaml")
        self.teefaa_config = read_yaml_config (self.filename, check=True)
Пример #7
0
 def load(self, filename):
     self._set_filename(filename)
     #d = OrderedDict(read_yaml_config(self['location'], check=True))
     d = read_yaml_config(self['location'], check=True)
     self.update(d)