diff options
-rw-r--r-- | src/lib/Bcfg2/Server/Plugin/helpers.py | 18 | ||||
-rwxr-xr-x | tools/upgrade/1.3/migrate_info.py | 6 |
2 files changed, 14 insertions, 10 deletions
diff --git a/src/lib/Bcfg2/Server/Plugin/helpers.py b/src/lib/Bcfg2/Server/Plugin/helpers.py index b14968d77..81dc1d736 100644 --- a/src/lib/Bcfg2/Server/Plugin/helpers.py +++ b/src/lib/Bcfg2/Server/Plugin/helpers.py @@ -41,15 +41,15 @@ del DEFAULT_FILE_METADATA['configfile'] LOGGER = logging.getLogger(__name__) #: a compiled regular expression for parsing info and :info files -INFO_REGEX = re.compile(r'owner:(\s)*(?P<owner>\S+)|' + - r'group:(\s)*(?P<group>\S+)|' + - r'mode:(\s)*(?P<mode>\w+)|' + - r'secontext:(\s)*(?P<secontext>\S+)|' + - r'paranoid:(\s)*(?P<paranoid>\S+)|' + - r'sensitive:(\s)*(?P<sensitive>\S+)|' + - r'encoding:(\s)*(?P<encoding>\S+)|' + - r'important:(\s)*(?P<important>\S+)|' + - r'mtime:(\s)*(?P<mtime>\w+)|') +INFO_REGEX = re.compile(r'owner:\s*(?P<owner>\S+)|' + + r'group:\s*(?P<group>\S+)|' + + r'mode:\s*(?P<mode>\w+)|' + + r'secontext:\s*(?P<secontext>\S+)|' + + r'paranoid:\s*(?P<paranoid>\S+)|' + + r'sensitive:\s*(?P<sensitive>\S+)|' + + r'encoding:\s*(?P<encoding>\S+)|' + + r'important:\s*(?P<important>\S+)|' + + r'mtime:\s*(?P<mtime>\w+)') def bind_info(entry, metadata, infoxml=None, default=DEFAULT_FILE_METADATA): diff --git a/tools/upgrade/1.3/migrate_info.py b/tools/upgrade/1.3/migrate_info.py index e72599daf..3ccbf0285 100755 --- a/tools/upgrade/1.3/migrate_info.py +++ b/tools/upgrade/1.3/migrate_info.py @@ -1,12 +1,16 @@ #!/usr/bin/env python import os +import re import sys import lxml.etree import Bcfg2.Options from Bcfg2.Server.Plugin import INFO_REGEX +PERMS_REGEX = re.compile(r'perms:\s*(?P<perms>\w+)') + + def convert(info_file): info_xml = os.path.join(os.path.dirname(info_file), "info.xml") if os.path.exists(info_xml): @@ -16,7 +20,7 @@ def convert(info_file): fileinfo = lxml.etree.Element("FileInfo") info = lxml.etree.SubElement(fileinfo, "Info") for line in open(info_file).readlines(): - match = INFO_REGEX.match(line) + match = INFO_REGEX.match(line) or PERMS_REGEX.match(line) if match: mgd = match.groupdict() for key, value in list(mgd.items()): |