def copy_of_datastream(self, new_filename=None): prefixed_name = common.get_prefixed_name("ds_modified") old_filename = self.datastream if not new_filename: descriptor, new_filename = tempfile.mkstemp(prefix=prefixed_name, dir="/tmp") os.close(descriptor) shutil.copy(old_filename, new_filename) self.datastream = new_filename yield new_filename self.datastream = old_filename os.unlink(new_filename)
def _save_state(self, state_name): prefixed_state_name = common.get_prefixed_name(state_name) state = self._create_new_image(self.current_container, prefixed_state_name) return state
def _save_state(self, state_name): prefixed_state_name = common.get_prefixed_name(state_name) state = self.snapshot_stack.create(prefixed_state_name) return state
def save_state(self, state_name): self.running_state_base = common.get_prefixed_name(state_name) running_state = self.running_state return self._save_state(state_name)
def __init__(self, environment, name): self.name = common.get_prefixed_name(name) self.environment = environment self.initial_running_state = True