diff options
author | Ćukasz 'sil2100' Zemczak <lukasz.zemczak@ubuntu.com> | 2017-04-18 12:27:57 +0200 |
---|---|---|
committer | usd-importer <ubuntu-server@lists.ubuntu.com> | 2017-04-24 08:23:24 +0000 |
commit | 512b1e00ab9b75e46cc76af40c72cf239fa100e5 (patch) | |
tree | 533eeec1377dd0502725e57bad3225d2e82fd812 /azurelinuxagent/common/osutil | |
parent | c6339c307f36f77a4198d6faf1275acdf371200b (diff) | |
parent | 0f537ddd741bfb333dbc01b994013a2b4e75d26f (diff) | |
download | vyos-walinuxagent-512b1e00ab9b75e46cc76af40c72cf239fa100e5.tar.gz vyos-walinuxagent-512b1e00ab9b75e46cc76af40c72cf239fa100e5.zip |
Import patches-applied version 2.2.9-0ubuntu1 to applied/ubuntu/zesty-proposed
Imported using git-ubuntu import.
Changelog parent: c6339c307f36f77a4198d6faf1275acdf371200b
Unapplied parent: 0f537ddd741bfb333dbc01b994013a2b4e75d26f
New changelog entries:
* New upstream release (LP: #1683521).
Diffstat (limited to 'azurelinuxagent/common/osutil')
-rw-r--r-- | azurelinuxagent/common/osutil/default.py | 23 | ||||
-rw-r--r-- | azurelinuxagent/common/osutil/factory.py | 3 |
2 files changed, 18 insertions, 8 deletions
diff --git a/azurelinuxagent/common/osutil/default.py b/azurelinuxagent/common/osutil/default.py index 4cd379b..59d5985 100644 --- a/azurelinuxagent/common/osutil/default.py +++ b/azurelinuxagent/common/osutil/default.py @@ -18,6 +18,7 @@ import multiprocessing import os +import platform import re import shutil import socket @@ -420,7 +421,12 @@ class DefaultOSUtil(object): """ iface='' expected=16 # how many devices should I expect... - struct_size=40 # for 64bit the size is 40 bytes + + # for 64bit the size is 40 bytes + # for 32bit the size is 32 bytes + python_arc = platform.architecture()[0] + struct_size = 32 if python_arc == '32bit' else 40 + sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP) @@ -440,11 +446,11 @@ class DefaultOSUtil(object): if len(iface) == 0 or self.is_loopback(iface) or iface != primary: # test the next one if len(iface) != 0 and not self.disable_route_warning: - logger.info('interface [{0}] skipped'.format(iface)) + logger.info('Interface [{0}] skipped'.format(iface)) continue else: # use this one - logger.info('interface [{0}] selected'.format(iface)) + logger.info('Interface [{0}] selected'.format(iface)) break return iface.decode('latin-1'), socket.inet_ntoa(sock[i+20:i+24]) @@ -473,7 +479,7 @@ class DefaultOSUtil(object): primary_metric = None if not self.disable_route_warning: - logger.info("examine /proc/net/route for primary interface") + logger.info("Examine /proc/net/route for primary interface") with open('/proc/net/route') as routing_table: idx = 0 for header in filter(lambda h: len(h) > 0, routing_table.readline().strip(" \n").split("\t")): @@ -500,12 +506,13 @@ class DefaultOSUtil(object): if not self.disable_route_warning: with open('/proc/net/route') as routing_table_fh: routing_table_text = routing_table_fh.read() - logger.error('could not determine primary interface, ' - 'please ensure /proc/net/route is correct:\n' - '{0}'.format(routing_table_text)) + logger.warn('Could not determine primary interface, ' + 'please ensure /proc/net/route is correct') + logger.warn('Contents of /proc/net/route:\n{0}'.format(routing_table_text)) + logger.warn('Primary interface examination will retry silently') self.disable_route_warning = True else: - logger.info('primary interface is [{0}]'.format(primary)) + logger.info('Primary interface is [{0}]'.format(primary)) self.disable_route_warning = False return primary diff --git a/azurelinuxagent/common/osutil/factory.py b/azurelinuxagent/common/osutil/factory.py index acd7f6e..eee9f97 100644 --- a/azurelinuxagent/common/osutil/factory.py +++ b/azurelinuxagent/common/osutil/factory.py @@ -76,6 +76,9 @@ def get_osutil(distro_name=DISTRO_NAME, else: return RedhatOSUtil() + elif distro_name == "euleros": + return RedhatOSUtil() + elif distro_name == "freebsd": return FreeBSDOSUtil() |