def get_package_names_from_bom(self): machine_config = MachineConfig(self.machine_name, "", self.server_home, BDR_CLIENT_TYPE) status = machine_config.merge() if status == FAIL: print " %% Bad config file for %s." % self.machine_name return [] return set(machine_config.data.get("packages", []))
def set_password(self, password): "Set password for configuration item encryption" status, validate_output = self._validate_password(password) if status == OK: self.server_log.info("Setting configuration password.") self.password = password for machine_name in self.machine_interface_pool: machine_config = MachineConfig(machine_name, self.password, self.server_home) machine_config.merge() machine_config.decrypt_config() machine_interface = self.machine_interface_pool[machine_name] self.server_log.info("Decrypting config for %s" % machine_name) machine_interface.set_data(machine_config) output = {"command_status": status, "command_output": validate_output} return output
def get_machine_interface(self, username, machine_name, machine_type): "Returns an interface to a machine, creating a new one if needed" machine_config = MachineConfig(machine_name, self.password, self.server_home, machine_type) if machine_type == LOCAL_TYPE: machine_interface = LocalMachineInterface(machine_config, self.server_log) return machine_interface machine_config.merge() if self.password: machine_config.decrypt_config() machine_interface = None if machine_name in self.machine_interface_pool: msg = "Reusing existing connection to %s" % machine_name self.server_log.info(msg, username) machine_interface = self.machine_interface_pool[machine_name] machine_interface.set_data(machine_config) else: msg = "Instantiating a MachineInterface for %s" % machine_name self.server_log.info(msg, username) machine_interface = BombardierMachineInterface(machine_config, self.server_log) self.machine_interface_pool[machine_name] = machine_interface return machine_interface