From cc1dc22226b74eae13973aea1e1ae6db478f2c66 Mon Sep 17 00:00:00 2001 From: Alexander Sulfrian Date: Mon, 21 Nov 2016 19:20:25 +0100 Subject: Server/Lint: Fix code style --- src/lib/Bcfg2/Server/Lint/RequiredAttrs.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src/lib/Bcfg2/Server') diff --git a/src/lib/Bcfg2/Server/Lint/RequiredAttrs.py b/src/lib/Bcfg2/Server/Lint/RequiredAttrs.py index ec65af650..3f1157912 100644 --- a/src/lib/Bcfg2/Server/Lint/RequiredAttrs.py +++ b/src/lib/Bcfg2/Server/Lint/RequiredAttrs.py @@ -47,6 +47,13 @@ def is_device_mode(val): return re.match(r'^\d+$', val) +def is_vcs_type(val): + """ Return True if val is a supported vcs type handled by the + current client tool """ + return (val != 'Path' and + hasattr(Bcfg2.Client.Tools.VCS.VCS, 'Install%s' % val)) + + class RequiredAttrs(Bcfg2.Server.Lint.ServerPlugin): """ Verify attributes for configuration entries that cannot be verified with an XML schema alone. """ @@ -71,10 +78,8 @@ class RequiredAttrs(Bcfg2.Server.Lint.ServerPlugin): 'nonexistent': dict(), 'permissions': dict(owner=is_username, group=is_username, mode=is_octal_mode), - 'vcs': dict(vcstype=lambda v: (v != 'Path' and - hasattr(Bcfg2.Client.Tools.VCS.VCS, - "Install%s" % v)), - revision=None, sourceurl=None), + 'vcs': dict(vcstype=is_vcs_type, revision=None, + sourceurl=None), }, Service={"__any__": dict(name=None), "smf": dict(name=None, FMRI=None)}, -- cgit v1.2.3-1-g7c22