[node-patches] Change in ovirt-node[master]: Fix clear /etc/puppet/puppet.conf issue

hadong0720 at gmail.com hadong0720 at gmail.com
Wed Jul 31 10:48:43 UTC 2013


hadong has uploaded a new change for review.

Change subject: Fix clear /etc/puppet/puppet.conf issue
......................................................................

Fix clear /etc/puppet/puppet.conf issue

Previously when clicking "Save" button to save puppet configuration,
it will clear /etc/puppet/puppet.conf.
Now fix it as save puppet configuration info into /etc/puppet/puppet.conf.

Change-Id: Idffce430477f9d44d2a8bff12ad518b479e86648
Signed-off-by: hadong <hadong0720 at gmail.com>
---
M src/ovirt/node/setup/puppet/puppet_page.py
1 file changed, 6 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/22/17522/1

diff --git a/src/ovirt/node/setup/puppet/puppet_page.py b/src/ovirt/node/setup/puppet/puppet_page.py
index 03f1e4d..13c89b4 100644
--- a/src/ovirt/node/setup/puppet/puppet_page.py
+++ b/src/ovirt/node/setup/puppet/puppet_page.py
@@ -142,14 +142,17 @@
 
         lines = File("/etc/puppet/puppet.conf").read()
         conf = File("/etc/puppet/puppet.conf")
+        conf.write("")
         for line in lines:
             try:
                 item = re.match(r'^\s+(\w+) =', line).group(1)
                 if item in cfg:
-                    conf.write(re.sub(r'(^.*?' + item + ' =).*', r'\1 "' +
-                                      cfg[item] + '"', line))
+                    conf.write("\n" + re.sub(r'(^.*?' + item + ' =).*', r'\1 "'
+                                             + cfg[item] + '"', line), "a")
+                else:
+                    conf.write("\n" + line, "a")
             except:
-                conf.write(line)
+                conf.write("\n" + line, "a")
 
         system.service("puppet", "stop")
         utils.process.check_call("puppet agent --test", shell=True)


-- 
To view, visit http://gerrit.ovirt.org/17522
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Idffce430477f9d44d2a8bff12ad518b479e86648
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: hadong <hadong0720 at gmail.com>



More information about the node-patches mailing list