def load_chute_configuration(update): """ Load and interpret paradrop.yaml file. """ if not update.has_chute_build(): return config = {} workdir = getattr(update, "workdir", None) if workdir is not None: conf_path = os.path.join(workdir, settings.CHUTE_CONFIG_FILE) with open(conf_path, "r") as source: config = yaml.safe_load(source) # Look for additional build information from the update object # and merge with the configuration file. if hasattr(update, "build"): config.update(update.build) # Try to set the owner of the chute. if hasattr(update, "user"): config['owner'] = update.user update.new = build_chute(config)
def test_build_chute(): config = yaml.safe_load(TEST_CHUTE) chute = builder.build_chute(config) assert chute.name == "seccam" services = chute.get_services() assert len(services) == 2 main = chute.get_service("main") assert main.name == "main" assert main.type == "light" assert main.environment["SECCAM_MODE"] == "detect"
def __init__(self, obj): self.change_id = None self.pkg = None # Pull in all the keys from the obj identified self.__dict__.update(obj) # Any module can add notes and warnings here self.responses = [] # In case of a failure, the final message about failure goes here self.failure = None # Each update gets its own plan map self.plans = plan.plangraph.PlanMap(self.name) # Grab a reference to our storage system self.chuteStor = ChuteStorage() # Build new Chute object. self.new = build_chute(obj) # Grab the old version if it exists self.old = self.chuteStor.getChute(self.name) # Save a timestamp from when the update object was created. self.createdTime = time.time() # Set to True if this update is delegated to an external program (e.g. # pdinstall). In that case, the external program will be responsible # for reporting on the completion status of the update. self.delegated = False # Store progress messages so that they can be retrieved by API. self.messages = [] self.message_observers = [] self.completed = False # Cache for passing intermediate values between plan functions. # Previously, this was all done in the chute object, but the # functionality extends to other operations such as a node # configuration change. self.cache = {} # Set by the execute function on the first call and used to detect # whether its new or has been resumed. self.execute_called = False
def load_chute_configuration(update): """ Load and interpret paradrop.yaml file. """ if not update.has_chute_build(): return config = {} workdir = getattr(update, "workdir", None) if workdir is not None: conf_path = os.path.join(workdir, settings.CHUTE_CONFIG_FILE) config = pdosq.read_yaml_file(conf_path, default={}) # Look for additional build information from the update object # and merge with the configuration file. if hasattr(update, "build"): config.update(update.build) # Try to set the owner of the chute. if hasattr(update, "user"): config['owner'] = update.user update.new = build_chute(config)