Hello community, here is the log from the commit of package WALinuxAgent for openSUSE:Factory checked in at 2014-12-16 14:48:29 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/WALinuxAgent (Old) and /work/SRC/openSUSE:Factory/.WALinuxAgent.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "WALinuxAgent" Changes: -------- --- /work/SRC/openSUSE:Factory/WALinuxAgent/WALinuxAgent.changes 2014-11-26 10:34:04.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.WALinuxAgent.new/WALinuxAgent.changes 2014-12-16 14:48:16.000000000 +0100 @@ -1,0 +2,9 @@ +Fri Dec 12 13:25:07 UTC 2014 - rschweik...@suse.com + +- Update to version 2.0.11 (bnc#909701) + + Implementation to support G-Series instances + + Multiple fixes for openSUSE-13.2+ + + Multiple fixes for FreeBSD + + Remove waagent-use-wicked-for-13_2.patch, now included in upstream source + +------------------------------------------------------------------- Old: ---- WALinuxAgent-2.0.9.tar.gz waagent-use-wicked-for-13_2.patch New: ---- WALinuxAgent-2.0.11.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ WALinuxAgent.spec ++++++ --- /var/tmp/diff_new_pack.TAFcYd/_old 2014-12-16 14:48:17.000000000 +0100 +++ /var/tmp/diff_new_pack.TAFcYd/_new 2014-12-16 14:48:17.000000000 +0100 @@ -20,13 +20,12 @@ Summary: The Windows Azure Linux Agent License: Apache-2.0 Group: System/Daemons -Version: 2.0.9 +Version: 2.0.11 Release: 0 Url: https://github.com/Azure/WALinuxAgent Source0: https://github.com/Azure/%{name}/archive/%{name}-%{version}.tar.gz Source1: 99-azure-timeout.rules Source2: README.SUSE -Patch0: waagent-use-wicked-for-13_2.patch BuildRequires: python-devel BuildRequires: python-setuptools @@ -72,7 +71,6 @@ %prep %setup -qn %{name}-%{name}-%{version} -%patch0 -p1 find . -type f -exec sed -i 's/\r//' {} + find . -type f -exec chmod 0644 {} + ++++++ WALinuxAgent-2.0.9.tar.gz -> WALinuxAgent-2.0.11.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/WALinuxAgent-WALinuxAgent-2.0.9/Changelog new/WALinuxAgent-WALinuxAgent-2.0.11/Changelog --- old/WALinuxAgent-WALinuxAgent-2.0.9/Changelog 2014-11-07 09:14:54.000000000 +0100 +++ new/WALinuxAgent-WALinuxAgent-2.0.11/Changelog 2014-12-11 10:04:31.000000000 +0100 @@ -1,5 +1,12 @@ WALinuxAgent Changelog ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| +11 Dec 2014, WALinuxAgent 2.0.11 + . Add support for GPT(Guid Partition Table) + +27 Nov 2014, WALinuxAgent 2.0.10 + . Multiple fixes for openSUSE-13.2+ + . Multiple fixes for FreeBSD + 06 Nov 2014, WALinuxAgent 2.0.9 . Add support for CoreOS . Add support for Fedora diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/WALinuxAgent-WALinuxAgent-2.0.9/fix-gpt-ubuntu.py new/WALinuxAgent-WALinuxAgent-2.0.11/fix-gpt-ubuntu.py --- old/WALinuxAgent-WALinuxAgent-2.0.9/fix-gpt-ubuntu.py 1970-01-01 01:00:00.000000000 +0100 +++ new/WALinuxAgent-WALinuxAgent-2.0.11/fix-gpt-ubuntu.py 2014-12-11 10:04:31.000000000 +0100 @@ -0,0 +1,39 @@ +#!/usr/bin/env python +# +# Copyright 2014 Microsoft Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Implements parts of RFC 2131, 1541, 1497 and +# http://msdn.microsoft.com/en-us/library/cc227282%28PROT.10%29.aspx +# http://msdn.microsoft.com/en-us/library/cc227259%28PROT.13%29.aspx +# + +import subprocess + +""" +WARNING: This script will remove all partitions in resource disk and create +a new one using the entire disk space. +""" +if __name__ == '__main__': + print 'Umnout resource disk...' + subprocess.call(['umount', '/dev/sdb1']) + print 'Remove old partitions...' + subprocess.call(['parted', '/dev/sdb', 'rm', '1']) + subprocess.call(['parted', '/dev/sdb', 'rm', '2']) + print 'Create new partition using the entire resource disk...' + subprocess.call(['parted', '/dev/sdb','mkpart', 'primary', '0%', '100%']) + subprocess.call(['mkfs.ext4', '/dev/sdb1']) + subprocess.call(['mount', '/dev/sdb1', '/mnt']) + print 'Resource disk(/dev/sdb1) is mounted at /mnt' + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/WALinuxAgent-WALinuxAgent-2.0.9/get-agent.py new/WALinuxAgent-WALinuxAgent-2.0.11/get-agent.py --- old/WALinuxAgent-WALinuxAgent-2.0.9/get-agent.py 1970-01-01 01:00:00.000000000 +0100 +++ new/WALinuxAgent-WALinuxAgent-2.0.11/get-agent.py 2014-12-11 10:04:31.000000000 +0100 @@ -0,0 +1,67 @@ +#!/usr/bin/env python +# +# Copyright 2014 Microsoft Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Implements parts of RFC 2131, 1541, 1497 and +# http://msdn.microsoft.com/en-us/library/cc227282%28PROT.10%29.aspx +# http://msdn.microsoft.com/en-us/library/cc227259%28PROT.13%29.aspx +# + +import sys +import os +import shutil +import imp +import subprocess +import time +import re +import platform + +def upgrade(): + #Define variables + account = 'Azure' + agentUri = ('https://raw.githubusercontent.com/{0}/' + 'WALinuxAgent/WALinuxAgent-2.0.11/waagent').format(account) + distro = platform.linux_distribution() + cmd = ['service', 'waagent', 'restart'] + agent_file="/usr/sbin/waagent" + + if "Ubuntu" in distro[0]: + cmd[1]='walinuxagent' + if "CoreOS" in distro[0]: + cmd = ['systemctl', 'restart', 'waagent'] + agent_file = "/usr/share/oem/bin/waagent" + + if os.path.isfile('waagent'): + os.remove('waagent') + print "Download WAAgent from: {0}".format(agentUri) + try: + import urllib2 + response = urllib2.urlopen(agentUri) + html = response.read() + with open("waagent", "w+") as F: + F.write(html) + except: + subprocess.call(['wget', agentUri]) + + print "Upgrade WAAgent" + + shutil.copyfile("waagent", agent_file) + os.chmod(agent_file, 0700) + + job = subprocess.Popen(cmd) + job.wait() + +if __name__ == '__main__': + upgrade() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/WALinuxAgent-WALinuxAgent-2.0.9/rpm/README new/WALinuxAgent-WALinuxAgent-2.0.11/rpm/README --- old/WALinuxAgent-WALinuxAgent-2.0.9/rpm/README 2014-11-07 09:14:54.000000000 +0100 +++ new/WALinuxAgent-WALinuxAgent-2.0.11/rpm/README 2014-12-11 10:04:31.000000000 +0100 @@ -4,16 +4,17 @@ package. This guide is primarily for individuals who would like to build their own custom packages. -OpenLogic provides supported RPM packages for CentOS in their package -repositories, for example +OpenLogic provides an RPM package for CentOS-based distributions +in their package repositories, for example http://olcentgbl.trafficmanager.net/openlogic/6/openlogic/x86_64/RPMS/ +http://olcentgbl.trafficmanager.net/openlogic/7/openlogic/x86_64/RPMS/ Note: Official packaging and other patches for SLES and OpenSUSE can be found on the OpenSUSE Build Service: https://build.opensuse.org/package/show?package=WALinuxAgent&project=Cloud%3ATools The instructions below will describe how you can build your own RPM -package on a CentOS host: +package: 1. Install required rpmbuild package: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/WALinuxAgent-WALinuxAgent-2.0.9/test/part-gpt.py new/WALinuxAgent-WALinuxAgent-2.0.11/test/part-gpt.py --- old/WALinuxAgent-WALinuxAgent-2.0.9/test/part-gpt.py 1970-01-01 01:00:00.000000000 +0100 +++ new/WALinuxAgent-WALinuxAgent-2.0.11/test/part-gpt.py 2014-12-11 10:04:31.000000000 +0100 @@ -0,0 +1,31 @@ +#!/usr/bin/env python +# +# Copyright 2014 Microsoft Corporation +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Implements parts of RFC 2131, 1541, 1497 and +# http://msdn.microsoft.com/en-us/library/cc227282%28PROT.10%29.aspx +# http://msdn.microsoft.com/en-us/library/cc227259%28PROT.13%29.aspx +# + +import subprocess + +if __name__ == '__main__': + subprocess.call(['umount', '/mnt/resource']) + subprocess.call(['umount', '/mnt']) + subprocess.call(['parted', '/dev/sdb', 'print']) + subprocess.call(['parted', '/dev/sdb', 'rm', '1']) + subprocess.call(['parted', '/dev/sdb', 'mklabel', 'gpt']) + subprocess.call(['parted', '/dev/sdb', 'mkpart', 'primary', '0%', '50%']) + subprocess.call(['parted', '/dev/sdb', 'mkpart', 'primary', '50%', '100%']) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/WALinuxAgent-WALinuxAgent-2.0.9/waagent new/WALinuxAgent-WALinuxAgent-2.0.11/waagent --- old/WALinuxAgent-WALinuxAgent-2.0.9/waagent 2014-11-07 09:14:54.000000000 +0100 +++ new/WALinuxAgent-WALinuxAgent-2.0.11/waagent 2014-12-11 10:04:31.000000000 +0100 @@ -80,7 +80,7 @@ GuestAgentName = "WALinuxAgent" GuestAgentLongName = "Windows Azure Linux Agent" -GuestAgentVersion = "WALinuxAgent-2.0.9" +GuestAgentVersion = "WALinuxAgent-2.0.11" ProtocolVersion = "2012-11-30" #WARNING this value is used to confirm the correct fabric protocol. Config = None @@ -173,12 +173,13 @@ self.ssh_config_file='/etc/ssh/sshd_config' self.hostname_file_path='/etc/hostname' self.dhcp_client_name='dhclient' - self.requiredDeps = [ 'route', 'shutdown', 'ssh-keygen', 'useradd' - , 'openssl', 'sfdisk', 'fdisk', 'mkfs', 'chpasswd', 'sed', 'grep', 'sudo' ] + self.requiredDeps = [ 'route', 'shutdown', 'ssh-keygen', 'useradd', + 'openssl', 'sfdisk', 'fdisk', 'mkfs', 'chpasswd', + 'sed', 'grep', 'sudo', 'parted' ] self.init_script_file='/etc/init.d/waagent' self.agent_package_name='WALinuxAgent' self.fileBlackList = [ "/root/.bash_history", "/var/log/waagent.log",'/etc/resolv.conf' ] - self.agent_files_to_uninstall = ["/etc/waagent.conf", "/etc/logrotate.d/waagent", "/etc/sudoers.d/waagent"] + self.agent_files_to_uninstall = ["/etc/waagent.conf", "/etc/logrotate.d/waagent"] self.grubKernelBootOptionsFile = '/etc/default/grub' self.grubKernelBootOptionsLine = 'GRUB_CMDLINE_LINUX_DEFAULT=' self.getpidcmd = 'pidof' @@ -475,13 +476,36 @@ fs = Config.get("ResourceDisk.Filesystem") if fs == None: fs = "ext3" - if RunGetOutput("sfdisk -q -c " + device + " 1")[1].rstrip() == "7" and fs != "ntfs": - Run("sfdisk -c " + device + " 1 83") - Run("mkfs." + fs + " " + device + "1") - if Run("mount " + device + "1 " + mountpoint): - Error("ActivateResourceDisk: Failed to mount resource disk (" + device + "1).") - return - Log("Resource disk (" + device + "1) is mounted at " + mountpoint + " with fstype " + fs) + + partition = device + "1" + + #Check partition type + Log("Detect GPT...") + ret = RunGetOutput("parted {0} print".format(device)) + if ret[0] == 0 and "gpt" in ret[1]: + Log("GPT detected.") + #GPT(Guid Partition Table) is used. + #Get partitions. + parts = filter(lambda x : re.match("^\s*[0-9]+", x), ret[1].split("\n")) + #If there are more than 1 partitions, remove all partitions + #and create a new one using the entire disk space. + if len(parts) > 1: + for i in range(1, len(parts) + 1): + Run("parted {0} rm {1}".format(device, i)) + Run("parted {0} mkpart primary 0% 100%".format(device)) + Run("mkfs." + fs + " " + partition + " -F") + else: + existingFS = RunGetOutput("sfdisk -q -c " + device + " 1", chk_err=False)[1].rstrip() + if existingFS == "7" and fs != "ntfs": + Run("sfdisk -c " + device + " 1 83") + Run("mkfs." + fs + " " + partition) + if Run("mount " + partition + " " + mountpoint): + #If mount failed, try to format the partition and mount again + Run("mkfs." + fs + " " + partition + " -F") + if Run("mount " + partition + " " + mountpoint): + Error("ActivateResourceDisk: Failed to mount resource disk (" + partition + ").") + return + Log("Resource disk (" + partition + ") is mounted at " + mountpoint + " with fstype " + fs) #Create README file under the root of resource disk SetFileContents(os.path.join(mountpoint,README_FILENAME), README_FILECONTENT) @@ -585,7 +609,13 @@ def getConfigurationPath(self): return "/etc/waagent.conf" - + + def getProcessorCores(self): + return int(RunGetOutput("grep 'processor.*:' /proc/cpuinfo |wc -l")[1]) + + def getTotalMemory(self): + return int(RunGetOutput("grep MemTotal /proc/meminfo |awk '{print $2}'")[1])/1024 + ############################################################ # GentooDistro ############################################################ @@ -790,7 +820,8 @@ self.requiredDeps += [ "/sbin/insserv" ] self.init_file=suse_init_file self.dhcp_client_name='dhcpcd' - if (DistInfo(fullname=1)[0] == 'SUSE Linux Enterprise Server') and (DistInfo()[1] >= '12'): + if ((DistInfo(fullname=1)[0] == 'SUSE Linux Enterprise Server' and DistInfo()[1] >= '12') or \ + (DistInfo(fullname=1)[0] == 'openSUSE' and DistInfo()[1] >= '13.2')): self.dhcp_client_name='wickedd-dhcp4' self.grubKernelBootOptionsFile = '/boot/grub/menu.lst' self.grubKernelBootOptionsLine = 'kernel' @@ -1611,6 +1642,7 @@ waagent.Error("ActivateResourceDisk: Failed to mount resource disk (" + device + "s1).") sys.exit(0) waagent.Log("Resource disk (" + device + "s1) is mounted at " + mountpoint + " with fstype " + fs) +waagent.SetFileContents(os.path.join(mountpoint,waagent.README_FILENAME), waagent.README_FILECONTENT) swap = Config.get("ResourceDisk.EnableSwap") if swap == None or swap.lower().startswith("n"): sys.exit(0) @@ -1648,7 +1680,7 @@ self.init_file=bsd_init_file self.agent_package_name='WALinuxAgent' self.fileBlackList = [ "/root/.bash_history", "/var/log/waagent.log",'/etc/resolv.conf' ] - self.agent_files_to_uninstall = ["/etc/waagent.conf", "/usr/local/etc/sudoers.d/waagent"] + self.agent_files_to_uninstall = ["/etc/waagent.conf"] self.grubKernelBootOptionsFile = '/boot/loader.conf' self.grubKernelBootOptionsLine = '' self.getpidcmd = 'pgrep -n' @@ -1802,7 +1834,8 @@ pass uidmin = None try: - uidmin = int(GetLineStartingWith("UID_MIN", "/etc/login.defs").split()[1]) + if os.path.isfile("/etc/login.defs"): + uidmin = int(GetLineStartingWith("UID_MIN", "/etc/login.defs").split()[1]) except: pass if uidmin == None: @@ -1869,7 +1902,8 @@ return uidmin = None try: - uidmin = int(GetLineStartingWith("UID_MIN", "/etc/login.defs").split()[1]) + if os.path.isfile("/etc/login.defs"): + uidmin = int(GetLineStartingWith("UID_MIN", "/etc/login.defs").split()[1]) except: pass if uidmin == None: @@ -1980,6 +2014,12 @@ def setBlockDeviceTimeout(self, device, timeout): return + def getProcessorCores(self): + return int(RunGetOutput("sysctl hw.ncpu | awk '{print $2}'")[1]) + + def getTotalMemory(self): + return int(RunGetOutput("sysctl hw.realmem | awk '{print $2}'")[1])/1024 + ############################################################ # END DISTRO CLASS DEFS ############################################################ @@ -2748,6 +2788,9 @@ """ def __init__(self): self.values = dict() + if 'MyDistro' not in globals(): + global MyDistro + MyDistro = GetMyDistro() walaConfigFile = MyDistro.getConfigurationPath() if os.path.isfile(walaConfigFile) == False: raise Exception("Missing configuration in {0}".format(walaConfigFile)) @@ -4433,8 +4476,8 @@ try: self.sysInfo["OSVersion"]=platform.system()+":"+"-".join(DistInfo())+":"+platform.release() self.sysInfo["GAVersion"]=GuestAgentVersion - self.sysInfo["RAM"]=int(RunGetOutput("grep MemTotal /proc/meminfo |awk '{print $2}'")[1])/1024 - self.sysInfo["Processors"]=int(RunGetOutput("grep 'processor.*:' /proc/cpuinfo |wc -l")[1]) + self.sysInfo["RAM"]=MyDistro.getTotalMemory() + self.sysInfo["Processors"]=MyDistro.getProcessorCores() sharedConfig = xml.dom.minidom.parse("/var/lib/waagent/SharedConfig.xml").childNodes[0] hostEnvConfig= xml.dom.minidom.parse("/var/lib/waagent/HostingEnvironmentConfig.xml").childNodes[0] gfiles = RunGetOutput("ls -t /var/lib/waagent/GoalState.*.xml")[1] @@ -5593,6 +5636,9 @@ for a in sys.argv[1:]: if re.match("^([-/]*)(help|usage|\?)", a): sys.exit(Usage()) + elif re.match("^([-/]*)version", a): + print(GuestAgentVersion + " running on " + LinuxDistro) + sys.exit(0) elif re.match("^([-/]*)verbose", a): myLogger.verbose = True elif re.match("^([-/]*)force", a): @@ -5618,9 +5664,6 @@ sys.exit(Deprovision(force, False)) elif re.match("^([-/]*)daemon", a): daemon = True - elif re.match("^([-/]*)version", a): - print(GuestAgentVersion + " running on " + LinuxDistro) - sys.exit(0) elif re.match("^([-/]*)serialconsole", a): AppendToLinuxKernelCmdline("console=ttyS0 earlyprintk=ttyS0") Log("Configured kernel to use ttyS0 as the boot console.") -- To unsubscribe, e-mail: opensuse-commit+unsubscr...@opensuse.org For additional commands, e-mail: opensuse-commit+h...@opensuse.org