From 535506260692f00b3d073d1efc73d2d565792e82 Mon Sep 17 00:00:00 2001 From: "Chris St. Pierre" Date: Thu, 5 Sep 2013 15:10:20 -0400 Subject: Core: avoid importing Metadata before Django has been configured --- src/lib/Bcfg2/Server/Core.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src') diff --git a/src/lib/Bcfg2/Server/Core.py b/src/lib/Bcfg2/Server/Core.py index 5482e32fe..271fb8237 100644 --- a/src/lib/Bcfg2/Server/Core.py +++ b/src/lib/Bcfg2/Server/Core.py @@ -22,7 +22,6 @@ from Bcfg2.Compat import xmlrpclib # pylint: disable=W0622 from Bcfg2.Server.Plugin.exceptions import * # pylint: disable=W0401,W0614 from Bcfg2.Server.Plugin.interfaces import * # pylint: disable=W0401,W0614 from Bcfg2.Server.Plugin import track_statistics -from Bcfg2.Server.Plugins.Metadata import MetadataGroup try: import psyco @@ -890,7 +889,7 @@ class BaseCore(object): groups = conn.get_additional_groups(imd) groupnames = [] for group in groups: - if isinstance(group, MetadataGroup): + if hasattr(group, "name"): groupname = group.name if groupname in self._dynamic_groups: if self._dynamic_groups[groupname] == conn.name: -- cgit v1.2.3-1-g7c22 From efa412b4dda4048b1a49143df5521eb1f7e8573f Mon Sep 17 00:00:00 2001 From: Sol Jerome Date: Fri, 6 Sep 2013 11:16:32 -0500 Subject: POSIXUsers: Fix traceback Signed-off-by: Sol Jerome --- src/lib/Bcfg2/Client/Tools/POSIXUsers.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/lib/Bcfg2/Client/Tools/POSIXUsers.py b/src/lib/Bcfg2/Client/Tools/POSIXUsers.py index 49fc704e4..bf23aca6b 100644 --- a/src/lib/Bcfg2/Client/Tools/POSIXUsers.py +++ b/src/lib/Bcfg2/Client/Tools/POSIXUsers.py @@ -189,7 +189,8 @@ class POSIXUsers(Bcfg2.Client.Tools.Tool): else: for attr, idx in self.attr_mapping[entry.tag].items(): val = str(self.existing[entry.tag][entry.get("name")][idx]) - entry.set("current_%s" % attr, val) + entry.set("current_%s" % + attr, val.decode(self.setup['encoding'])) if attr in ["uid", "gid"]: if entry.get(attr) is None: # no uid/gid specified, so we let the tool -- cgit v1.2.3-1-g7c22 From e2909bd2259244a6f3c17f2feed71d11426a0fb8 Mon Sep 17 00:00:00 2001 From: "Chris St. Pierre" Date: Mon, 9 Sep 2013 13:25:44 -0400 Subject: Cfg: Give non-specific handlers a default specificity --- src/lib/Bcfg2/Server/Plugins/Cfg/__init__.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/lib/Bcfg2/Server/Plugins/Cfg/__init__.py b/src/lib/Bcfg2/Server/Plugins/Cfg/__init__.py index 7f271fc7f..89db45e2c 100644 --- a/src/lib/Bcfg2/Server/Plugins/Cfg/__init__.py +++ b/src/lib/Bcfg2/Server/Plugins/Cfg/__init__.py @@ -101,6 +101,8 @@ class CfgBaseFileMatcher(Bcfg2.Server.Plugin.SpecificData, experimental = False def __init__(self, name, specific, encoding): + if not self.__specific__ and not specific: + specific = Bcfg2.Server.Plugin.Specificity(all=True) Bcfg2.Server.Plugin.SpecificData.__init__(self, name, specific, encoding) Bcfg2.Server.Plugin.Debuggable.__init__(self) -- cgit v1.2.3-1-g7c22 From 8fd0dad3e99f4452a6cd3f27e5c97efd9fc308e7 Mon Sep 17 00:00:00 2001 From: "Chris St. Pierre" Date: Mon, 9 Sep 2013 14:47:48 -0400 Subject: Cfg: allow changing category specific-ness of generated authorized_keys --- src/lib/Bcfg2/Server/Plugins/Cfg/CfgAuthorizedKeysGenerator.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/lib/Bcfg2/Server/Plugins/Cfg/CfgAuthorizedKeysGenerator.py b/src/lib/Bcfg2/Server/Plugins/Cfg/CfgAuthorizedKeysGenerator.py index f304891d5..41d5588e4 100644 --- a/src/lib/Bcfg2/Server/Plugins/Cfg/CfgAuthorizedKeysGenerator.py +++ b/src/lib/Bcfg2/Server/Plugins/Cfg/CfgAuthorizedKeysGenerator.py @@ -68,18 +68,18 @@ class CfgAuthorizedKeysGenerator(CfgGenerator, StructFile): if pubkey_name: host = allow.get("host") group = allow.get("group") + category = allow.get("category", self.category) if host: key_md = self.core.build_metadata(host) elif group: key_md = ClientMetadata("dummy", group, [group], [], set(), set(), dict(), None, None, None, None) - elif (self.category and - not metadata.group_in_category(self.category)): + elif category and not metadata.group_in_category(category): self.logger.warning("Cfg: %s ignoring Allow from %s: " "No group in category %s" % (metadata.hostname, pubkey_name, - self.category)) + category)) continue else: key_md = metadata -- cgit v1.2.3-1-g7c22