client/tools/rhncfg/config_management/rhncfg_diff.py | 15 ++++++++++++---
client/tools/rhncfg/config_management/rhncfg_get.py | 3 +++
2 files changed, 15 insertions(+), 3 deletions(-)
New commits:
commit 82c954dc133d7c8c318b92c5e8bb6ba7aae02b93
Author: Partha Aji <paji(a)redhat.com>
Date: Mon Aug 2 19:38:47 2010 -0400
Added diff and get functionaliity for rhncfg-manager
diff --git a/client/tools/rhncfg/config_management/rhncfg_diff.py
b/client/tools/rhncfg/config_management/rhncfg_diff.py
index 948510a..f036018 100644
--- a/client/tools/rhncfg/config_management/rhncfg_diff.py
+++ b/client/tools/rhncfg/config_management/rhncfg_diff.py
@@ -86,12 +86,12 @@ class Handler(handler_base.HandlerBase):
if not utils.startswith(f, topdir):
die(8, "--topdir %s specified, but file `%s' doesn't
comply"
% (topdir, f))
- if os.path.isdir(f):
+ if os.path.isdir(f) and not os.path.islink(f):
die(8, "Cannot diff %s; it is a directory" % f)
files_to_diff.append((f, f[len(topdir):]))
else:
for f in files:
- if os.path.isdir(f):
+ if os.path.isdir(f) and not os.path.islink(f):
die(8, "Cannot diff %s; it is a directory" % f)
files_to_diff.append((f, f))
@@ -108,7 +108,16 @@ class Handler(handler_base.HandlerBase):
except cfg_exceptions.RepositoryFileMissingError:
die(2, "Error: no such file %s (revision %s) in config channel %s"
% (path, revision, channel))
-
+ if os.path.islink(local_file) and info['filetype'] != 'symlink'
:
+ die(8, "Cannot diff %s; the file on the system is a symbolic link while
the file in the channel is not. " % local_file)
+ if info['filetype'] != 'symlink' and not
os.path.islink(local_file) :
+ die(8, "Cannot diff %s; the file on the system is not a symbolic link
while the file in the channel is. " % local_file)
+ if info['filetype'] == 'symlink':
+ src_link = info['symlink']
+ dest_link = os.readlink(local_file)
+ if src_link != os.readlink(local_file):
+ return "Symbolic links differ. Channel: '%s' ->
'%s' System: '%s' -> '%s' \n " % (path,src_link, path,
dest_link)
+ return ""
# Test -u option to diff
diffcmd = "/usr/bin/diff -u"
pipe = os.popen("%s %s %s 2>/dev/null" % (diffcmd, temp_file,
local_file))
diff --git a/client/tools/rhncfg/config_management/rhncfg_get.py
b/client/tools/rhncfg/config_management/rhncfg_get.py
index 8bb8552..e502160 100644
--- a/client/tools/rhncfg/config_management/rhncfg_get.py
+++ b/client/tools/rhncfg/config_management/rhncfg_get.py
@@ -93,6 +93,9 @@ class Handler(handler_base.HandlerBase):
#5/11/05 wregglej - 157066 dirs_created now gets passed into
add_preprocessed.
dep_trans.add_preprocessed(f, temp_file, info, dirs_created,
strict_ownership=0)
continue
+ elif info.get('filetype') == 'symlink':
+ print "%s -> %s" % (info['path'],
info['symlink'])
+ continue
elif info.get('filetype') == 'directory':
print "%s is a directory entry, nothing to get" %
info['path']
continue
Show replies by date