Exemple #1
0
        def save_file(self, image, full_path):
                """save a file for later (in same process invocation)
                installation"""

                saved_name = image.temporary_file()
                misc.copyfile(full_path, saved_name)

                image.saved_files[self.attrs["save_file"]] = (self, saved_name)
Exemple #2
0
    def save_file(self, image, full_path):
        """save a file for later (in same process invocation)
                installation"""

        saved_name = image.temporary_file()
        misc.copyfile(full_path, saved_name)

        image.saved_files[self.attrs["save_file"]] = (self, saved_name)
Exemple #3
0
        def save_file(self, image, full_path):
                """Save a file for later installation (in same process
                invocation, if it exists)."""

                saved_name = image.temporary_file()
                try:
                        misc.copyfile(full_path, saved_name)
                except OSError, err:
                        if err.errno != errno.ENOENT:
                                raise

                        # If the file doesn't exist, it can't be saved, so
                        # be certain consumers of this information know there
                        # isn't an original to restore.
                        saved_name = None
    def save_file(self, image, full_path):
        """Save a file for later installation (in same process
                invocation, if it exists)."""

        saved_name = image.temporary_file()
        try:
            misc.copyfile(full_path, saved_name)
        except OSError, err:
            if err.errno != errno.ENOENT:
                raise

            # If the file doesn't exist, it can't be saved, so
            # be certain consumers of this information know there
            # isn't an original to restore.
            saved_name = None
Exemple #5
0
    def restore_file(self, image):
        """restore a previously saved file; return cached action """

        path = self.attrs["path"]

        orig, saved_name = image.saved_files[self.attrs["save_file"]]
        full_path = os.path.normpath(os.path.sep.join(
            (image.get_root(), path)))

        assert (not os.path.exists(full_path))

        misc.copyfile(saved_name, full_path)
        os.unlink(saved_name)

        return orig
Exemple #6
0
    def restore_file(self, image):
        """restore a previously saved file; return cached action """

        ip = image.imageplan
        orig, saved_name = ip.saved_files[self.attrs["save_file"][0]]
        if saved_name is None:
            # Nothing to restore; original file is missing.
            return

        full_path = self.get_installed_path(image.get_root())
        assert not os.path.exists(full_path)

        misc.copyfile(saved_name, full_path)
        os.unlink(saved_name)

        return orig
Exemple #7
0
        def restore_file(self, image):
                """restore a previously saved file; return cached action """


                path = self.attrs["path"]

                orig, saved_name = image.saved_files[self.attrs["save_file"]]
                full_path = os.path.normpath(os.path.sep.join(
                    (image.get_root(), path)))

                assert(not os.path.exists(full_path))

                misc.copyfile(saved_name, full_path)
                os.unlink(saved_name)

                return orig
Exemple #8
0
        def restore_file(self, image):
                """restore a previously saved file; return cached action """

                ip = image.imageplan
                orig, saved_name = ip.saved_files[self.attrs["save_file"]]
                if saved_name is None:
                        # Nothing to restore; original file is missing.
                        return

                path = self.attrs["path"]

                full_path = os.path.normpath(os.path.sep.join(
                    (image.get_root(), path)))

                assert(not os.path.exists(full_path))

                misc.copyfile(saved_name, full_path)
                os.unlink(saved_name)

                return orig
    def restore_file(self, image):
        """restore a previously saved file; return cached action """

        ip = image.imageplan
        orig, saved_name = ip.saved_files[self.attrs["save_file"]]
        if saved_name is None:
            # Nothing to restore; original file is missing.
            return

        path = self.attrs["path"]

        full_path = os.path.normpath(os.path.sep.join(
            (image.get_root(), path)))

        assert (not os.path.exists(full_path))

        misc.copyfile(saved_name, full_path)
        os.unlink(saved_name)

        return orig