Date: Thu, 14 Jun 2018 19:07:49 +0000 (UTC) From: Steve Wills <swills@FreeBSD.org> To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r472394 - in head/sysutils/py-google-compute-engine: . files Message-ID: <201806141907.w5EJ7nTa051147@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: swills Date: Thu Jun 14 19:07:49 2018 New Revision: 472394 URL: https://svnweb.freebsd.org/changeset/ports/472394 Log: sysutils/py-google-compute-engine: update to 2.8.3 PR: 228999 Submitted by: Helen Koike <helen.koike@collabora.com> (maintainer) Added: head/sysutils/py-google-compute-engine/files/google_network_daemon.in - copied, changed from r472393, head/sysutils/py-google-compute-engine/files/google_ip_forwarding_daemon.in head/sysutils/py-google-compute-engine/files/patch-google__compute__engine_constants.py (contents, props changed) head/sysutils/py-google-compute-engine/files/patch-google__compute__engine_networking_ip__forwarding_ip__forwarding.py (contents, props changed) head/sysutils/py-google-compute-engine/files/patch-google__compute__engine_networking_ip__forwarding_ip__forwarding__utils.py (contents, props changed) head/sysutils/py-google-compute-engine/files/patch-google__compute__engine_networking_network__daemon.py (contents, props changed) Deleted: head/sysutils/py-google-compute-engine/files/google_ip_forwarding_daemon.in head/sysutils/py-google-compute-engine/files/google_network_setup.in head/sysutils/py-google-compute-engine/files/patch-google__compute__engine_clock__skew_clock__skew__daemon.py head/sysutils/py-google-compute-engine/files/patch-google__compute__engine_instance__setup_instance__setup.py head/sysutils/py-google-compute-engine/files/patch-google__compute__engine_ip__forwarding_ip__forwarding__daemon.py head/sysutils/py-google-compute-engine/files/patch-google__compute__engine_ip__forwarding_ip__forwarding__utils.py head/sysutils/py-google-compute-engine/files/patch-google__compute__engine_metadata__scripts_script__executor.py Modified: head/sysutils/py-google-compute-engine/Makefile (contents, props changed) head/sysutils/py-google-compute-engine/distinfo (contents, props changed) head/sysutils/py-google-compute-engine/files/google_accounts_daemon.in head/sysutils/py-google-compute-engine/files/google_clock_skew_daemon.in head/sysutils/py-google-compute-engine/files/google_startup.in head/sysutils/py-google-compute-engine/files/instance_configs.cfg.distro.sample head/sysutils/py-google-compute-engine/files/patch-google__compute__engine_instance__setup_instance__config.py (contents, props changed) head/sysutils/py-google-compute-engine/files/patch-setup.py (contents, props changed) head/sysutils/py-google-compute-engine/pkg-message (contents, props changed) Modified: head/sysutils/py-google-compute-engine/Makefile ============================================================================== --- head/sysutils/py-google-compute-engine/Makefile Thu Jun 14 18:46:42 2018 (r472393) +++ head/sysutils/py-google-compute-engine/Makefile Thu Jun 14 19:07:49 2018 (r472394) @@ -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}" Modified: head/sysutils/py-google-compute-engine/distinfo ============================================================================== --- head/sysutils/py-google-compute-engine/distinfo Thu Jun 14 18:46:42 2018 (r472393) +++ head/sysutils/py-google-compute-engine/distinfo Thu Jun 14 19:07:49 2018 (r472394) @@ -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 Modified: head/sysutils/py-google-compute-engine/files/google_accounts_daemon.in ============================================================================== --- head/sysutils/py-google-compute-engine/files/google_accounts_daemon.in Thu Jun 14 18:46:42 2018 (r472393) +++ head/sysutils/py-google-compute-engine/files/google_accounts_daemon.in Thu Jun 14 19:07:49 2018 (r472394) @@ -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. @@ -12,6 +12,9 @@ # . /etc/rc.subr + +# Required to execute scripts +export PATH=%%LOCALBASE%%/bin:$PATH name="google_accounts_daemon" rcvar="google_accounts_daemon_enable" Modified: head/sysutils/py-google-compute-engine/files/google_clock_skew_daemon.in ============================================================================== --- head/sysutils/py-google-compute-engine/files/google_clock_skew_daemon.in Thu Jun 14 18:46:42 2018 (r472393) +++ head/sysutils/py-google-compute-engine/files/google_clock_skew_daemon.in Thu Jun 14 19:07:49 2018 (r472394) @@ -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. Copied and modified: head/sysutils/py-google-compute-engine/files/google_network_daemon.in (from r472393, head/sysutils/py-google-compute-engine/files/google_ip_forwarding_daemon.in) ============================================================================== --- head/sysutils/py-google-compute-engine/files/google_ip_forwarding_daemon.in Thu Jun 14 18:46:42 2018 (r472393, copy source) +++ head/sysutils/py-google-compute-engine/files/google_network_daemon.in Thu Jun 14 19:07:49 2018 (r472394) @@ -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} Modified: head/sysutils/py-google-compute-engine/files/google_startup.in ============================================================================== --- head/sysutils/py-google-compute-engine/files/google_startup.in Thu Jun 14 18:46:42 2018 (r472393) +++ head/sysutils/py-google-compute-engine/files/google_startup.in Thu Jun 14 19:07:49 2018 (r472394) @@ -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. Modified: head/sysutils/py-google-compute-engine/files/instance_configs.cfg.distro.sample ============================================================================== --- head/sysutils/py-google-compute-engine/files/instance_configs.cfg.distro.sample Thu Jun 14 18:46:42 2018 (r472393) +++ head/sysutils/py-google-compute-engine/files/instance_configs.cfg.distro.sample Thu Jun 14 19:07:49 2018 (r472394) @@ -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 Added: head/sysutils/py-google-compute-engine/files/patch-google__compute__engine_constants.py ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sysutils/py-google-compute-engine/files/patch-google__compute__engine_constants.py Thu Jun 14 19:07:49 2018 (r472394) @@ -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': Modified: head/sysutils/py-google-compute-engine/files/patch-google__compute__engine_instance__setup_instance__config.py ============================================================================== --- head/sysutils/py-google-compute-engine/files/patch-google__compute__engine_instance__setup_instance__config.py Thu Jun 14 18:46:42 2018 (r472393) +++ head/sysutils/py-google-compute-engine/files/patch-google__compute__engine_instance__setup_instance__config.py Thu Jun 14 19:07:49 2018 (r472394) @@ -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', Added: head/sysutils/py-google-compute-engine/files/patch-google__compute__engine_networking_ip__forwarding_ip__forwarding.py ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sysutils/py-google-compute-engine/files/patch-google__compute__engine_networking_ip__forwarding_ip__forwarding.py Thu Jun 14 19:07:49 2018 (r472394) @@ -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( Added: head/sysutils/py-google-compute-engine/files/patch-google__compute__engine_networking_ip__forwarding_ip__forwarding__utils.py ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sysutils/py-google-compute-engine/files/patch-google__compute__engine_networking_ip__forwarding_ip__forwarding__utils.py Thu Jun 14 19:07:49 2018 (r472394) @@ -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)]) Added: head/sysutils/py-google-compute-engine/files/patch-google__compute__engine_networking_network__daemon.py ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sysutils/py-google-compute-engine/files/patch-google__compute__engine_networking_network__daemon.py Thu Jun 14 19:07:49 2018 (r472394) @@ -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(): Modified: head/sysutils/py-google-compute-engine/files/patch-setup.py ============================================================================== --- head/sysutils/py-google-compute-engine/files/patch-setup.py Thu Jun 14 18:46:42 2018 (r472393) +++ head/sysutils/py-google-compute-engine/files/patch-setup.py Thu Jun 14 19:07:49 2018 (r472394) @@ -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. Modified: head/sysutils/py-google-compute-engine/pkg-message ============================================================================== --- head/sysutils/py-google-compute-engine/pkg-message Thu Jun 14 18:46:42 2018 (r472393) +++ head/sysutils/py-google-compute-engine/pkg-message Thu Jun 14 19:07:49 2018 (r472394) @@ -9,10 +9,8 @@ google_accounts_daemon Responsible for provisioning a 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201806141907.w5EJ7nTa051147>