summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorƁukasz 'sil2100' Zemczak <lukasz.zemczak@ubuntu.com>2017-01-16 10:10:41 +0100
committerusd-importer <ubuntu-server@lists.ubuntu.com>2017-01-17 17:53:13 +0000
commitd064ab0bffd429382ea4fafeb144784d403848bd (patch)
tree28b0940943acfa742f484c2c0016e8f22c17124c /bin
parent63d399807de30a64456e672063e7c20babf7aadc (diff)
downloadvyos-walinuxagent-d064ab0bffd429382ea4fafeb144784d403848bd.tar.gz
vyos-walinuxagent-d064ab0bffd429382ea4fafeb144784d403848bd.zip
Import patches-unapplied version 2.2.2-0ubuntu1 to ubuntu/zesty-proposed
Imported using git-ubuntu import. Changelog parent: 63d399807de30a64456e672063e7c20babf7aadc New changelog entries: * New upstream release (LP: #1651128) - d/patches/fix-auto-update.patch, d/patches/lp1623570-adjust-walinuxagent-service-after-and-wants.patch: - Dropped as changes have been applied upstream - Refreshed debian/patches/disable_import_test.patch
Diffstat (limited to 'bin')
-rw-r--r--bin/waagent2.056
1 files changed, 2 insertions, 54 deletions
diff --git a/bin/waagent2.0 b/bin/waagent2.0
index abc4448..80af1c7 100644
--- a/bin/waagent2.0
+++ b/bin/waagent2.0
@@ -561,9 +561,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:
@@ -1769,7 +1768,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"):
@@ -2724,53 +2723,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.
@@ -5856,10 +5808,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()