示例#1
0
    def __init__(self, basepath, xsource, config):
        Source.__init__(self, basepath, xsource, config)
        self.pkgnames = set()

        self.url_map = [{'rawurl': self.rawurl, 'url': self.url,
                         'version': self.version,
                         'components': self.components, 'arches': self.arches}]
示例#2
0
文件: Pac.py 项目: sbworth/bcfg2
    def __init__(self, basepath, xsource, config):
        Source.__init__(self, basepath, xsource, config)
        self.pkgnames = set()

        self.url_map = [{'rawurl': self.rawurl, 'url': self.url,
                         'version': self.version,
                         'components': self.components, 'arches': self.arches}]
示例#3
0
文件: Yum.py 项目: mikemccllstr/bcfg2
    def __init__(self, basepath, xsource, config):
        Source.__init__(self, basepath, xsource, config)
        self.pulp_id = None
        if has_pulp and xsource.get("pulp_id"):
            self.pulp_id = xsource.get("pulp_id")
            
            _setup_pulp(self.config)
            repoapi = RepositoryAPI()
            try:
                self.repo = repoapi.repository(self.pulp_id)
                self.gpgkeys = ["%s/%s" % (PULPCONFIG.cds['keyurl'], key)
                                for key in repoapi.listkeys(self.pulp_id)]
            except server.ServerRequestError:
                err = sys.exc_info()[1]
                if err[0] == 401:
                    msg = "Packages: Error authenticating to Pulp: %s" % err[1]
                elif err[0] == 404:
                    msg = "Packages: Pulp repo id %s not found: %s" % (self.pulp_id,
                                                             err[1])
                else:
                    msg = "Packages: Error %d fetching pulp repo %s: %s" % (err[0],
                                                                  self.pulp_id,
                                                                  err[1])
                logger.error(msg)
                raise Bcfg2.Server.Plugin.PluginInitError
            except socket.error:
                err = sys.exc_info()[1]
                logger.error("Packages: Could not contact Pulp server: %s" % err)
                raise Bcfg2.Server.Plugin.PluginInitError
            except:
                err = sys.exc_info()[1]
                logger.error("Packages: Unknown error querying Pulp server: %s" % err)
                raise Bcfg2.Server.Plugin.PluginInitError
            self.rawurl = "%s/%s" % (PULPCONFIG.cds['baseurl'],
                                     self.repo['relative_path'])
            self.arches = [self.repo['arch']]
        
        if not self.rawurl:
            self.baseurl = self.url + "%(version)s/%(component)s/%(arch)s/"
        else:
            self.baseurl = self.rawurl
        self.packages = dict()
        self.deps = dict([('global', dict())])
        self.provides = dict([('global', dict())])
        self.filemap = dict([(x, dict())
                             for x in ['global'] + self.arches])
        self.needed_paths = set()
        self.file_to_arch = dict()

        self.use_yum = has_yum
        try:
            self.use_yum &= config.getboolean("yum", "use_yum_libraries")
        except (ConfigParser.NoOptionError, ConfigParser.NoSectionError):
            self.use_yum = False
示例#4
0
文件: Apt.py 项目: solj/bcfg2-old
    def __init__(self, basepath, xsource, config):
        Source.__init__(self, basepath, xsource, config)
        self.pkgnames = set()

        self.url_map = [
            {
                "rawurl": self.rawurl,
                "url": self.url,
                "version": self.version,
                "components": self.components,
                "arches": self.arches,
            }
        ]
示例#5
0
    def __init__(self, basepath, xsource, config):
        Source.__init__(self, basepath, xsource, config)
        self.pulp_id = None
        if has_pulp and xsource.get("pulp_id"):
            self.pulp_id = xsource.get("pulp_id")

            _setup_pulp(self.config)
            repoapi = RepositoryAPI()
            try:
                self.repo = repoapi.repository(self.pulp_id)
                self.gpgkeys = [
                    "%s/%s" % (PULPCONFIG.cds['keyurl'], key)
                    for key in repoapi.listkeys(self.pulp_id)
                ]
            except server.ServerRequestError:
                err = sys.exc_info()[1]
                if err[0] == 401:
                    msg = "Packages: Error authenticating to Pulp: %s" % err[1]
                elif err[0] == 404:
                    msg = "Packages: Pulp repo id %s not found: %s" % (
                        self.pulp_id, err[1])
                else:
                    msg = "Packages: Error %d fetching pulp repo %s: %s" % (
                        err[0], self.pulp_id, err[1])
                raise SourceInitError(msg)
            except socket.error:
                err = sys.exc_info()[1]
                raise SourceInitError("Could not contact Pulp server: %s" %
                                      err)
            except:
                err = sys.exc_info()[1]
                raise SourceInitError(
                    "Unknown error querying Pulp server: %s" % err)
            self.rawurl = "%s/%s" % (PULPCONFIG.cds['baseurl'],
                                     self.repo['relative_path'])
            self.arches = [self.repo['arch']]

        if not self.rawurl:
            self.baseurl = self.url + "%(version)s/%(component)s/%(arch)s/"
        else:
            self.baseurl = self.rawurl
        self.packages = dict()
        self.deps = dict([('global', dict())])
        self.provides = dict([('global', dict())])
        self.filemap = dict([(x, dict()) for x in ['global'] + self.arches])
        self.needed_paths = set()
        self.file_to_arch = dict()

        self.use_yum = has_yum and config.getboolean(
            "yum", "use_yum_libraries", default=False)
示例#6
0
文件: Yum.py 项目: calvinchengx/bcfg2
    def __init__(self, basepath, xsource, config):
        Source.__init__(self, basepath, xsource, config)
        self.pulp_id = None
        if has_pulp and xsource.get("pulp_id"):
            self.pulp_id = xsource.get("pulp_id")

            _setup_pulp(self.config)
            repoapi = RepositoryAPI()
            try:
                self.repo = repoapi.repository(self.pulp_id)
                self.gpgkeys = [os.path.join(PULPCONFIG.cds['keyurl'], key)
                                for key in repoapi.listkeys(self.pulp_id)]
            except server.ServerRequestError:
                err = sys.exc_info()[1]
                if err[0] == 401:
                    msg = "Packages: Error authenticating to Pulp: %s" % err[1]
                elif err[0] == 404:
                    msg = "Packages: Pulp repo id %s not found: %s" % \
                          (self.pulp_id, err[1])
                else:
                    msg = "Packages: Error %d fetching pulp repo %s: %s" % \
                          (err[0], self.pulp_id, err[1])
                raise SourceInitError(msg)
            except socket.error:
                err = sys.exc_info()[1]
                raise SourceInitError("Could not contact Pulp server: %s" % err)
            except:
                err = sys.exc_info()[1]
                raise SourceInitError("Unknown error querying Pulp server: %s" %
                                      err)
            self.rawurl = "%s/%s" % (PULPCONFIG.cds['baseurl'],
                                     self.repo['relative_path'])
            self.arches = [self.repo['arch']]

        if not self.rawurl:
            self.baseurl = self.url + "%(version)s/%(component)s/%(arch)s/"
        else:
            self.baseurl = self.rawurl
        self.packages = dict()
        self.deps = dict([('global', dict())])
        self.provides = dict([('global', dict())])
        self.filemap = dict([(x, dict())
                             for x in ['global'] + self.arches])
        self.needed_paths = set()
        self.file_to_arch = dict()
示例#7
0
    def __init__(self, basepath, xsource, setup):
        Source.__init__(self, basepath, xsource, setup)
        self.pulp_id = None
        if HAS_PULP and xsource.get("pulp_id"):
            self.pulp_id = xsource.get("pulp_id")

            _setup_pulp(self.setup)
            repoapi = RepositoryAPI()
            try:
                self.repo = repoapi.repository(self.pulp_id)
                self.gpgkeys = [
                    os.path.join(PULPCONFIG.cds['keyurl'], key)
                    for key in repoapi.listkeys(self.pulp_id)
                ]
            except server.ServerRequestError:
                err = sys.exc_info()[1]
                if err[0] == 401:
                    msg = "Packages: Error authenticating to Pulp: %s" % err[1]
                elif err[0] == 404:
                    msg = "Packages: Pulp repo id %s not found: %s" % \
                          (self.pulp_id, err[1])
                else:
                    msg = "Packages: Error %d fetching pulp repo %s: %s" % \
                          (err[0], self.pulp_id, err[1])
                raise SourceInitError(msg)
            except socket.error:
                err = sys.exc_info()[1]
                raise SourceInitError("Could not contact Pulp server: %s" %
                                      err)
            except:
                err = sys.exc_info()[1]
                raise SourceInitError(
                    "Unknown error querying Pulp server: %s" % err)
            self.rawurl = "%s/%s" % (PULPCONFIG.cds['baseurl'],
                                     self.repo['relative_path'])
            self.arches = [self.repo['arch']]

        self.packages = dict()
        self.deps = dict([('global', dict())])
        self.provides = dict([('global', dict())])
        self.filemap = dict([(x, dict()) for x in ['global'] + self.arches])
        self.needed_paths = set()
        self.file_to_arch = dict()
示例#8
0
文件: Yum.py 项目: shellox/bcfg2
    def __init__(self, basepath, xsource):
        Source.__init__(self, basepath, xsource)
        self.pulp_id = None
        if HAS_PULP and xsource.get("pulp_id"):
            self.pulp_id = xsource.get("pulp_id")

            _setup_pulp()
            repoapi = RepositoryAPI()
            try:
                self.repo = repoapi.repository(self.pulp_id)
                self.gpgkeys = [os.path.join(PULPCONFIG.cds["keyurl"], key) for key in repoapi.listkeys(self.pulp_id)]
            except server.ServerRequestError:
                err = sys.exc_info()[1]
                if err[0] == 401:
                    msg = "Packages: Error authenticating to Pulp: %s" % err[1]
                elif err[0] == 404:
                    msg = "Packages: Pulp repo id %s not found: %s" % (self.pulp_id, err[1])
                else:
                    msg = "Packages: Error %d fetching pulp repo %s: %s" % (err[0], self.pulp_id, err[1])
                raise SourceInitError(msg)
            except socket.error:
                err = sys.exc_info()[1]
                raise SourceInitError("Could not contact Pulp server: %s" % err)
            except:
                err = sys.exc_info()[1]
                raise SourceInitError("Unknown error querying Pulp server: %s" % err)
            self.rawurl = "%s/%s" % (PULPCONFIG.cds["baseurl"], self.repo["relative_path"])
            self.arches = [self.repo["arch"]]

        self.packages = dict()
        self.deps = dict([("global", dict())])
        self.provides = dict([("global", dict())])
        self.filemap = dict([(x, dict()) for x in ["global"] + self.arches])
        self.needed_paths = set()
        self.file_to_arch = dict()
        self.yumgroups = dict()
示例#9
0
文件: Apt.py 项目: ab/bcfg2
 def __init__(self, basepath, xsource, config):
     Source.__init__(self, basepath, xsource, config)
     self.pkgnames = set()
示例#10
0
文件: Pac.py 项目: Bcfg2/bcfg2
    def __init__(self, basepath, xsource):
        self.pacgroups = {}

        Source.__init__(self, basepath, xsource)
示例#11
0
    def __init__(self, basepath, xsource):
        self.pacgroups = {}

        Source.__init__(self, basepath, xsource)