summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Changelog7
-rw-r--r--debian/changelog12
-rw-r--r--debian/default4
-rw-r--r--debian/patches/000_use_package_upstart.patch16
-rw-r--r--debian/patches/000_use_packaged_upstart113
-rw-r--r--debian/patches/series2
-rw-r--r--waagent87
7 files changed, 208 insertions, 33 deletions
diff --git a/Changelog b/Changelog
index 98ce971..bfa33b3 100644
--- a/Changelog
+++ b/Changelog
@@ -1,6 +1,13 @@
WALinuxAgent Changelog
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
+18 Jan 2013, WALinuxAgent 1.3
+ . Add some error checking and robustness to DVD mounting operation during
+ provisioning
+ . Remove redundant check for IP and Port in LoadBalancerProbe
+ . Add check to self.computername to detect empty hostname in configuration
+ . Fix manual uninstall on Ubuntu
+
07 Dec 2012, WALinuxAgent 1.2
. Add Feature - ata_piix.ko module loaded if needed for CDROM device support
. Added Init_Ubuntu upstart support and improved resolvconf support on Ubuntu
diff --git a/debian/changelog b/debian/changelog
index 0ddef50..cab8551 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,15 @@
+walinuxagent (1.3-0ubuntu1) raring; urgency=low
+
+ * New upstream version (LP: #1101371)
+ - Add some error checking and robustness to DVD mounting operation during
+ provisioning
+ - Remove redundant check for IP and Port in LoadBalancerProbe
+ - Add check to self.computername to detect empty hostname in configuration
+ - Fix manual uninstall on Ubuntu
+ * Modified walinuxagent to recognize when its been packaged.
+
+ -- Ben Howard <ben.howard@ubuntu.com> Fri, 18 Jan 2013 15:43:08 -0700
+
walinuxagent (1.2-0ubuntu1) raring; urgency=low
* New upstream version (LP: #1077148)
diff --git a/debian/default b/debian/default
index a17174c..a6bdf50 100644
--- a/debian/default
+++ b/debian/default
@@ -1,2 +1,6 @@
# To disable the Windows Azure Agent, set WALINUXAGENT_ENABLED=0
WALINUXAGENT_ENABLED=1
+
+# Setting this variable to anything other than 1, runs the script
+# in stand-alone mode. This is heavily, heavily discouraged.
+WAXLINUXAGENT_PACKAGED=1
diff --git a/debian/patches/000_use_package_upstart.patch b/debian/patches/000_use_package_upstart.patch
deleted file mode 100644
index dce93cd..0000000
--- a/debian/patches/000_use_package_upstart.patch
+++ /dev/null
@@ -1,16 +0,0 @@
---- a/waagent
-+++ b/waagent
-@@ -2242,11 +2242,8 @@ def Install():
- Warn("Moved " + a + " -> " + LibDir + "/" + GetLastPathElement(a) )
-
- if IsUbuntu():
-- # Support for Ubuntu's upstart configuration
-- filename="waagent.conf"
-- filepath = "/etc/init/" + filename
-- SetFileContents(filepath, Init_Ubuntu)
-- os.chmod(filepath, 0644)
-+ # Use the Ubuntu packaged upstart job.
-+ Log("Using Ubuntu packaged upstart job. Skipping upstart installation")
-
- else:
- # Regular init.d configurations
diff --git a/debian/patches/000_use_packaged_upstart b/debian/patches/000_use_packaged_upstart
new file mode 100644
index 0000000..fa933a8
--- /dev/null
+++ b/debian/patches/000_use_packaged_upstart
@@ -0,0 +1,113 @@
+--- a/waagent
++++ b/waagent
+@@ -52,6 +52,7 @@ ProtocolVersion = "2011-12-31"
+
+ Config = None
+ LinuxDistro = "UNKNOWN"
++PackagedForDistro = "UNKNOWN"
+ Verbose = False
+ WaAgent = None
+ DiskActivated = False
+@@ -84,6 +85,18 @@ def DetectLinuxDistro():
+ return True
+ if os.path.isfile("/etc/lsb-release") and "Ubuntu" in GetFileContents("/etc/lsb-release"):
+ LinuxDistro = "Ubuntu"
++
++ # Should this run as if it is packaged Ubuntu?
++ if os.path.isfile("/etc/default/walinuxagent"):
++ try:
++ with open('/etc/default/walinuxagent') as f:
++ for line in f.readlines():
++ if line == "WAXLINUXAGENT_PACKAGED=1":
++ PackagedForDistro = "Ubuntu"
++
++ except IOError as e:
++ pass
++
+ return True
+ if os.path.isfile("/etc/debian_version"):
+ LinuxDistro = "Debian"
+@@ -99,12 +112,21 @@ def IsRedHat():
+ def IsUbuntu():
+ return "Ubuntu" in LinuxDistro
+
++def IsPackagedUbuntu():
++ return "Ubuntu" in PackagedForDistro
++
+ def IsDebian():
+ return IsUbuntu() or "Debian" in LinuxDistro
+
+ def IsSuse():
+ return "Suse" in LinuxDistro
+
++def IsPackaged():
++ if PackagedForDistro == "UNKNOWN":
++ return False
++
++ return True
++
+ def UsesRpm():
+ return IsRedHat() or IsSuse()
+
+@@ -2252,14 +2274,14 @@ def Install():
+ shutil.move(a, ".")
+ Warn("Moved " + a + " -> " + LibDir + "/" + GetLastPathElement(a) )
+
+- if IsUbuntu():
++ if IsUbuntu() and not IsPackagedUbuntu():
+ # Support for Ubuntu's upstart configuration
+ filename="waagent.conf"
+ filepath = "/etc/init/" + filename
+ SetFileContents(filepath, Init_Ubuntu)
+ os.chmod(filepath, 0644)
+
+- else:
++ elif not IsPackagedUbuntu():
+ # Regular init.d configurations
+ filename = "waagent"
+ filepath = "/etc/init.d/" + filename
+@@ -2273,6 +2295,7 @@ def Install():
+ SetFileContents(filepath, init[0])
+ os.chmod(filepath, 0755)
+ Run(init[1])
++
+ if os.path.isfile("/etc/waagent.conf"):
+ try:
+ os.remove("/etc/waagent.conf.old")
+@@ -2310,12 +2333,30 @@ def Uninstall():
+ if a == 0:
+ Error("Unable to detect Linux Distribution.")
+ return 1
+- Run("service " + filename + " stop")
+- cmd = ["chkconfig --del " + filename,
+- "update-rc.d -f " + filename + " remove",
+- "insserv -r " + filename][a - 1]
+- Run(cmd)
+- for f in os.listdir(LibDir) + ["/etc/init/waagent.conf","/etc/init.d/" + filename, "/etc/waagent.conf", "/etc/logrotate.d/waagent", "/etc/sudoers.d/waagent"]:
++
++ # Managed by dpkg for Packaged Ubuntu
++ if not IsPackaged():
++ Run("service " + filename + " stop")
++ cmd = ["chkconfig --del " + filename,
++ "update-rc.d -f " + filename + " remove",
++ "insserv -r " + filename][a - 1]
++ Run(cmd)
++
++ remove_f = [
++ "/etc/waagent.conf",
++ "/etc/logrotate.d/waagent",
++ "/etc/sudoers.d/waagent",
++ ]
++
++ # For packaged Ubuntu, the script should let the packaging
++ # manage the removal of these files
++ if not IsPackagedUbuntu():
++ remove_f.append([
++ "/etc/init/waagent.conf",
++ "/etc/init.d/" + filename,
++ ])
++
++ for f in os.listdir(LibDir) + remove_f:
+ try:
+ os.remove(f)
+ except:
diff --git a/debian/patches/series b/debian/patches/series
index fb42aae..4232496 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1 @@
-000_use_package_upstart.patch
+000_use_packaged_upstart
diff --git a/waagent b/waagent
index ab42009..8dd4ca2 100644
--- a/waagent
+++ b/waagent
@@ -47,11 +47,12 @@ import commands
GuestAgentName = "WALinuxAgent"
GuestAgentLongName = "Windows Azure Linux Agent"
-GuestAgentVersion = "WALinuxAgent-1.2"
+GuestAgentVersion = "WALinuxAgent-1.3"
ProtocolVersion = "2011-12-31"
Config = None
LinuxDistro = "UNKNOWN"
+PackagedForDistro = "UNKNOWN"
Verbose = False
WaAgent = None
DiskActivated = False
@@ -84,6 +85,18 @@ def DetectLinuxDistro():
return True
if os.path.isfile("/etc/lsb-release") and "Ubuntu" in GetFileContents("/etc/lsb-release"):
LinuxDistro = "Ubuntu"
+
+ # Should this run as if it is packaged Ubuntu?
+ if os.path.isfile("/etc/default/walinuxagent"):
+ try:
+ with open('/etc/default/walinuxagent') as f:
+ for line in f.readlines():
+ if line == "WAXLINUXAGENT_PACKAGED=1":
+ PackagedForDistro = "Ubuntu"
+
+ except IOError as e:
+ pass
+
return True
if os.path.isfile("/etc/debian_version"):
LinuxDistro = "Debian"
@@ -99,12 +112,21 @@ def IsRedHat():
def IsUbuntu():
return "Ubuntu" in LinuxDistro
+def IsPackagedUbuntu():
+ return "Ubuntu" in PackagedForDistro
+
def IsDebian():
return IsUbuntu() or "Debian" in LinuxDistro
def IsSuse():
return "Suse" in LinuxDistro
+def IsPackaged():
+ if PackagedForDistro == "UNKNOWN":
+ return False
+
+ return True
+
def UsesRpm():
return IsRedHat() or IsSuse()
@@ -166,13 +188,13 @@ def Run(a):
return os.system(a)
def RunSafe(cmd):
- LogIfVerbose(cmd)
+ Log(cmd)
# for python2.1 double try, in order to use a finally...
try:
try:
(exit_status,output) = commands.getstatusoutput(cmd)
except OSError,e : # just catch the exception and proceed
- LogIfVerbose( ("OSError " + str(e) + " caught") )
+ Log( ("OSError " + str(e) + " caught") )
return exit_status,output
else:
return exit_status,output
@@ -549,8 +571,6 @@ def LoadBalancerProbeServer(port):
class T(object):
def __init__(self, ip, port):
- if port == None or ip == None :
- return
self.ProbeCounter = 0
self.server = SocketServer.TCPServer((ip, port), TCPHandler)
self.server_thread = threading.Thread(target = self.server.serve_forever)
@@ -1272,6 +1292,8 @@ class OvfEnv(object):
def Process(self):
error = None
+ if self.ComputerName == None :
+ return "Error: Hostname missing"
error=WaAgent.EnvMonitor.SetHostName(self.ComputerName)
if error: return error
if self.DisableSshPasswordAuthentication:
@@ -1793,7 +1815,18 @@ class Agent(Util):
Log("Waiting for DVD - sleeping 1 - "+str(i+1)+" try...")
time.sleep(1)
CreateDir("/mnt/cdrom/secure", "root", 0700)
- Run("mount " + dvd + " /mnt/cdrom/secure")
+ #begin mount loop - ten tries - 5 sec wait between
+ for retry in range(1,11):
+ retcode,output=RunSafe("mount -v " + dvd + " /mnt/cdrom/secure")
+ Log(output)
+ if retcode:
+ Log("mount failed on attempt #" + str(retry) )
+ else:
+ Log("mount suceed on attempt #" + str(retry) )
+ break
+ Log("mount loop sleeping 5...")
+ time.sleep(5)
+
if not os.path.isfile("/mnt/cdrom/secure/ovf-env.xml"):
Error("Unable to provision: Missing ovf-env.xml on DVD.")
return "Failed to retrieve provisioning data (0x02)."
@@ -2241,11 +2274,14 @@ def Install():
shutil.move(a, ".")
Warn("Moved " + a + " -> " + LibDir + "/" + GetLastPathElement(a) )
- if IsUbuntu():
- # Use the Ubuntu packaged upstart job.
- Log("Using Ubuntu packaged upstart job. Skipping upstart installation")
+ if IsUbuntu() and not IsPackagedUbuntu():
+ # Support for Ubuntu's upstart configuration
+ filename="waagent.conf"
+ filepath = "/etc/init/" + filename
+ SetFileContents(filepath, Init_Ubuntu)
+ os.chmod(filepath, 0644)
- else:
+ elif not IsPackagedUbuntu():
# Regular init.d configurations
filename = "waagent"
filepath = "/etc/init.d/" + filename
@@ -2259,6 +2295,7 @@ def Install():
SetFileContents(filepath, init[0])
os.chmod(filepath, 0755)
Run(init[1])
+
if os.path.isfile("/etc/waagent.conf"):
try:
os.remove("/etc/waagent.conf.old")
@@ -2296,12 +2333,30 @@ def Uninstall():
if a == 0:
Error("Unable to detect Linux Distribution.")
return 1
- Run("service " + filename + " stop")
- cmd = ["chkconfig --del " + filename,
- "update-rc.d -f " + filename + " remove",
- "insserv -r " + filename][a - 1]
- Run(cmd)
- for f in os.listdir(LibDir) + ["/etc/init.d/" + filename, "/etc/waagent.conf", "/etc/logrotate.d/waagent", "/etc/sudoers.d/waagent"]:
+
+ # Managed by dpkg for Packaged Ubuntu
+ if not IsPackaged():
+ Run("service " + filename + " stop")
+ cmd = ["chkconfig --del " + filename,
+ "update-rc.d -f " + filename + " remove",
+ "insserv -r " + filename][a - 1]
+ Run(cmd)
+
+ remove_f = [
+ "/etc/waagent.conf",
+ "/etc/logrotate.d/waagent",
+ "/etc/sudoers.d/waagent",
+ ]
+
+ # For packaged Ubuntu, the script should let the packaging
+ # manage the removal of these files
+ if not IsPackagedUbuntu():
+ remove_f.append([
+ "/etc/init/waagent.conf",
+ "/etc/init.d/" + filename,
+ ])
+
+ for f in os.listdir(LibDir) + remove_f:
try:
os.remove(f)
except: