diff options
author | Steve Wills <swills@FreeBSD.org> | 2018-06-14 19:07:49 +0000 |
---|---|---|
committer | Steve Wills <swills@FreeBSD.org> | 2018-06-14 19:07:49 +0000 |
commit | 50376e5d56ac6e6482098337d99534a402d6b055 (patch) | |
tree | 3cdcc1ba7b1cee34db7d6d266b3bbb62355c1004 /sysutils | |
parent | 5970ce846db39e36b70f2e1f0624ac850575e08b (diff) | |
download | ports-50376e5d56ac6e6482098337d99534a402d6b055.tar.gz ports-50376e5d56ac6e6482098337d99534a402d6b055.zip |
Notes
Diffstat (limited to 'sysutils')
20 files changed, 210 insertions, 203 deletions
diff --git a/sysutils/py-google-compute-engine/Makefile b/sysutils/py-google-compute-engine/Makefile index 03ca3bd822c2..324b60c48575 100644 --- a/sysutils/py-google-compute-engine/Makefile +++ b/sysutils/py-google-compute-engine/Makefile @@ -1,8 +1,7 @@ # $FreeBSD$ PORTNAME= google-compute-engine -DISTVERSION= 2.7.6 -PORTREVISION= 4 +DISTVERSION= 2.8.3 CATEGORIES= sysutils python MASTER_SITES= CHEESESHOP PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX} @@ -24,10 +23,9 @@ USE_PYTHON= autoplist concurrent distutils NO_ARCH= yes USE_RC_SUBR= google_instance_setup \ - google_network_setup \ google_accounts_daemon \ google_clock_skew_daemon \ - google_ip_forwarding_daemon \ + google_network_daemon \ google_startup SUB_LIST= PYTHON_CMD="${PYTHON_CMD}" diff --git a/sysutils/py-google-compute-engine/distinfo b/sysutils/py-google-compute-engine/distinfo index 0ff3d5b8eeb1..3e0acc4dfcbc 100644 --- a/sysutils/py-google-compute-engine/distinfo +++ b/sysutils/py-google-compute-engine/distinfo @@ -1,3 +1,3 @@ -TIMESTAMP = 1522049559 -SHA256 (google-compute-engine-2.7.6.tar.gz) = 23c764f2fc72db5a0b81cb8f8029c4e5d152bd50faf1eb7322b4a4cff039d003 -SIZE (google-compute-engine-2.7.6.tar.gz) = 40742 +TIMESTAMP = 1528807896 +SHA256 (google-compute-engine-2.8.3.tar.gz) = 14947a0cfc20e1d64d1184bbd137b9f3b66d7c94efcbe1b73e21c090e7002af4 +SIZE (google-compute-engine-2.8.3.tar.gz) = 45988 diff --git a/sysutils/py-google-compute-engine/files/google_accounts_daemon.in b/sysutils/py-google-compute-engine/files/google_accounts_daemon.in index a7c397a19364..d6b6fa4b8e5c 100644 --- a/sysutils/py-google-compute-engine/files/google_accounts_daemon.in +++ b/sysutils/py-google-compute-engine/files/google_accounts_daemon.in @@ -4,7 +4,7 @@ # # PROVIDE: google_accounts_daemon # BEFORE: LOGIN -# REQUIRE: NETWORKING syslogd google_instance_setup google_network_setup +# REQUIRE: NETWORKING syslogd google_instance_setup google_network_daemon # KEYWORD: shutdown # # google_accounts_daemon_enable (bool): Set to NO by default. @@ -13,6 +13,9 @@ . /etc/rc.subr +# Required to execute scripts +export PATH=%%LOCALBASE%%/bin:$PATH + name="google_accounts_daemon" rcvar="google_accounts_daemon_enable" diff --git a/sysutils/py-google-compute-engine/files/google_clock_skew_daemon.in b/sysutils/py-google-compute-engine/files/google_clock_skew_daemon.in index 93b5635d3358..66a71daa0c15 100644 --- a/sysutils/py-google-compute-engine/files/google_clock_skew_daemon.in +++ b/sysutils/py-google-compute-engine/files/google_clock_skew_daemon.in @@ -4,7 +4,7 @@ # # PROVIDE: google_clock_skew_daemon # BEFORE: LOGIN -# REQUIRE: NETWORKING syslogd ntpd google_instance_setup google_network_setup +# REQUIRE: NETWORKING syslogd ntpd google_instance_setup google_network_daemon # KEYWORD: shutdown # # google_clock_skew_daemon_enable (bool): Set to NO by default. diff --git a/sysutils/py-google-compute-engine/files/google_ip_forwarding_daemon.in b/sysutils/py-google-compute-engine/files/google_network_daemon.in index 6dceb615449f..da9b44538519 100644 --- a/sysutils/py-google-compute-engine/files/google_ip_forwarding_daemon.in +++ b/sysutils/py-google-compute-engine/files/google_network_daemon.in @@ -2,30 +2,30 @@ # $FreeBSD$ # -# PROVIDE: google_ip_forwarding_daemon +# PROVIDE: google_network_daemon # BEFORE: LOGIN -# REQUIRE: NETWORKING syslogd google_instance_setup google_network_setup +# REQUIRE: NETWORKING syslogd google_instance_setup google_network_daemon # KEYWORD: shutdown # -# google_ip_forwarding_daemon_enable (bool): Set to NO by default. -# Set it to YES to enable google_ip_forwarding_daemon. +# google_network_daemon_enable (bool): Set to NO by default. +# Set it to YES to enable google_network_daemon. # . /etc/rc.subr -name="google_ip_forwarding_daemon" -rcvar="google_ip_forwarding_daemon_enable" +name="google_network_daemon" +rcvar="google_network_daemon_enable" load_rc_config "${name}" -: ${google_ip_forwarding_daemon_enable:="NO"} +: ${google_network_daemon_enable:="NO"} command_interpreter="%%PYTHON_CMD%%" command=%%PREFIX%%/bin/${name} pidfile=/var/run/${name}.pid -start_cmd="google_ip_forwarding_daemon_start" +start_cmd="google_network_daemon_start" -google_ip_forwarding_daemon_start() +google_network_daemon_start() { check_startmsgs && echo "Starting ${name}." daemon -p ${pidfile} -t ${name} ${command} diff --git a/sysutils/py-google-compute-engine/files/google_network_setup.in b/sysutils/py-google-compute-engine/files/google_network_setup.in deleted file mode 100644 index 0c12e64ebfdb..000000000000 --- a/sysutils/py-google-compute-engine/files/google_network_setup.in +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh - -# $FreeBSD$ -# -# PROVIDE: google_network_setup -# BEFORE: LOGIN -# REQUIRE: NETWORKING syslogd google_instance_setup -# -# google_network_setup_enable (bool): Set to NO by default. -# Set it to YES to enable google_network_setup. -# - -. /etc/rc.subr - -name="google_network_setup" -rcvar="google_network_setup_enable" -stop_cmd=":" - -load_rc_config "${name}" - -: ${google_network_setup_enable:="NO"} - -command_interpreter="%%PYTHON_CMD%%" -command=%%PREFIX%%/bin/${name} -pidfile=/var/run/${name}.pid - -run_rc_command "$1" diff --git a/sysutils/py-google-compute-engine/files/google_startup.in b/sysutils/py-google-compute-engine/files/google_startup.in index a4fe3456ebe3..a3fd8004d557 100644 --- a/sysutils/py-google-compute-engine/files/google_startup.in +++ b/sysutils/py-google-compute-engine/files/google_startup.in @@ -4,7 +4,7 @@ # # PROVIDE: google_startup # BEFORE: LOGIN -# REQUIRE: NETWORKING syslogd google_instance_setup google_network_setup +# REQUIRE: NETWORKING syslogd google_instance_setup google_network_daemon # KEYWORD: shutdown # # google_startup_enable (bool): Set to NO by default. diff --git a/sysutils/py-google-compute-engine/files/instance_configs.cfg.distro.sample b/sysutils/py-google-compute-engine/files/instance_configs.cfg.distro.sample index 6c1cbce9be49..cd1519c9b42c 100644 --- a/sysutils/py-google-compute-engine/files/instance_configs.cfg.distro.sample +++ b/sysutils/py-google-compute-engine/files/instance_configs.cfg.distro.sample @@ -3,3 +3,6 @@ useradd_cmd = pw useradd {user} -m userdel_cmd = pw userdel {user} -r usermod_cmd = pw usermod {user} -G {groups} groupadd_cmd = pw groupadd {group} + +[MetadataScripts] +default_shell = /bin/bash diff --git a/sysutils/py-google-compute-engine/files/patch-google__compute__engine_clock__skew_clock__skew__daemon.py b/sysutils/py-google-compute-engine/files/patch-google__compute__engine_clock__skew_clock__skew__daemon.py deleted file mode 100644 index 9e0455097ab0..000000000000 --- a/sysutils/py-google-compute-engine/files/patch-google__compute__engine_clock__skew_clock__skew__daemon.py +++ /dev/null @@ -1,17 +0,0 @@ ---- google_compute_engine/clock_skew/clock_skew_daemon.py.orig 2017-09-14 18:08:49 UTC -+++ google_compute_engine/clock_skew/clock_skew_daemon.py -@@ -59,9 +59,12 @@ class ClockSkewDaemon(object): - response: string, the metadata response with the new drift token value. - """ - self.logger.info('Clock drift token has changed: %s.', response) -- command = ['/sbin/hwclock', '--hctosys'] -+ -+ ntpd_inactive = subprocess.call(['service', 'ntpd', 'status']) - try: -- subprocess.check_call(command) -+ if not ntpd_inactive: subprocess.check_call(['service', 'ntpd', 'stop']) -+ subprocess.check_call('ntpdate `awk \'$1=="server" {print $2}\' /etc/ntp.conf`', shell=True) -+ if not ntpd_inactive: subprocess.check_call(['service', 'ntpd', 'start']) - except subprocess.CalledProcessError: - self.logger.warning('Failed to sync system time with hardware clock.') - else: diff --git a/sysutils/py-google-compute-engine/files/patch-google__compute__engine_constants.py b/sysutils/py-google-compute-engine/files/patch-google__compute__engine_constants.py new file mode 100644 index 000000000000..7bf73353a162 --- /dev/null +++ b/sysutils/py-google-compute-engine/files/patch-google__compute__engine_constants.py @@ -0,0 +1,11 @@ +--- google_compute_engine/constants.py.orig 2018-06-11 23:51:09 UTC ++++ google_compute_engine/constants.py +@@ -18,7 +18,7 @@ + import platform + + OSLOGIN_CONTROL_SCRIPT = 'google_oslogin_control' +-OSLOGIN_NSS_CACHE = '/etc/oslogin_passwd.cache' ++OSLOGIN_NSS_CACHE = '/usr/local/etc/oslogin_passwd.cache' + OSLOGIN_NSS_CACHE_SCRIPT = 'google_oslogin_nss_cache' + + if platform.system() == 'FreeBSD': diff --git a/sysutils/py-google-compute-engine/files/patch-google__compute__engine_instance__setup_instance__config.py b/sysutils/py-google-compute-engine/files/patch-google__compute__engine_instance__setup_instance__config.py index 1c9fe55d1349..610e962d9a25 100644 --- a/sysutils/py-google-compute-engine/files/patch-google__compute__engine_instance__setup_instance__config.py +++ b/sysutils/py-google-compute-engine/files/patch-google__compute__engine_instance__setup_instance__config.py @@ -1,6 +1,6 @@ ---- google_compute_engine/instance_setup/instance_config.py.orig 2018-02-22 19:44:17 UTC +--- google_compute_engine/instance_setup/instance_config.py.orig 2018-06-11 23:51:09 UTC +++ google_compute_engine/instance_setup/instance_config.py -@@ -73,11 +73,11 @@ class InstanceConfig(config_manager.Conf +@@ -74,11 +74,11 @@ class InstanceConfig(config_manager.Conf }, 'InstanceSetup': { 'host_key_types': 'ecdsa,ed25519,rsa', diff --git a/sysutils/py-google-compute-engine/files/patch-google__compute__engine_instance__setup_instance__setup.py b/sysutils/py-google-compute-engine/files/patch-google__compute__engine_instance__setup_instance__setup.py deleted file mode 100644 index 477357bf9d67..000000000000 --- a/sysutils/py-google-compute-engine/files/patch-google__compute__engine_instance__setup_instance__setup.py +++ /dev/null @@ -1,19 +0,0 @@ ---- google_compute_engine/instance_setup/instance_setup.py.orig 2017-09-14 18:08:49 UTC -+++ google_compute_engine/instance_setup/instance_setup.py -@@ -146,12 +146,12 @@ class InstanceSetup(object): - # Instance setup systemd scripts block sshd from starting. - if os.path.exists(constants.LOCALBASE + '/bin/systemctl'): - return -- elif (os.path.exists('/etc/init.d/ssh') or -- os.path.exists('/etc/init/ssh.conf')): -+ elif (os.path.exists('/etc/rc.d/ssh') or -+ os.path.exists('/etc/rc/ssh.conf')): - subprocess.call(['service', 'ssh', 'start']) - subprocess.call(['service', 'ssh', 'reload']) -- elif (os.path.exists('/etc/init.d/sshd') or -- os.path.exists('/etc/init/sshd.conf')): -+ elif (os.path.exists('/etc/rc.d/sshd') or -+ os.path.exists('/etc/rc/sshd.conf')): - subprocess.call(['service', 'sshd', 'start']) - subprocess.call(['service', 'sshd', 'reload']) - diff --git a/sysutils/py-google-compute-engine/files/patch-google__compute__engine_ip__forwarding_ip__forwarding__daemon.py b/sysutils/py-google-compute-engine/files/patch-google__compute__engine_ip__forwarding_ip__forwarding__daemon.py deleted file mode 100644 index 7a2b2b802f52..000000000000 --- a/sysutils/py-google-compute-engine/files/patch-google__compute__engine_ip__forwarding_ip__forwarding__daemon.py +++ /dev/null @@ -1,25 +0,0 @@ ---- google_compute_engine/ip_forwarding/ip_forwarding_daemon.py.orig 2017-09-14 18:08:49 UTC -+++ google_compute_engine/ip_forwarding/ip_forwarding_daemon.py -@@ -137,20 +137,20 @@ class IpForwardingDaemon(object): - Args: - result: dict, the metadata response with the new network interfaces. - """ -+ ip_addresses = [] - for network_interface in result: - mac_address = network_interface.get('mac') - interface = self.network_utils.GetNetworkInterface(mac_address) -- ip_addresses = [] - if interface: - ip_addresses.extend(network_interface.get('forwardedIps', [])) - if self.ip_aliases: - ip_addresses.extend(network_interface.get('ipAliases', [])) - if self.target_instance_ips: - ip_addresses.extend(network_interface.get('targetInstanceIps', [])) -- self._HandleForwardedIps(ip_addresses, interface) - else: - message = 'Network interface not found for MAC address: %s.' - self.logger.warning(message, mac_address) -+ self._HandleForwardedIps(ip_addresses, 'lo' + self.ip_forwarding_utils.proto_id) - - - def main(): diff --git a/sysutils/py-google-compute-engine/files/patch-google__compute__engine_ip__forwarding_ip__forwarding__utils.py b/sysutils/py-google-compute-engine/files/patch-google__compute__engine_ip__forwarding_ip__forwarding__utils.py deleted file mode 100644 index f769a11294f4..000000000000 --- a/sysutils/py-google-compute-engine/files/patch-google__compute__engine_ip__forwarding_ip__forwarding__utils.py +++ /dev/null @@ -1,77 +0,0 @@ ---- google_compute_engine/ip_forwarding/ip_forwarding_utils.py.orig 2017-09-14 18:08:49 UTC -+++ google_compute_engine/ip_forwarding/ip_forwarding_utils.py -@@ -17,6 +17,8 @@ - - import re - import subprocess -+import netifaces -+import netaddr - - IP_REGEX = re.compile(r'\A(\d{1,3}\.){3}\d{1,3}\Z') - IP_ALIAS_REGEX = re.compile(r'\A(\d{1,3}\.){3}\d{1,3}/\d{1,2}\Z') -@@ -51,8 +53,8 @@ class IpForwardingUtils(object): - options.update(kwargs) - return options - -- def _RunIpRoute(self, args=None, options=None): -- """Run a command with ip route and return the response. -+ def _RunIfconfig(self, args=None, options=None): -+ """Run a command with ifconfig and return the response. - - Args: - args: list, the string ip route command args to execute. -@@ -63,7 +65,7 @@ class IpForwardingUtils(object): - """ - args = args or [] - options = options or {} -- command = ['ip', 'route'] -+ command = ['ifconfig'] - command.extend(args) - for item in options.items(): - command.extend(item) -@@ -108,10 +110,15 @@ class IpForwardingUtils(object): - Returns: - list, the IP address strings. - """ -- args = ['ls', 'table', 'local', 'type', 'local'] -- options = self._CreateRouteOptions(dev=interface) -- result = self._RunIpRoute(args=args, options=options) -- return self.ParseForwardedIps(result.split()) -+ try: -+ ips = netifaces.ifaddresses('lo' + self.proto_id) -+ ips = ips[netifaces.AF_INET] -+ except (ValueError, KeyError) as e: -+ return [] -+ forwarded_ips = [] -+ for ip in ips: -+ forwarded_ips.append(ip['addr'] + '/' + str(netaddr.IPAddress(ip['netmask']).netmask_bits())) -+ return self.ParseForwardedIps(forwarded_ips) - - def AddForwardedIp(self, address, interface): - """Configure a new IP address on the network interface. -@@ -121,9 +128,12 @@ class IpForwardingUtils(object): - interface: string, the output device to use. - """ - address = address if IP_ALIAS_REGEX.match(address) else '%s/32' % address -- args = ['add', 'to', 'local', address] -- options = self._CreateRouteOptions(dev=interface) -- self._RunIpRoute(args=args, options=options) -+ cmd = 'alias' -+ try: -+ forwarded_ips = netifaces.ifaddresses(interface) -+ except (ValueError, KeyError) as e: -+ cmd = 'create' -+ self._RunIfconfig(args=[interface, cmd, address]) - - def RemoveForwardedIp(self, address, interface): - """Delete an IP address on the network interface. -@@ -132,7 +142,5 @@ class IpForwardingUtils(object): - address: string, the IP address to configure. - interface: string, the output device to use. - """ -- address = address if IP_ALIAS_REGEX.match(address) else '%s/32' % address -- args = ['delete', 'to', 'local', address] -- options = self._CreateRouteOptions(dev=interface) -- self._RunIpRoute(args=args, options=options) -+ address = address if IP_REGEX.match(address) else address[:-3] -+ self._RunIfconfig(args=[interface, '-alias', address]) diff --git a/sysutils/py-google-compute-engine/files/patch-google__compute__engine_metadata__scripts_script__executor.py b/sysutils/py-google-compute-engine/files/patch-google__compute__engine_metadata__scripts_script__executor.py deleted file mode 100644 index 302eacff6260..000000000000 --- a/sysutils/py-google-compute-engine/files/patch-google__compute__engine_metadata__scripts_script__executor.py +++ /dev/null @@ -1,11 +0,0 @@ ---- google_compute_engine/metadata_scripts/script_executor.py.orig 2018-02-22 19:44:17 UTC -+++ google_compute_engine/metadata_scripts/script_executor.py -@@ -53,7 +53,7 @@ class ScriptExecutor(object): - """ - process = subprocess.Popen( - metadata_script, shell=True, -- executable=constants.LOCALBASE + '/bin/bash', -+ executable='/bin/sh', - stderr=subprocess.STDOUT, stdout=subprocess.PIPE) - while True: - for line in iter(process.stdout.readline, b''): diff --git a/sysutils/py-google-compute-engine/files/patch-google__compute__engine_networking_ip__forwarding_ip__forwarding.py b/sysutils/py-google-compute-engine/files/patch-google__compute__engine_networking_ip__forwarding_ip__forwarding.py new file mode 100644 index 000000000000..deb138d798d4 --- /dev/null +++ b/sysutils/py-google-compute-engine/files/patch-google__compute__engine_networking_ip__forwarding_ip__forwarding.py @@ -0,0 +1,22 @@ +--- google_compute_engine/networking/ip_forwarding/ip_forwarding.py.orig 2018-06-11 23:51:09 UTC ++++ google_compute_engine/networking/ip_forwarding/ip_forwarding.py +@@ -85,15 +85,17 @@ class IpForwarding(object): + for address in forwarded_ips: + self.ip_forwarding_utils.RemoveForwardedIp(address, interface) + +- def HandleForwardedIps(self, interface, forwarded_ips): ++ def HandleForwardedIps(self, interface, forwarded_ips, interface_ip): + """Handle changes to the forwarded IPs on a network interface. + + Args: + interface: string, the output device to configure. + forwarded_ips: list, the forwarded IP address strings desired. ++ interface_ip: string, current interface ip address. + """ + desired = self.ip_forwarding_utils.ParseForwardedIps(forwarded_ips) +- configured = self.ip_forwarding_utils.GetForwardedIps(interface) ++ configured = self.ip_forwarding_utils.GetForwardedIps( ++ interface, interface_ip) + to_add = sorted(set(desired) - set(configured)) + to_remove = sorted(set(configured) - set(desired)) + self._LogForwardedIpChanges( diff --git a/sysutils/py-google-compute-engine/files/patch-google__compute__engine_networking_ip__forwarding_ip__forwarding__utils.py b/sysutils/py-google-compute-engine/files/patch-google__compute__engine_networking_ip__forwarding_ip__forwarding__utils.py new file mode 100644 index 000000000000..72cb8ddc03d3 --- /dev/null +++ b/sysutils/py-google-compute-engine/files/patch-google__compute__engine_networking_ip__forwarding_ip__forwarding__utils.py @@ -0,0 +1,115 @@ +--- google_compute_engine/networking/ip_forwarding/ip_forwarding_utils.py.orig 2018-06-11 23:51:09 UTC ++++ google_compute_engine/networking/ip_forwarding/ip_forwarding_utils.py +@@ -15,6 +15,8 @@ + + """Utilities for configuring IP address forwarding.""" + ++import netaddr ++import netifaces + import re + import subprocess + +@@ -32,27 +34,11 @@ class IpForwardingUtils(object): + logger: logger object, used to write to SysLog and serial port. + proto_id: string, the routing protocol identifier for Google IP changes. + """ +- self.logger = logger +- self.proto_id = proto_id or '66' + +- def _CreateRouteOptions(self, **kwargs): +- """Create a dictionary of parameters to append to the ip route command. +- +- Args: +- **kwargs: dict, the string parameters to update in the ip route command. +- +- Returns: +- dict, the string parameters to append to the ip route command. +- """ +- options = { +- 'proto': self.proto_id, +- 'scope': 'host', +- } +- options.update(kwargs) +- return options ++ self.logger = logger + +- def _RunIpRoute(self, args=None, options=None): +- """Run a command with ip route and return the response. ++ def _RunIfconfig(self, args=None, options=None): ++ """Run a command with ifconfig and return the response. + + Args: + args: list, the string ip route command args to execute. +@@ -63,7 +49,7 @@ class IpForwardingUtils(object): + """ + args = args or [] + options = options or {} +- command = ['ip', 'route'] ++ command = ['ifconfig'] + command.extend(args) + for item in options.items(): + command.extend(item) +@@ -94,25 +80,33 @@ class IpForwardingUtils(object): + forwarded_ips = forwarded_ips or [] + for ip in forwarded_ips: + if ip and (IP_REGEX.match(ip) or IP_ALIAS_REGEX.match(ip)): +- addresses.append(ip[:-3] if ip.endswith('/32') else ip) ++ addresses.extend([str(addr) for addr in list(netaddr.IPNetwork(ip))]) + else: + self.logger.warning('Could not parse IP address: "%s".', ip) + return addresses + +- def GetForwardedIps(self, interface): ++ def GetForwardedIps(self, interface, interface_ip): + """Retrieve the list of configured forwarded IP addresses. + + Args: + interface: string, the output device to query. ++ interface_ip: string, current interface ip address. + + Returns: + list, the IP address strings. + """ +- args = ['ls', 'table', 'local', 'type', 'local'] +- options = self._CreateRouteOptions(dev=interface) +- result = self._RunIpRoute(args=args, options=options) +- result = re.sub(r'local\s', r'', result) +- return self.ParseForwardedIps(result.split()) ++ try: ++ ips = netifaces.ifaddresses(interface) ++ ips = ips[netifaces.AF_INET] ++ except (ValueError, IndexError): ++ return [] ++ forwarded_ips = [] ++ for ip in ips: ++ if ip['addr'] != interface_ip: ++ forwarded_ips.append( ++ '%s/%d' % (ip['addr'], ++ netaddr.IPAddress(ip['netmask']).netmask_bits())) ++ return self.ParseForwardedIps(forwarded_ips) + + def AddForwardedIp(self, address, interface): + """Configure a new IP address on the network interface. +@@ -121,10 +115,8 @@ class IpForwardingUtils(object): + address: string, the IP address to configure. + interface: string, the output device to use. + """ +- address = address if IP_ALIAS_REGEX.match(address) else '%s/32' % address +- args = ['add', 'to', 'local', address] +- options = self._CreateRouteOptions(dev=interface) +- self._RunIpRoute(args=args, options=options) ++ for ip in list(netaddr.IPNetwork(address)): ++ self._RunIfconfig(args=[interface, 'alias', '%s/32' % str(ip)]) + + def RemoveForwardedIp(self, address, interface): + """Delete an IP address on the network interface. +@@ -133,7 +125,5 @@ class IpForwardingUtils(object): + address: string, the IP address to configure. + interface: string, the output device to use. + """ +- address = address if IP_ALIAS_REGEX.match(address) else '%s/32' % address +- args = ['delete', 'to', 'local', address] +- options = self._CreateRouteOptions(dev=interface) +- self._RunIpRoute(args=args, options=options) ++ ip = netaddr.IPNetwork(address) ++ self._RunIfconfig(args=[interface, '-alias', str(ip.ip)]) diff --git a/sysutils/py-google-compute-engine/files/patch-google__compute__engine_networking_network__daemon.py b/sysutils/py-google-compute-engine/files/patch-google__compute__engine_networking_network__daemon.py new file mode 100644 index 000000000000..b0ac20b1a0e6 --- /dev/null +++ b/sysutils/py-google-compute-engine/files/patch-google__compute__engine_networking_network__daemon.py @@ -0,0 +1,33 @@ +--- google_compute_engine/networking/network_daemon.py.orig 2018-06-11 23:51:09 UTC ++++ google_compute_engine/networking/network_daemon.py +@@ -96,7 +96,7 @@ class NetworkDaemon(object): + for interface in network_interfaces: + if self.ip_forwarding_enabled: + self.ip_forwarding.HandleForwardedIps( +- interface.name, interface.forwarded_ips) ++ interface.name, interface.forwarded_ips, interface.ip) + + def _ExtractInterfaceMetadata(self, metadata): + """Extracts network interface metadata. +@@ -119,7 +119,8 @@ class NetworkDaemon(object): + if self.target_instance_ips: + ip_addresses.extend(network_interface.get('targetInstanceIps', [])) + interfaces.append(NetworkDaemon.NetworkInterface( +- interface, ip_addresses)) ++ interface, ip_addresses, network_interface.get('ip', []))) ++ + else: + message = 'Network interface not found for MAC address: %s.' + self.logger.warning(message, mac_address) +@@ -128,9 +129,10 @@ class NetworkDaemon(object): + class NetworkInterface(object): + """Network interface information extracted from metadata.""" + +- def __init__(self, name, forwarded_ips=None): ++ def __init__(self, name, forwarded_ips=None, ip=None): + self.name = name + self.forwarded_ips = forwarded_ips ++ self.ip = ip + + + def main(): diff --git a/sysutils/py-google-compute-engine/files/patch-setup.py b/sysutils/py-google-compute-engine/files/patch-setup.py index 7d7f35b8da2f..69e0c17d2265 100644 --- a/sysutils/py-google-compute-engine/files/patch-setup.py +++ b/sysutils/py-google-compute-engine/files/patch-setup.py @@ -1,4 +1,4 @@ ---- setup.py.orig 2018-02-22 19:44:17 UTC +--- setup.py.orig 2018-06-11 23:51:09 UTC +++ setup.py @@ -34,7 +34,6 @@ setuptools.setup( long_description='Google Compute Engine guest environment.', @@ -6,5 +6,5 @@ packages=setuptools.find_packages(), - scripts=glob.glob('scripts/*'), url='https://github.com/GoogleCloudPlatform/compute-image-packages', - version='2.7.6', + version='2.8.3', # Entry points create scripts in /usr/bin that call a function. diff --git a/sysutils/py-google-compute-engine/pkg-message b/sysutils/py-google-compute-engine/pkg-message index 674d4d865ff0..28b6cc0c763d 100644 --- a/sysutils/py-google-compute-engine/pkg-message +++ b/sysutils/py-google-compute-engine/pkg-message @@ -9,10 +9,8 @@ google_accounts_daemon Responsible for provisioning and google_clock_skew_daemon Responsible for syncing the software clock with the hypervisor clock google_instance_setup Configure the guest at boot -google_ip_forwarding_daemon Responsible to setup or remove IP routes in the - guest -google_network_setup Responsible to enables all associated network - interfaces +google_network_daemon Responsible to manage network interfaces and ip + routes in the guest google_startup Implement support for running host provided startup / shutdown scripts |