From d801c47773ce108de79f008f4a17b774476b0549 Mon Sep 17 00:00:00 2001 From: Alexander Sulfrian Date: Wed, 28 May 2014 03:24:35 +0200 Subject: Packages/Apt: Essential could be "no" The "Essential" field in the package control fields could be "yes" or "no". Only yes sould define the package as essential. The value "no" sould be handled same as not having the field at all. --- src/lib/Bcfg2/Server/Plugins/Packages/Apt.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/lib/Bcfg2/Server/Plugins/Packages') diff --git a/src/lib/Bcfg2/Server/Plugins/Packages/Apt.py b/src/lib/Bcfg2/Server/Plugins/Packages/Apt.py index 27a725f23..4a78f846f 100644 --- a/src/lib/Bcfg2/Server/Plugins/Packages/Apt.py +++ b/src/lib/Bcfg2/Server/Plugins/Packages/Apt.py @@ -107,7 +107,8 @@ class AptSource(Source): self.pkgnames.add(pkgname) bdeps[barch][pkgname] = [] elif words[0] == 'Essential' and self.essential: - self.essentialpkgs.add(pkgname) + if words[1].strip() == 'yes': + self.essentialpkgs.add(pkgname) elif words[0] in depfnames: vindex = 0 for dep in words[1].split(','): -- cgit v1.2.3-1-g7c22 From 8d630569c3da497c5ccb026f175d44f02b48c4e7 Mon Sep 17 00:00:00 2001 From: Alexander Sulfrian Date: Sat, 18 Oct 2014 01:35:35 +0200 Subject: Packages: add name to sources --- src/lib/Bcfg2/Server/Plugins/Packages/Source.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/lib/Bcfg2/Server/Plugins/Packages') diff --git a/src/lib/Bcfg2/Server/Plugins/Packages/Source.py b/src/lib/Bcfg2/Server/Plugins/Packages/Source.py index 22073493c..d6e3e29ca 100644 --- a/src/lib/Bcfg2/Server/Plugins/Packages/Source.py +++ b/src/lib/Bcfg2/Server/Plugins/Packages/Source.py @@ -209,6 +209,9 @@ class Source(Bcfg2.Server.Plugin.Debuggable): # pylint: disable=R0902 #: The "version" attribute from :attr:`xsource` self.version = xsource.get('version', '') + #: The "name" attribute from :attr:`xsource` + self.name = xsource.get('name', None) + #: A list of predicates that are used to determine if this #: source applies to a given #: :class:`Bcfg2.Server.Plugins.Metadata.ClientMetadata` @@ -395,8 +398,10 @@ class Source(Bcfg2.Server.Plugin.Debuggable): # pylint: disable=R0902 doing other operations that require repository names. This function tries several approaches: - #. First, if the map contains a ``component`` key, use that as - the name. + #. First, if the source element containts a ``name`` attribute, + use that as the name. + #. If the map contains a ``component`` key, use that as the + name. #. If not, then try to match the repository URL against :attr:`Bcfg2.Server.Plugins.Packages.Source.REPO_RE`. If that succeeds, use the first matched group; additionally, @@ -426,6 +431,9 @@ class Source(Bcfg2.Server.Plugin.Debuggable): # pylint: disable=R0902 :type url_map: dict :returns: string - the name of the repository. """ + if self.name: + return self.name + if url_map['component']: rname = url_map['component'] else: -- cgit v1.2.3-1-g7c22 From 2aea371d005e74471b6b601772e847402a9a804e Mon Sep 17 00:00:00 2001 From: Alexander Sulfrian Date: Fri, 1 Mar 2013 04:28:47 +0100 Subject: Packages: add name to additional_data for Sources --- src/lib/Bcfg2/Server/Plugins/Packages/Source.py | 1 + 1 file changed, 1 insertion(+) (limited to 'src/lib/Bcfg2/Server/Plugins/Packages') diff --git a/src/lib/Bcfg2/Server/Plugins/Packages/Source.py b/src/lib/Bcfg2/Server/Plugins/Packages/Source.py index d6e3e29ca..d08c7d285 100644 --- a/src/lib/Bcfg2/Server/Plugins/Packages/Source.py +++ b/src/lib/Bcfg2/Server/Plugins/Packages/Source.py @@ -295,6 +295,7 @@ class Source(Bcfg2.Server.Plugin.Debuggable): # pylint: disable=R0902 else: setting['baseurl'] = self.rawurl setting['url'] = baseurl % setting + setting['name'] = self.get_repo_name(setting) self.url_map.extend(usettings) @property -- cgit v1.2.3-1-g7c22 From 12c2b9cd2bec17ffe09863abed97876b10da88ed Mon Sep 17 00:00:00 2001 From: Alexander Sulfrian Date: Sun, 26 Oct 2014 00:14:56 +0200 Subject: fix keyboard interrupt during intial event handling This removes some wildcard except handler because this drops some KeyboardInterrupt exceptions (for example previously a KeyboardInterrupt during the loading of the cache for Packages resulted in a fallback to file read). --- src/lib/Bcfg2/Server/Plugins/Packages/Source.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/lib/Bcfg2/Server/Plugins/Packages') diff --git a/src/lib/Bcfg2/Server/Plugins/Packages/Source.py b/src/lib/Bcfg2/Server/Plugins/Packages/Source.py index d08c7d285..538215c85 100644 --- a/src/lib/Bcfg2/Server/Plugins/Packages/Source.py +++ b/src/lib/Bcfg2/Server/Plugins/Packages/Source.py @@ -364,7 +364,7 @@ class Source(Bcfg2.Server.Plugin.Debuggable): # pylint: disable=R0902 if os.path.exists(self.cachefile): try: self.load_state() - except: + except (OSError, cPickle.UnpicklingError): err = sys.exc_info()[1] self.logger.error("Packages: Cachefile %s load failed: %s" % (self.cachefile, err)) -- cgit v1.2.3-1-g7c22 From 14b808b5a9adf46857bdd971afe8e6717898e721 Mon Sep 17 00:00:00 2001 From: Alexander Sulfrian Date: Wed, 5 Nov 2014 15:45:42 +0100 Subject: Server/Plugins/Packages: add debsrc attribute to url_map Adding this value to the url_map makes it possible to use it in genshi templates. --- src/lib/Bcfg2/Server/Plugins/Packages/Source.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/lib/Bcfg2/Server/Plugins/Packages') diff --git a/src/lib/Bcfg2/Server/Plugins/Packages/Source.py b/src/lib/Bcfg2/Server/Plugins/Packages/Source.py index 538215c85..30cdd543f 100644 --- a/src/lib/Bcfg2/Server/Plugins/Packages/Source.py +++ b/src/lib/Bcfg2/Server/Plugins/Packages/Source.py @@ -283,11 +283,11 @@ class Source(Bcfg2.Server.Plugin.Debuggable): # pylint: disable=R0902 for arch in self.arches: if self.url: usettings = [dict(version=self.version, component=comp, - arch=arch) + arch=arch, debsrc=self.debsrc) for comp in self.components] else: # rawurl given usettings = [dict(version=self.version, component=None, - arch=arch)] + arch=arch, debsrc=self.debsrc)] for setting in usettings: if not self.rawurl: -- cgit v1.2.3-1-g7c22