Fabian Deutsch has uploaded a new change for review.

Change subject: register: Pull some vars into the class
......................................................................

register: Pull some vars into the class

Change-Id: I1601ec61a30971f175630013023e8be2de77da17
Signed-off-by: Fabian Deutsch <[email protected]>
---
M lib/vdsm/tool/register.py
1 file changed, 10 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/77/46977/1

diff --git a/lib/vdsm/tool/register.py b/lib/vdsm/tool/register.py
index ae8fecd..3e9dfe2 100644
--- a/lib/vdsm/tool/register.py
+++ b/lib/vdsm/tool/register.py
@@ -35,6 +35,8 @@
 
 
 class Register(object):
+    ca_dir = "/etc/pki/ovirt-engine/"
+    VDSM_ID_FILE = "/etc/vdsm/vdsm.id"
 
     def __init__(self, engine_fqdn, engine_https_port=None,
                  fingerprint=None, ssh_port=None,
@@ -116,7 +118,6 @@
         self.logger.debug("VDSM UUID: {uuid_provided}".format(
                           uuid_provided=self.vdsm_uuid))
 
-        self.ca_dir = "/etc/pki/ovirt-engine/"
         self.ca_engine = "{d}{f}".format(d=self.ca_dir, f="ca.pem")
         self.logger.debug("Engine CA: {ca}".format(ca=self.ca_engine))
 
@@ -262,21 +263,19 @@
 
         self.logger.debug("Registration via: {u}".format(u=self.url_reg))
 
-        __VDSM_ID = "/etc/vdsm/vdsm.id"
-
-        if self.vdsm_uuid and os.path.exists(__VDSM_ID):
+        if self.vdsm_uuid and os.path.exists(self.VDSM_ID_FILE):
             if utils.isOvirtNode():
                 from ovirt.node.utils.fs import Config
-                Config().unpersist(__VDSM_ID)
-            os.unlink(__VDSM_ID)
+                Config().unpersist(self.VDSM_ID_FILE)
+            os.unlink(self.VDSM_ID_FILE)
 
-        if not os.path.exists(__VDSM_ID):
-            with open(__VDSM_ID, 'wt') as f:
+        if not os.path.exists(self.VDSM_ID_FILE):
+            with open(self.VDSM_ID_FILE, 'wt') as f:
                 f.write(str(self.uuid))
 
             if utils.isOvirtNode():
                 from ovirt.node.utils.fs import Config
-                Config().persist(__VDSM_ID)
+                Config().persist(self.VDSM_ID_FILE)
 
         self.logger.info("Host UUID: {u}".format(u=self.uuid))
 
@@ -518,3 +517,5 @@
       &command=register&name=NODE_NAME&address=NO_FQDN_OR_IP
       &uniqueId=NODE_UUID&sshUser=SSH_USERNAME&sshPort=SSHD_PORT
 """
+
+# vim: set et sts=4:


-- 
To view, visit https://gerrit.ovirt.org/46977
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1601ec61a30971f175630013023e8be2de77da17
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Fabian Deutsch <[email protected]>
_______________________________________________
vdsm-patches mailing list
[email protected]
https://lists.fedorahosted.org/mailman/listinfo/vdsm-patches

Reply via email to