diff options
author | Narayan Desai <desai@mcs.anl.gov> | 2008-08-19 03:55:08 +0000 |
---|---|---|
committer | Narayan Desai <desai@mcs.anl.gov> | 2008-08-19 03:55:08 +0000 |
commit | 6f0f270cd6c3625174805833fff7bc417f9cf0f7 (patch) | |
tree | 3c7bc21fdaf3bbd8f5efafa6e4455dd887533d50 /src/lib | |
parent | afe9ec159d4d680fb75950e516b979e8a4338800 (diff) | |
download | bcfg2-6f0f270cd6c3625174805833fff7bc417f9cf0f7.tar.gz bcfg2-6f0f270cd6c3625174805833fff7bc417f9cf0f7.tar.bz2 bcfg2-6f0f270cd6c3625174805833fff7bc417f9cf0f7.zip |
Improve robustness of the importer
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@4882 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/lib')
-rwxr-xr-x | src/lib/Server/Reports/importscript.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/lib/Server/Reports/importscript.py b/src/lib/Server/Reports/importscript.py index 3816435a9..30657fd07 100755 --- a/src/lib/Server/Reports/importscript.py +++ b/src/lib/Server/Reports/importscript.py @@ -24,12 +24,18 @@ from datetime import datetime from time import strptime from django.db import connection import ConfigParser +import difflib def build_reason_kwargs(r_ent): - if r_ent.get('current_bdiff', False): + if r_ent.get('current_bfile', False): + contents = binascii.a2b_base64(r_ent.get('current_bfile')) + rc_diff = '\n'.join(difflib.ndiff([], contents.split('\n'))) + elif r_ent.get('current_bdiff', False): rc_diff = binascii.a2b_base64(r_ent.get('current_bdiff')) + elif r_ent.get('current_diff', False): + rc_diff = r_ent.get('current_diff') else: - rc_diff = r_ent.get('current_diff', '') + rc_diff = '' return dict(owner=r_ent.get('owner', default=""), current_owner=r_ent.get('current_owner', default=""), group=r_ent.get('group', default=""), |