Vinzenz Feenstra has uploaded a new change for review.

Change subject: agent: Windows Guest - ini file lookup
......................................................................

agent: Windows Guest - ini file lookup

The ini file is now expected to be in the same folder as the service
executable.

Change-Id: I4d1927a429fcb780119f78f8dc05999f3bae9148
Signed-off-by: Vinzenz Feenstra <vfeen...@redhat.com>
---
M ovirt-guest-agent/OVirtGuestService.py
1 file changed, 9 insertions(+), 11 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-guest-agent 
refs/changes/41/13341/1

diff --git a/ovirt-guest-agent/OVirtGuestService.py 
b/ovirt-guest-agent/OVirtGuestService.py
index 65ba8fd..239b7da 100644
--- a/ovirt-guest-agent/OVirtGuestService.py
+++ b/ovirt-guest-agent/OVirtGuestService.py
@@ -9,8 +9,8 @@
 import logging.config
 import servicemanager
 import ConfigParser
-# import os
-# import _winreg
+import os
+import _winreg
 
 AGENT_CONFIG = 'ovirt-guest-agent.ini'
 
@@ -32,15 +32,13 @@
         win32serviceutil.ServiceFramework.__init__(self, args)
         self._shutting_down = False
 
-        #global AGENT_CONFIG
-        #hkey = _winreg.OpenKey(
-        #   _winreg.HKEY_LOCAL_MACHINE,
-        #   "SOFTWARE\\Redhat\\RHEV\\Tools\\OVirt Guest Agent")
-        #AGENT_CONFIG = os.path.join(
-        #   _winreg.QueryValueEx(hkey,
-        #   "InstallDir")[0],
-        #   AGENT_CONFIG)
-        #hkey.Close()
+        global AGENT_CONFIG
+        hkey = _winreg.OpenKey(
+            _winreg.HKEY_LOCAL_MACHINE,
+            "System\\CurrentControlSet\\services\\%s" % self._svc_name_)
+        filePath = _winreg.QueryValueEx(hkey, "ImagePath")[0].replace('"', '')
+        filePath = os.path.dirname(filePath)
+        AGENT_CONFIG = os.path.join(filePath, AGENT_CONFIG)
 
         logging.config.fileConfig(AGENT_CONFIG)
 


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4d1927a429fcb780119f78f8dc05999f3bae9148
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-guest-agent
Gerrit-Branch: master
Gerrit-Owner: Vinzenz Feenstra <vfeen...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to