summaryrefslogtreecommitdiff
path: root/bin/waagent2.0
diff options
context:
space:
mode:
Diffstat (limited to 'bin/waagent2.0')
-rw-r--r--bin/waagent2.056
1 files changed, 2 insertions, 54 deletions
diff --git a/bin/waagent2.0 b/bin/waagent2.0
index 8563554..74edc67 100644
--- a/bin/waagent2.0
+++ b/bin/waagent2.0
@@ -560,9 +560,8 @@ class AbstractDistro(object):
if os.path.isfile(mountpoint + "/swapfile") and os.path.getsize(mountpoint + "/swapfile") != (sizeKB * 1024):
os.remove(mountpoint + "/swapfile")
if not os.path.isfile(mountpoint + "/swapfile"):
- Run("dd if=/dev/zero of=" + mountpoint + "/swapfile bs=1024 count=" + str(sizeKB))
+ Run("umask 0077 && dd if=/dev/zero of=" + mountpoint + "/swapfile bs=1024 count=" + str(sizeKB))
Run("mkswap " + mountpoint + "/swapfile")
- Run("chmod 600 " + mountpoint + "/swapfile")
if not Run("swapon " + mountpoint + "/swapfile"):
Log("Enabled " + str(sizeKB) + " KB of swap at " + mountpoint + "/swapfile")
else:
@@ -1768,7 +1767,7 @@ sizeKB = int(Config.get("ResourceDisk.SwapSizeMB")) * 1024
if os.path.isfile(mountpoint + "/swapfile") and os.path.getsize(mountpoint + "/swapfile") != (sizeKB * 1024):
os.remove(mountpoint + "/swapfile")
if not os.path.isfile(mountpoint + "/swapfile"):
- Run("dd if=/dev/zero of=" + mountpoint + "/swapfile bs=1024 count=" + str(sizeKB))
+ Run("umask 0077 && dd if=/dev/zero of=" + mountpoint + "/swapfile bs=1024 count=" + str(sizeKB))
if Run("mdconfig -a -t vnode -f " + mountpoint + "/swapfile -u 0"):
waagent.Error("ActivateResourceDisk: Configuring swap - Failed to create md0")
if not Run("swapon /dev/md0"):
@@ -2723,53 +2722,6 @@ def DeviceForIdePort(n):
class HttpResourceGoneError(Exception):
pass
-def DoInstallRHUIRPM():
- """
- Install RHUI RPM according to VM region
- """
- rhuiRPMinstalled = os.path.exists(LibDir + "/rhuirpminstalled")
- if rhuiRPMinstalled:
- return
- else:
- SetFileContents(LibDir + "/rhuirpminstalled", "")
-
- Log("Begin to install RHUI RPM")
- cmd = "grep '<Location>' /var/lib/waagent/ExtensionsConfig* --no-filename | sed 's/<Location>//g' | sed 's/<\/Location>//g' | sed 's/ //g' | tr 'A-Z' 'a-z' | uniq"
-
- retcode,out = RunGetOutput(cmd, True)
- region = out.rstrip("\n")
-
- #try a few times at most to get the region info
- retry = 0
- for i in range(0, 8):
- if (region != ""):
- break
- Log("region info is empty, now wait 15 seconds...")
- time.sleep(15)
- retcode,out = RunGetOutput(cmd, True)
- region = out.rstrip("\n")
-
- if region == "":
- Log("could not detect region info, now use the default region: eastus2")
- region = "eastus2"
-
- scriptFilePath = "/tmp/install-rhui-rpm.sh"
-
- if not os.path.exists(scriptFilePath):
- Error(scriptFilePath + " does not exist, now quit RHUI RPM installation.");
- return
- #chmod a+x script file
- os.chmod(scriptFilePath, 0100)
- Log("begin to run " + scriptFilePath)
-
- #execute the downloaded script file
- retcode,out = RunGetOutput(scriptFilePath, True)
- if retcode != 0:
- Error("execute script " + scriptFilePath + " failed, return code: " + str(retcode) + ", now exit RHUI RPM installation.");
- return
-
- Log("install RHUI RPM completed")
-
class Util(object):
"""
Http communication class.
@@ -5855,10 +5807,6 @@ class Agent(Util):
Log("Successfully reported handler status")
reportHandlerStatusCount += 1
- global LinuxDistro
- if LinuxDistro == "redhat":
- DoInstallRHUIRPM()
-
if not eventMonitor:
eventMonitor = WALAEventMonitor(self.HttpPostWithHeaders)
eventMonitor.StartEventsLoop()