diff options
author | Sol Jerome <sol.jerome@gmail.com> | 2013-03-21 09:36:34 -0500 |
---|---|---|
committer | Sol Jerome <sol.jerome@gmail.com> | 2013-03-21 09:36:34 -0500 |
commit | 7d22e7fe4bff3c229ed0cb8d3a792e508ba13cce (patch) | |
tree | 54d1dfc689ef0e4bc0d0c178c45e3fd55901d77a /tools/upgrade/1.3/migrate_perms_to_mode.py | |
parent | 98ef06e6a0426958f476f2835839aea5de3f7bc6 (diff) | |
parent | 5feb76d97c6b26228dcf521659f434c6b576310c (diff) | |
download | bcfg2-7d22e7fe4bff3c229ed0cb8d3a792e508ba13cce.tar.gz bcfg2-7d22e7fe4bff3c229ed0cb8d3a792e508ba13cce.tar.bz2 bcfg2-7d22e7fe4bff3c229ed0cb8d3a792e508ba13cce.zip |
Merge branch 'maint'
Diffstat (limited to 'tools/upgrade/1.3/migrate_perms_to_mode.py')
-rwxr-xr-x | tools/upgrade/1.3/migrate_perms_to_mode.py | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/tools/upgrade/1.3/migrate_perms_to_mode.py b/tools/upgrade/1.3/migrate_perms_to_mode.py index a15de6e29..e061558d3 100755 --- a/tools/upgrade/1.3/migrate_perms_to_mode.py +++ b/tools/upgrade/1.3/migrate_perms_to_mode.py @@ -24,7 +24,12 @@ def writefile(f, xdata): def convertinfo(ifile): """Do perms -> mode conversion for info.xml files.""" - xdata = lxml.etree.parse(ifile) + try: + xdata = lxml.etree.parse(ifile) + except lxml.etree.XMLSyntaxError: + err = sys.exc_info()[1] + print("Could not parse %s, skipping: %s" % (ifile, err)) + return found = False for i in xdata.findall('//Info'): found = setmodeattr(i) @@ -34,9 +39,14 @@ def convertinfo(ifile): def convertstructure(structfile): """Do perms -> mode conversion for structure files.""" - xdata = lxml.etree.parse(structfile) + try: + xdata = lxml.etree.parse(structfile) + except lxml.etree.XMLSyntaxError: + err = sys.exc_info()[1] + print("Could not parse %s, skipping: %s" % (structfile, err)) + return found = False - for path in xdata.xpath('//BoundPath|Path'): + for path in xdata.xpath('//BoundPath|//Path'): found = setmodeattr(path) if found: writefile(structfile, xdata) @@ -55,7 +65,7 @@ def main(): for root, dirs, files in os.walk(os.path.join(repo, plugin)): for fname in files: convertstructure(os.path.join(root, fname)) - if plugin not in ['Cfg', 'TGenshi', 'TCheetah']: + if plugin not in ['Cfg', 'TGenshi', 'TCheetah', 'SSHbase', 'SSLCA']: continue for root, dirs, files in os.walk(os.path.join(repo, plugin)): for fname in files: |