From 6b48adeeceecb07eb276544ee241704939be4354 Mon Sep 17 00:00:00 2001 From: qingfuwang Date: Wed, 5 Nov 2014 11:21:44 +0800 Subject: [PATCH] change hard code wala configure path to MyDistro.getConfigurationPath() and ignore exception when get ctime of the configure file --- waagent | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/waagent b/waagent index 36bc63a..a90e9fd 100644 --- a/waagent +++ b/waagent @@ -5195,10 +5195,15 @@ class Agent(Util): if provisionError == None : provisioned = True SetFileContents(LibDir + "/provisioned", "") - lastCtime = os.path.getctime("/etc/waagent.conf") + lastCtime = "NOTFIND" + try: + walaConfigFile = MyDistro.getConfigurationPath() + lastCtime = time.ctime(os.path.getctime(walaConfigFile)) + except: + pass #Get Ctime of wala config, can help identify the base image of this VM AddExtensionEvent(name="WALA",op=WALAEventOperation.Provision,isSuccess=True, - message="WALA Config Ctime:"+time.ctime(lastCtime)) + message="WALA Config Ctime:"+lastCtime) # # only one port supported @@ -5504,7 +5509,7 @@ def Deprovision(force, deluser): """ #Append blank line at the end of file, so the ctime of this file is changed every time - Run("echo ''>>"+"/etc/waagent.conf") + Run("echo ''>>"+ MyDistro.getConfigurationPath()) SwitchCwd() ovfxml = GetFileContents(LibDir+"/ovf-env.xml")