Exemplo n.º 1
0
    def _link_sub(self, sub, app):

        area = PTaskArea(self.ptask.spec, version=self.version)

        product_ver = sub.product_version

        try:
            product_ver_area = PTaskArea(product_ver.spec)
        except PTaskAreaError as e:
            raise ActionError("Unable to locate product directory for: " +
                              product_ver.spec)

        product_ver_path = product_ver_area.path

        product = product_ver.product

        product_ver_import_dir = os.path.join('import', app, product.name)

        try:
            area.provision(product_ver_import_dir)
        except PTaskAreaError as e:
            raise ActionError("Failed to provision product import dir: " +
                              str(e))

        link_name = os.path.join(area.path, product_ver_import_dir,
                                 product.category)

        print "Creating subscription {a} link for: {pv}".format(
            a=app, pv=product_ver.spec)

        os.symlink(product_ver_path, link_name)

        product_ver_area = PTaskArea(product_ver.spec)
Exemplo n.º 2
0
    def _link_sub(self, sub, app):

        area = PTaskArea(self.ptask.spec, version=self.version)

        product_ver = sub.product_version

        try:
            product_ver_area = PTaskArea(product_ver.spec)
        except PTaskAreaError as e:
            raise ActionError(
                "Unable to locate product directory for: " + product_ver.spec
            )

        product_ver_path = product_ver_area.path

        product = product_ver.product

        product_ver_import_dir = os.path.join('import', app, product.name)
            
        try:
            area.provision(product_ver_import_dir)
        except PTaskAreaError as e:
            raise ActionError(
                "Failed to provision product import dir: " + str(e))
        
        link_name = os.path.join(area.path,
            product_ver_import_dir, product.category)

        print "Creating subscription {a} link for: {pv}".format(
            a=app, pv=product_ver.spec)

        os.symlink(product_ver_path, link_name)

        product_ver_area = PTaskArea(product_ver.spec)
Exemplo n.º 3
0
    def _prep_import_dir(self):

        area = PTaskArea(self.ptask.spec, version=self.version)
        import_dir = area.dir(dir_name="import", verify=False, path=True)

        if os.path.exists(import_dir):
            print "Cleaning up existing import directory."
            try:
                shutil.rmtree(import_dir)
            except Exception as e:
                raise ActionError("Failed to remove old import dir: " + str(e))

        global_import_dir = os.path.join('import', 'global')

        try:
            print "Provisioning new import directory."
            area.provision('import')
            area.provision(global_import_dir)
        except PTaskAreaError as e:
            raise ActionError("Failed to provision global import directory: " +
                              str(e))

        return area.dir(dir_name=global_import_dir, path=True)
Exemplo n.º 4
0
    def _prep_import_dir(self):

        area = PTaskArea(self.ptask.spec, version=self.version)
        import_dir = area.dir(dir_name="import", verify=False, path=True)

        if os.path.exists(import_dir):
            print "Cleaning up existing import directory."
            try:
                shutil.rmtree(import_dir)
            except Exception as e:
                raise ActionError("Failed to remove old import dir: " + str(e))

        global_import_dir = os.path.join('import', 'global')

        try:
            print "Provisioning new import directory."
            area.provision('import')
            area.provision(global_import_dir)
        except PTaskAreaError as e:
            raise ActionError(
                "Failed to provision global import directory: " + str(e))

        return area.dir(dir_name=global_import_dir, path=True)