Hello All,

I was trying PXE installation using spacewalk in which PXE menu provides list 
of activation keys and accordingly saves selected key in file 
'/mnt/sysimage/tmp/key'. The post_reactivation_key post script snippet opens 
'/mnt/sysimage/tmp/key' file in 'w' mode which overwrites previously created 
file in pre script which stores user selected activation key. If we modify file 
opening mode to append mode('a') then it works as expected.

Attached patch solves this issue.

Thank You,
Amit Upadhye.
From e4e357670aa30eae06e3ac273d7167b9e3173305 Mon Sep 17 00:00:00 2001
From: Amit Ganesh Upadhye <aupad...@redhat.com>
Date: Thu, 2 May 2013 19:00:08 +0530
Subject: [PATCH] Modified snippet post_reactivation_key to open the '/mnt/sysimage/tmp/key' file in 'a' mode instead of 'w' mode.
 Signed-off-by: Amit Ganesh Upadhye <aupad...@redhat.com>

---
 java/conf/cobbler/snippets/post_reactivation_key |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/java/conf/cobbler/snippets/post_reactivation_key b/java/conf/cobbler/snippets/post_reactivation_key
index 369deab..b39227f 100644
--- a/java/conf/cobbler/snippets/post_reactivation_key
+++ b/java/conf/cobbler/snippets/post_reactivation_key
@@ -14,7 +14,7 @@ try:
     if os.path.exists(old_system_id):
         client =  xmlrpclib.Server("http://$redhat_management_server/rpc/api";)
         key = client.system.obtain_reactivation_key(open(old_system_id).read())
-        f = open("/mnt/sysimage/tmp/key","w")
+        f = open("/mnt/sysimage/tmp/key","a")
         f.write(key)
         f.close()
         shutil.copy(old_system_id, new_system_id)
-- 
1.7.1

_______________________________________________
Spacewalk-devel mailing list
Spacewalk-devel@redhat.com
https://www.redhat.com/mailman/listinfo/spacewalk-devel

Reply via email to