Exemplo n.º 1
0
    def test_cpio_non_default_args_set(self):
        '''Test copying a list of directories and files succeeds'''
        # Copy all the directories and files from /etc/X11 and /etc/zones
        # to /rpool/cpio_test_dir using a list for the contents

        # Set up the source
        src = Source()
        path = Dir(self.TEST_SRC_DIR)
        src.insert_children([path])

        # Set up the destination
        dst = Destination()
        path = Dir(self.TEST_DST_DIR)
        dst.insert_children([path])

        args = Args({"cpio_args": "-n -d -pdum"})
        self.tr_node.insert_children([args])

        # Insert the source and dest into the Software node
        self.soft_node.insert_children([src, dst])

        self.TEST_CONTENTS_LIST.append("bin/xclock")
        self.TEST_CONTENTS_LIST.append("bin/pv.sh")

        # The CPIO values that are specified
        self.TEST_CONTENTS_LIST.append("etc/X11")
        self.TEST_CONTENTS_LIST.append("etc/zones")
        self.tr_node.action = "install"
        self.tr_node.contents = self.TEST_CONTENTS_LIST

        try:
            self.tr_cpio.execute(dry_run=True)
        except Exception as err:
            self.fail(str(err))
Exemplo n.º 2
0
    def test_cpio_w_file_list(self):
        '''Test copy from a list succeeds'''
        # Copy /bin/xclock and /bin/pv.sh to /rpool/cpio_test_dir
        # using a file list as the contents source

        # Set up the source
        src = Source()
        path = Dir(self.TEST_SRC_DIR)
        src.insert_children([path])

        # Set up the destination
        dst = Destination()
        path = Dir(self.TEST_DST_DIR)
        dst.insert_children([path])

        # Insert the source and dest into the Software node
        self.soft_node.insert_children([src, dst])

        # The CPIO values that are specified
        self.TEST_CONTENTS_LIST.append("bin/xclock")
        self.TEST_CONTENTS_LIST.append("bin/pv.sh")

        self.tr_node.action = "install"
        self.tr_node.contents = self.TEST_CONTENTS_LIST

        try:
            self.tr_cpio.execute(dry_run=True)
        except Exception as err:
            self.fail(str(err))
Exemplo n.º 3
0
    def test_cpio_w_dir_list_file(self):
        '''Test directory cpio copy succeeds'''
        # Copy all the directories and files from /etc/X11 and /etc/zones
        # to /rpool/cpio_test_dir using a file for the contents

        # Set up the source
        src = Source()
        path = Dir(self.TEST_SRC_DIR)
        src.insert_children([path])

        # Set up the destination
        dst = Destination()
        path = Dir(self.TEST_DST_DIR)
        dst.insert_children([path])

        # Insert the source and dest into the Software node
        self.soft_node.insert_children([src, dst])

        # The CPIO values that are specified
        self.tr_node.action = "install"
        self.tr_node.contents = self.TEST_DIR_LIST_FILE
        with open(self.TEST_DIR_LIST_FILE, 'w') as filehandle:
            filehandle.write("etc/X11" + "\n")
            filehandle.write("etc/zones" + "\n")

        try:
            self.tr_cpio.execute(dry_run=True)
        except Exception as err:
            self.fail(str(err))
Exemplo n.º 4
0
    def test_cleanup_temp_files(self):
        '''Test the cleanup of the temporary files'''
        # Set up the source
        src = Source()
        src_path = os.path.join(self.TEST_SRC_DIR, "etc/X11")
        path = Dir(src_path)
        src.insert_children([path])

        # Set up the destination
        dst = Destination()
        path = Dir(self.TEST_DST_DIR)
        dst.insert_children([path])

        # Insert the source and dest into the Software node
        self.soft_node.insert_children([src, dst])

        # The CPIO values that are specified
        self.tr_node.action = "install"
        self.tr_node.contents = ["./"]

        self.tr_cpio._parse_input()
        try:
            self.tr_cpio._cleanup_tmp_files()
        except Exception as err:
            self.fail(str(err))
Exemplo n.º 5
0
    def test_media_transform(self):
        '''Test media transform functionality'''
        src = Source()
        src_path = os.path.join(self.TEST_SRC_DIR, "etc/X11")
        path = Dir(src_path)
        src.insert_children([path])

        dst = Destination()
        path = Dir(self.TEST_DST_DIR)
        dst.insert_children([path])

        self.soft_node.insert_children([src, dst])

        # The CPIO values that are specified
        self.tr_node.action = "transform"
        self.tr_node.contents = self.TEST_MEDIA_TRANSFORM
        with open(self.TEST_MEDIA_TRANSFORM, 'w') as filehandle:
            filehandle.write("#!/usr/bin/python\n")
            filehandle.write("import os\n")
            mkdir_cmd = "os.mkdir('" + self.TEST_DST_DIR + "')"
            filehandle.write(mkdir_cmd + "\n")
            mkdir_cmd = "os.mkdir('" + os.path.join(self.TEST_DST_DIR,
                                                    "media") + "')"
            filehandle.write(mkdir_cmd)
        os.chmod(self.TEST_MEDIA_TRANSFORM, 0777)
        try:
            self.tr_cpio.execute(dry_run=True)
        except Exception as err:
            self.fail(str(err))
Exemplo n.º 6
0
    def test_progress_estimate_with_size(self):
        '''Test progress estimate value when size is pre-calculated  exists
        '''
        src = Source()
        src_path = os.path.join(self.TEST_SRC_DIR, "etc")
        path = Dir(src_path)
        src.insert_children([path])

        dst = Destination()
        path = Dir(self.TEST_DST_DIR)
        dst.insert_children([path])

        self.soft_node.insert_children([src, dst])

        # The CPIO values that are specified
        self.tr_node.action = "install"
        self.tr_node.contents = ["./"]
        size_to_transfer = dir_size(src_path)
        self.tr_node.size = str(size_to_transfer)

        progress_estimate = self.tr_cpio.get_progress_estimate()
        expect_estimate = \
            int((float(size_to_transfer / 1024) / self.tr_cpio.DEFAULT_SIZE) \
                * self.tr_cpio.DEFAULT_PROG_EST)

        self.assertEqual(progress_estimate, expect_estimate)
Exemplo n.º 7
0
    def test_cpio_w_file_list_file(self):
        '''Test copy of a file list file succeeds'''
        # Copy /bin/xclock and /bin/pv.sh to /rpool/cpio_test_dir
        # using a file list file as the contents souce

        # Set up the source
        src = Source()
        path = Dir(self.TEST_SRC_DIR)
        src.insert_children([path])

        # Set up the destination
        dst = Destination()
        path = Dir(self.TEST_DST_DIR)
        dst.insert_children([path])

        # Insert the source and dest into the Software node
        self.soft_node.insert_children([src, dst])

        # The CPIO values that are specified
        self.tr_node.action = "install"
        self.tr_node.contents = self.TEST_FILE_LIST_FILE
        with open(self.TEST_FILE_LIST_FILE, 'w') as filehandle:
            filehandle.write("bin/xclock" + "\n")
            filehandle.write("bin/pv.sh" + "\n")

        try:
            self.tr_cpio.execute(dry_run=True)
        except Exception as err:
            self.fail(str(err))
Exemplo n.º 8
0
    def test_more_than_one_dst(self):
        '''Test error with more than one dst directory
        '''
        dst = Destination()
        path = Dir("/hello")
        dst.insert_children([path])

        dst2 = Destination()
        path = Dir(self.TEST_DST_DIR)
        dst2.insert_children([path])

        self.soft_node.insert_children([dst, dst2])
        self.assertRaises(Exception, self.tr_svr4.execute, dry_run=True)
Exemplo n.º 9
0
    def test_src_not_exist(self):
        ''' Test that an error is raised when src doesn't exist.'''

        #Set up the source
        src = Source()
        path = Dir("/hello")
        src.insert_children([path])

        dst = Destination()
        path = Dir(self.TEST_DST_DIR)
        dst.insert_children([path])

        self.soft_node.insert_children([src, dst])
        self.assertRaises(Exception, self.tr_cpio.execute, dry_run=True)
Exemplo n.º 10
0
    def test_valid_transfer_action(self):
        '''Test valid input with dry run.
        '''
        self.tr_node2 = SVR4Spec()
        self.tr_node2.action = "uninstall"
        self.tr_node2.contents = ["SUNWpkg1", "SUNWpkg2"]
        self.soft_node.insert_children([self.tr_node2])
        args2 = Args({"svr4_args": "-n -R %s" % (self.TEST_DST_DIR)})
        self.tr_node2.insert_children([args2])

        src = Source()
        pub = Publisher()
        origin = Origin(self.TEST_SRC_DIR)
        pub.insert_children([origin])
        src.insert_children([pub])

        dst = Destination()
        path = Dir(self.TEST_DST_DIR)
        dst.insert_children([path])
        self.soft_node.insert_children([src, dst])

        self.tr_node.action = "install"
        self.tr_node.contents = ["SUNWpkg1", "SUNWpkg2"]

        self.tr_node3 = SVR4Spec()
        self.tr_node3.action = "transform"
        self.tr_node3.contents = ["SUNWpkg1", "SUNWpkg2"]
        self.soft_node.insert_children([self.tr_node3])

        self.assertRaises(Exception, self.tr_svr4.execute, dry_run=True)
Exemplo n.º 11
0
    def test_dry_run_transfer(self):
        '''Test with accurate input dry run succeeds
        '''
        self.tr_node2 = SVR4Spec()
        self.tr_node2.action = "install"
        self.tr_node2.contents = ["SUNWpkg1", "SUNWpkg2"]
        self.soft_node.insert_children([self.tr_node2])
        args2 = Args({"svr4_args": "-n -R %s" % (self.TEST_DST_DIR)})
        self.tr_node2.insert_children([args2])

        src = Source()
        pub = Publisher()
        origin = Origin(self.TEST_SRC_DIR)
        pub.insert_children([origin])
        src.insert_children([pub])

        dst = Destination()
        path = Dir(self.TEST_DST_DIR)
        dst.insert_children([path])
        self.soft_node.insert_children([src, dst])

        self.tr_node.action = "install"
        self.tr_node.contents = ["SUNWpkg1", "SUNWpkg2"]

        try:
            self.tr_svr4.execute(dry_run=True)
        except Exception as err:
            self.fail(str(err))
Exemplo n.º 12
0
    def test_install_uninstall_dry_run(self):
        '''Test an install followed by an uninstall'''
        self.tr_node.action = "install"
        self.tr_node.contents = ["SUNWpkg1", "SUNWpkg2", "SUNWpkg3"]
        args = Args({"svr4_args": "-n -R %s" % (self.TEST_DST_DIR)})
        self.tr_node.insert_children([args])
        self.tr_node2 = SVR4Spec()
        self.tr_node2.action = "uninstall"
        self.tr_node2.contents = ["SUNWpkg2"]
        self.soft_node.insert_children([self.tr_node2])

        src = Source()
        pub = Publisher()
        origin = Origin(self.TEST_SRC_DIR)
        pub.insert_children([origin])
        src.insert_children([pub])

        dst = Destination()
        path = Dir(self.TEST_DST_DIR)
        dst.insert_children([path])
        self.soft_node.insert_children([src, dst])

        try:
            self.tr_svr4.execute(dry_run=True)
        except Exception as err:
            self.fail(str(err))
Exemplo n.º 13
0
    def test_single_args_instance(self):
        '''Test pass when single instance of args provided
        '''
        mysrc = "srcdir"
        mydest = "destfile"
        args = Args({"svr4_args": "-n -d %s -R %s" % (mysrc, mydest)})
        self.tr_node.insert_children([args])

        src = Source()
        pub = Publisher()
        origin = Origin(self.TEST_SRC_DIR)
        pub.insert_children([origin])
        src.insert_children([pub])

        dst = Destination()
        path = Dir(self.TEST_DST_DIR)
        dst.insert_children([path])
        self.soft_node.insert_children([src, dst])
        self.tr_node.action = "install"
        self.tr_node.contents = ["SUNWpkg1"]

        try:
            self.tr_svr4.execute(dry_run=True)
        except Exception as err:
            self.fail(str(err))
Exemplo n.º 14
0
 def test_get_size(self):
     '''Test that get_size returns an error when no source is set'''
     dst = Destination()
     path = Dir(self.TEST_DST_DIR)
     dst.insert_children([path])
     self.soft_node.insert_children([dst])
     self.assertRaises(IndexError, self.tr_cpio.get_size)
Exemplo n.º 15
0
    def test_dir_excl_list_not_valid(self):
        '''Test that an error is raised for invalid dir_excl_list'''
        src = Source()
        src_path = os.path.join(self.TEST_SRC_DIR, "etc/X11")
        path = Dir(src_path)
        src.insert_children([path])

        dst = Destination()
        path = Dir(self.TEST_DST_DIR)
        dst.insert_children([path])

        self.soft_node.insert_children([src, dst])

        # The CPIO values that are specified
        self.tr_node.action = "uninstall"
        self.tr_node.contents = "/tmp/invalid_dir_file"
        self.assertRaises(Exception, self.tr_cpio.execute, dry_run=True)
Exemplo n.º 16
0
    def test_dst_not_specified(self):
        ''' Test that an error is raised when dst is not specified'''
        # Test that an error is raised.
        src = Source()
        src_path = os.path.join(self.TEST_SRC_DIR, "etc/X11")
        path = Dir(src_path)
        src.insert_children([path])

        self.soft_node.insert_children([src])
        self.assertRaises(Exception, self.tr_cpio.execute, dry_run=True)
Exemplo n.º 17
0
    def test_cpio_no_contents(self):
        ''' Test that an error is raised when no contents exist'''
        # Set up the source
        src = Source()
        path = Dir(self.TEST_SRC_DIR)
        src.insert_children([path])

        # Set up the destination
        dst = Destination()
        path = Dir(self.TEST_DST_DIR)
        dst.insert_children([path])

        # Insert the source and dest into the Software node
        self.soft_node.insert_children([src, dst])

        # The CPIO values that are specified - no contents
        self.tr_node.action = "install"

        self.assertRaises(Exception, self.tr_cpio.execute, dry_run=True)
Exemplo n.º 18
0
    def test_src_not_specified(self):
        ''' Test that an error is raised when src is not specified'''
        # Test that an error is raised.
        dst = Destination()
        dst_path = self.TEST_DST_DIR
        path = Dir(dst_path)
        dst.insert_children([path])

        self.soft_node.insert_children([dst])
        self.assertRaises(Exception, self.tr_cpio.execute, dry_run=True)
Exemplo n.º 19
0
    def test_dir_excl_list_file(self):
        '''Test the success of using directory exclusion'''
        # Copy all files/dirs from /etc/xdg except for anything under
        # /etc/xdg/menus to /rpool/cpio_test_dir using a file to
        # specify the contents

        # Set up the Source
        src = Source()
        path = Dir(self.TEST_SRC_DIR)
        src.insert_children([path])

        # Set up the destination
        dst = Destination()
        path = Dir(self.TEST_DST_DIR)
        dst.insert_children([path])

        # Insert the source and dest into the Software node
        self.soft_node.insert_children([src, dst])

        # The CPIO values that are specified
        self.tr_node.action = "install"
        self.tr_node.contents = self.TEST_DIR_LIST_FILE

        # Populate the dir list file
        with open(self.TEST_DIR_LIST_FILE, 'w') as filehandle:
            filehandle.write("etc/xdg" + "\n")

        # Create and insert a node for the excluded files/dirs
        self.tr_node2 = CPIOSpec()
        self.tr_node2.action = "uninstall"
        self.tr_node2.contents = self.TEST_DIR_EXCL_LIST_FILE
        self.soft_node.insert_children([self.tr_node2])

        # Populate the excl file
        with open(self.TEST_DIR_EXCL_LIST_FILE, 'w') as filehandle:
            filehandle.write("etc/xdg/menus" + "\n")

        try:
            self.tr_cpio.execute(dry_run=True)
        except Exception as err:
            self.fail(str(err))
Exemplo n.º 20
0
    def test_cpio_no_contents(self):
        ''' Test that "no contents" scenario is handled'''
        # Set up the source
        src = Source()
        path = Dir(self.TEST_SRC_DIR)
        src.insert_children([path])

        # Set up the destination
        dst = Destination()
        path = Dir(self.TEST_DST_DIR)
        dst.insert_children([path])

        # Insert the source and dest into the Software node
        self.soft_node.insert_children([src, dst])

        # The CPIO values that are specified - no contents
        self.tr_node.action = "install"

        try:
            self.tr_cpio.execute(dry_run=True)
        except Exception as err:
            self.fail(str(err))
Exemplo n.º 21
0
    def test_skip_file_list_list(self):
        '''Test the success of using skip_file_list'''
        # Copy all the files/dirs from /etc except for /etc/name_to_major
        # to /rpool/cpio_test_dir using a file for the contents

        # Set up the Source
        src = Source()
        path = Dir(self.TEST_SRC_DIR)
        src.insert_children([path])

        # Set up the destination
        dst = Destination()
        path = Dir(self.TEST_DST_DIR)
        dst.insert_children([path])

        # Insert the source and dest into the Software node
        self.soft_node.insert_children([src, dst])

        # The CPIO values that are specified
        self.tr_node.action = "install"
        #self.tr_node.contents = self.TEST_DIR_LIST_FILE
        self.tr_node.contents = ["etc/dhcp"]

        # Create and insert a node for the files to be uninstalled
        self.tr_node2 = CPIOSpec()
        self.tr_node2.action = "uninstall"
        #self.tr_node2.contents = self.TEST_SKIP_FILE_LIST_FILE
        self.tr_node2.contents = ["etc/dhcp/duid", "etc/dhcp/iaid"]
        self.soft_node.insert_children([self.tr_node2])

        # Set up the destination
        dst = Destination()
        path = Dir(self.TEST_DST_DIR)
        dst.insert_children([path])

        try:
            self.tr_cpio.execute(dry_run=True)
        except Exception as err:
            self.fail(str(err))
Exemplo n.º 22
0
    def test_progress_estimate(self):
        '''Test that the progress estimate is the value expected.'''
        src = Source()
        src_path = os.path.join(self.TEST_SRC_DIR, "etc/X11")
        path = Dir(src_path)
        src.insert_children([path])

        dst = Destination()
        path = Dir(self.TEST_DST_DIR)
        dst.insert_children([path])

        self.soft_node.insert_children([src, dst])

        # The CPIO values that are specified
        self.tr_node.action = "install"
        self.tr_node.contents = ["xinit"]

        try:
            progress_estimate = self.tr_cpio.get_progress_estimate()
        except Exception:
            self.assertTrue(False)
        size = 0

        size += file_size(os.path.join(src_path, "./"))
        for contents in self.tr_node.contents:
            size += file_size(os.path.join(src_path, contents))
            for root, subdirs, files in os.walk(
                    os.path.join(src_path, contents)):
                for subdir in subdirs:
                    size += file_size(os.path.join(root, subdir))
                for fname in files:
                    size += file_size(os.path.join(root, fname))

        # convert size to kilobytes
        size = size / 1024

        self.assertTrue(progress_estimate == \
                        int(float(size) / self.tr_cpio.DEFAULT_SIZE * \
                            self.tr_cpio.DEFAULT_PROG_EST))
Exemplo n.º 23
0
    def test_src_not_exist(self):
        '''Test that an error is raised when the source doesn't exist'''
        src = Source()
        pub = Publisher()
        origin = Origin("/doesnt_exist")
        pub.insert_children([origin])
        src.insert_children([pub])

        dst = Destination()
        path = Dir(self.TEST_DST_DIR)
        dst.insert_children([path])

        self.soft_node.insert_children([src, dst])
        self.assertRaises(Exception, self.tr_svr4.execute, dry_run=True)
Exemplo n.º 24
0
    def test_progress_estimate_invalid_src(self):
        '''Test the progress estimate value when src is invalid.
        '''
        src = Source()
        src_path = os.path.join(self.TEST_SRC_DIR, "/bogus")
        path = Dir(src_path)
        src.insert_children([path])

        dst = Destination()
        path = Dir(self.TEST_DST_DIR)
        dst.insert_children([path])

        self.soft_node.insert_children([src, dst])

        # The CPIO values that are specified
        self.tr_node.action = "install"
        self.tr_node.contents = ["./"]

        try:
            progress_estimate = self.tr_cpio.get_progress_estimate()
        except:
            self.assertTrue(False)
        self.assertTrue(progress_estimate == self.tr_cpio.DEFAULT_PROG_EST)
Exemplo n.º 25
0
    def add_root_transfer_to_doc(self):
        """ Adds the list of files of directories to be transferred
            to the DOC
        """
        if self.doc is None:
            self.doc = InstallEngine.get_instance().data_object_cache

        src_path = Dir("/")
        src = Source()
        src.insert_children(src_path)

        dst_path = Dir(INSTALL_TARGET_VAR)
        dst = Destination()
        dst.insert_children(dst_path)

        dot_node = CPIOSpec()
        dot_node.action = CPIOSpec.INSTALL
        dot_node.size = str(dir_size(os.path.join(self.ba_build, "")))
        dot_node.contents = ["."]

        usr_node = CPIOSpec()
        usr_node.action = CPIOSpec.INSTALL
        usr_node.size = str(dir_size(os.path.join(self.pkg_img_path, "usr")))
        usr_node.contents = ["usr"]

        dev_node = CPIOSpec()
        dev_node.action = CPIOSpec.INSTALL
        dev_node.size = str(dir_size(os.path.join(self.pkg_img_path, "dev")))
        dev_node.contents = ["dev"]

        software_node = Software(TRANSFER_ROOT, type="CPIO")
        software_node.insert_children([src, dst, dot_node, usr_node, dev_node])

        self.doc.persistent.insert_children(software_node)

        self.logger.debug(str(self.doc.persistent))
Exemplo n.º 26
0
    def add_content_list_to_doc(self, content_list):
        src_path = Dir(MEDIA_DIR_VAR)
        src = Source()
        src.insert_children(src_path)

        dst_path = Dir(INSTALL_TARGET_VAR)
        dst = Destination()
        dst.insert_children(dst_path)

        media_install = CPIOSpec()
        media_install.action = CPIOSpec.INSTALL
        media_install.contents = content_list
        total_size_byte = 0
        for content in content_list:
            content_path = os.path.join(self.pkg_img_path, content)
            # only want to calculate the size of files, since directories
            # are traversed and it's files are included in the list.
            if not os.path.isdir(content_path):
                total_size_byte += file_size(content_path)
        media_install.size = str(total_size_byte)

        media_soft_node = Software(TRANSFER_MEDIA, type="CPIO")
        media_soft_node.insert_children([src, dst, media_install])

        # Add that into the software transfer list.
        self.doc.persistent.insert_children(media_soft_node)

        # call manifest writer to write out the content of
        # the transfer manifest
        manifest_out = os.path.join(self.pkg_img_path, TRANSFER_MANIFEST_NAME)
        xslt_name = os.path.join(os.path.dirname(os.path.abspath(__file__)),
                                 "xslt", "doc2_media_transfer.xslt")
        manifest_writer = ManifestWriter("manifest-writer",
                                         manifest_out,
                                         xslt_file=xslt_name)
        manifest_writer.write(self.doc)
Exemplo n.º 27
0
    def test_entire(self):
        '''Test transfer all of /etc/X11 to /rpool/cpio_test_dir succeeds'''
        # Set up the source
        src = Source()
        src_path = os.path.join(self.TEST_SRC_DIR, "etc/X11")
        path = Dir(src_path)
        src.insert_children([path])

        # Set up the destination
        dst = Destination()
        path = Dir(self.TEST_DST_DIR)
        dst.insert_children([path])

        # Insert the source and dest into the Software node
        self.soft_node.insert_children([src, dst])

        # The CPIO values that are specified
        self.tr_node.action = "install"
        self.tr_node.contents = ["./"]

        try:
            self.tr_cpio.execute(dry_run=True)
        except Exception as err:
            self.fail(str(err))
Exemplo n.º 28
0
    def test_media_transform_not_executable(self):
        '''Test media_transform doesn't have correct permissions error
        '''
        src = Source()
        src_path = os.path.join(self.TEST_SRC_DIR, "etc/X11")
        path = Dir(src_path)
        src.insert_children([path])

        dst = Destination()
        path = Dir(self.TEST_DST_DIR)
        dst.insert_children([path])

        self.soft_node.insert_children([src, dst])

        # The CPIO values that are specified
        self.tr_node.action = "transform"
        self.tr_node.contents = "/tmp/media_not_exec"
        open(self.tr_node.contents, 'w')
        os.chmod(self.tr_node.contents, 01666)
        self.assertRaises(Exception, self.tr_cpio.execute, dry_run=False)
        try:
            os.unlink(self.tr_node.contents)
        except (Exception):
            pass
Exemplo n.º 29
0
    def test_transfer_fail_uninstall(self):
        '''Test that the transfer mechanism to uninstall
           fails with a non-existent package
        '''
        src = Source()
        pub = Publisher()
        origin = Origin(self.TEST_SRC_DIR)
        pub.insert_children([origin])
        src.insert_children([pub])

        dst = Destination()
        path = Dir(self.TEST_DST_DIR)
        dst.insert_children([path])
        self.soft_node.insert_children([src, dst])
        self.tr_node.action = 'uninstall'
        self.tr_node.contents = ["SUNWpkg0"]

        self.assertRaises(Exception, self.tr_svr4.execute, dry_run=False)
Exemplo n.º 30
0
    def test_uninstall_bad_args(self):
        '''Test transfer uninstall fails with bad args
        '''
        src = Source()
        pub = Publisher()
        origin = Origin(self.TEST_SRC_DIR)
        pub.insert_children([origin])
        src.insert_children([pub])

        dst = Destination()
        path = Dir(self.TEST_DST_DIR)
        dst.insert_children([path])
        self.soft_node.insert_children([src, dst])
        args = Args({"svr4_args": "-q -r -s -t"})
        self.tr_node.insert_children([args])
        self.tr_node.action = "uninstall"
        self.tr_node.contents = ["SUNWpkg1"]
        self.assertRaises(Exception, self.tr_svr4.execute, dry_run=False)