[node-patches] Change in ovirt-node[master]: rhn: Make rhn_check file based

fabiand at fedoraproject.org fabiand at fedoraproject.org
Wed Dec 5 17:53:17 UTC 2012


Fabian Deutsch has uploaded a new change for review.

Change subject: rhn: Make rhn_check file based
......................................................................

rhn: Make rhn_check file based

Previously the rhn_check scripts was used to determin if a Node was
connected to RHN, this could lead to slow page loading times in cases
where RHN or the network connection was slow. The new approach looks for
a specififc file which exists if the Node is registered.

rhbz#816900

Change-Id: I9042f99628bded3adb5b9827202762e399dfa28f
Signed-off-by: Fabian Deutsch <fabiand at fedoraproject.org>
---
M scripts/rhn.py
1 file changed, 11 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-node refs/changes/54/9754/1

diff --git a/scripts/rhn.py b/scripts/rhn.py
index 2dd1932..33a4281 100755
--- a/scripts/rhn.py
+++ b/scripts/rhn.py
@@ -310,13 +310,18 @@
 
 
 def rhn_check():
-    rhncheck_cmd = subprocess_closefds("rhn_check", shell=False,
-                                       stdout=PIPE, stderr=STDOUT)
-    rhncheck = rhncheck_cmd.communicate()[0]
-    if rhncheck_cmd.returncode == 0:
-        return True
+    filebased = True
+    registered = False
+    if filebased:
+        # Thefollowing file exists when the sys is registered with rhn
+        registered = os.path.exists("/etc/sysconfig/rhn/systemid")
     else:
-        return False
+        rhncheck_cmd = subprocess_closefds("rhn_check", shell=False,
+                                           stdout=PIPE, stderr=STDOUT)
+        rhncheck = rhncheck_cmd.communicate()[0]
+        if rhncheck_cmd.returncode == 0:
+            registered = True
+    return registered
 
 
 def sam_check():


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9042f99628bded3adb5b9827202762e399dfa28f
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-node
Gerrit-Branch: master
Gerrit-Owner: Fabian Deutsch <fabiand at fedoraproject.org>



More information about the node-patches mailing list