diff options
author | Alexander Sulfrian <alexander@sulfrian.net> | 2014-10-18 01:35:35 +0200 |
---|---|---|
committer | Alexander Sulfrian <alexander@sulfrian.net> | 2014-10-18 02:03:59 +0200 |
commit | 8d630569c3da497c5ccb026f175d44f02b48c4e7 (patch) | |
tree | 142599eb961d0b2ceceb9abf9fc8d2b83407beb1 /src/lib/Bcfg2/Server/Plugins/Packages/Source.py | |
parent | 5c68f95a382fdcd17fb5016a98b7eb7af4e057a6 (diff) | |
download | bcfg2-8d630569c3da497c5ccb026f175d44f02b48c4e7.tar.gz bcfg2-8d630569c3da497c5ccb026f175d44f02b48c4e7.tar.bz2 bcfg2-8d630569c3da497c5ccb026f175d44f02b48c4e7.zip |
Packages: add name to sources
Diffstat (limited to 'src/lib/Bcfg2/Server/Plugins/Packages/Source.py')
-rw-r--r-- | src/lib/Bcfg2/Server/Plugins/Packages/Source.py | 12 |
1 files changed, 10 insertions, 2 deletions
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: |