Index: head/sysutils/py-google-compute-engine/Makefile =================================================================== --- head/sysutils/py-google-compute-engine/Makefile (revision 455072) +++ head/sysutils/py-google-compute-engine/Makefile (revision 455073) @@ -1,46 +1,39 @@ # $FreeBSD$ PORTNAME= google-compute-engine -PORTVERSION= 2.4.1 -PORTREVISION= 2 +PORTVERSION= 2.6.1 CATEGORIES= sysutils python MASTER_SITES= CHEESESHOP PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX} MAINTAINER= helen.koike@collabora.com COMMENT= Guest Environment for Google Compute Engine LICENSE= APACHE20 LICENSE_FILE= ${WRKSRC}/LICENSE RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}boto>0:devel/py-boto \ ${PYTHON_PKGNAMEPREFIX}netaddr>0:net/py-netaddr \ ${PYTHON_PKGNAMEPREFIX}netifaces>0:net/py-netifaces \ sudo:security/sudo USES= python USE_PYTHON= autoplist concurrent distutils USE_RC_SUBR= google_instance_setup \ google_network_setup \ google_accounts_daemon \ google_clock_skew_daemon \ google_ip_forwarding_daemon \ google_startup NO_ARCH= yes SUB_LIST= PYTHON_CMD="${PYTHON_CMD}" REINPLACE_ARGS= -i '' -post-patch: - @${REINPLACE_CMD} -e 's|%%PREFIX%%|${PREFIX}|g' \ - ${WRKSRC}/google_compute_engine/accounts/accounts_utils.py \ - ${WRKSRC}/google_compute_engine/boto/boto_config.py \ - ${WRKSRC}/google_compute_engine/boto/compute_auth.py \ - ${WRKSRC}/google_compute_engine/config_manager.py \ - ${WRKSRC}/google_compute_engine/instance_setup/instance_config.py \ - ${WRKSRC}/google_compute_engine/metadata_scripts/script_executor.py \ - ${WRKSRC}/google_compute_engine/network_setup/network_setup.py +post-install: + ${INSTALL_DATA} ${FILESDIR}/instance_configs.cfg.distro.sample \ + ${STAGEDIR}${PREFIX}/etc/instance_configs.cfg.distro.sample .include Index: head/sysutils/py-google-compute-engine/distinfo =================================================================== --- head/sysutils/py-google-compute-engine/distinfo (revision 455072) +++ head/sysutils/py-google-compute-engine/distinfo (revision 455073) @@ -1,3 +1,3 @@ -TIMESTAMP = 1501403910 -SHA256 (google-compute-engine-2.4.1.tar.gz) = d1709420ade5e7b8318b73c8ae245382cfe362e0f9b5236d3a28c0459a6d8d49 -SIZE (google-compute-engine-2.4.1.tar.gz) = 28626 +TIMESTAMP = 1506375280 +SHA256 (google-compute-engine-2.6.1.tar.gz) = e1df14f755dfa8f165b7bde77b9ed0c18cc32c41a7eb4bf97bc73f0bb65e541f +SIZE (google-compute-engine-2.6.1.tar.gz) = 29562 Index: head/sysutils/py-google-compute-engine/files/patch-google__compute__engine_accounts_accounts__utils.py =================================================================== --- head/sysutils/py-google-compute-engine/files/patch-google__compute__engine_accounts_accounts__utils.py (revision 455072) +++ head/sysutils/py-google-compute-engine/files/patch-google__compute__engine_accounts_accounts__utils.py (nonexistent) @@ -1,52 +0,0 @@ -This patch won't be necessary anymore in further versions. -See https://github.com/GoogleCloudPlatform/compute-image-packages/pull/440 - ---- google_compute_engine/accounts/accounts_utils.py.orig 2017-07-23 07:12:16 UTC -+++ google_compute_engine/accounts/accounts_utils.py -@@ -43,8 +43,8 @@ class AccountsUtils(object): - """ - self.logger = logger - self.google_sudoers_group = 'google-sudoers' -- self.google_sudoers_file = '/etc/sudoers.d/google_sudoers' -- self.google_users_dir = '/var/lib/google' -+ self.google_sudoers_file = '%%PREFIX%%/etc/sudoers.d/google_sudoers' -+ self.google_users_dir = '%%PREFIX%%/var/lib/google' - self.google_users_file = os.path.join(self.google_users_dir, 'google_users') - - self._CreateSudoersGroup() -@@ -71,7 +71,7 @@ class AccountsUtils(object): - """Create a Linux group for Google added sudo user accounts.""" - if not self._GetGroup(self.google_sudoers_group): - try: -- subprocess.check_call(['groupadd', self.google_sudoers_group]) -+ subprocess.check_call(['pw', 'groupadd', self.google_sudoers_group]) - except subprocess.CalledProcessError as e: - self.logger.warning('Could not create the sudoers group. %s.', str(e)) - -@@ -126,7 +126,7 @@ class AccountsUtils(object): - # - # To solve the issue, make the password '*' which is also recognized - # as locked but does not prevent SSH login. -- command = ['useradd', '-m', '-s', '/bin/bash', '-p', '*', user] -+ command = ['pw', 'useradd', user, '-m'] - try: - subprocess.check_call(command) - except subprocess.CalledProcessError as e: -@@ -148,7 +148,7 @@ class AccountsUtils(object): - """ - groups = ','.join(groups) - self.logger.debug('Updating user %s with groups %s.', user, groups) -- command = ['usermod', '-G', groups, user] -+ command = ['pw', 'usermod', user, '-G', groups] - try: - subprocess.check_call(command) - except subprocess.CalledProcessError as e: -@@ -317,7 +317,7 @@ class AccountsUtils(object): - """ - self.logger.info('Removing user %s.', user) - if self.remove: -- command = ['userdel', '-r', user] -+ command = ['pw', 'userdel', user, '-r'] - try: - subprocess.check_call(command) - except subprocess.CalledProcessError as e: Property changes on: head/sysutils/py-google-compute-engine/files/patch-google__compute__engine_accounts_accounts__utils.py ___________________________________________________________________ Deleted: fbsd:nokeywords ## -1 +0,0 ## -on \ No newline at end of property Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: head/sysutils/py-google-compute-engine/files/patch-google__compute__engine_accounts_accounts__daemon.py =================================================================== --- head/sysutils/py-google-compute-engine/files/patch-google__compute__engine_accounts_accounts__daemon.py (revision 455072) +++ head/sysutils/py-google-compute-engine/files/patch-google__compute__engine_accounts_accounts__daemon.py (nonexistent) @@ -1,14 +0,0 @@ -This patch won't be necessary anymore in further versions. -See https://github.com/GoogleCloudPlatform/compute-image-packages/pull/440 - ---- google_compute_engine/accounts/accounts_daemon.py.orig 2017-07-18 16:43:14 UTC -+++ google_compute_engine/accounts/accounts_daemon.py -@@ -27,7 +27,7 @@ from google_compute_engine import logger - from google_compute_engine import metadata_watcher - from google_compute_engine.accounts import accounts_utils - --LOCKFILE = '/var/lock/google_accounts.lock' -+LOCKFILE = '/var/spool/lock/google_accounts.lock' - - - class AccountsDaemon(object): Property changes on: head/sysutils/py-google-compute-engine/files/patch-google__compute__engine_accounts_accounts__daemon.py ___________________________________________________________________ Deleted: fbsd:nokeywords ## -1 +0,0 ## -on \ No newline at end of property Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: head/sysutils/py-google-compute-engine/files/patch-google__compute__engine_boto_compute__auth.py =================================================================== --- head/sysutils/py-google-compute-engine/files/patch-google__compute__engine_boto_compute__auth.py (revision 455072) +++ head/sysutils/py-google-compute-engine/files/patch-google__compute__engine_boto_compute__auth.py (nonexistent) @@ -1,13 +0,0 @@ -This is only a cosmetic patch as it fixes docs and not execution - ---- google_compute_engine/boto/compute_auth.py.orig 2017-07-23 07:12:16 UTC -+++ google_compute_engine/boto/compute_auth.py -@@ -29,7 +29,7 @@ GS_SCOPES = set([ - class ComputeAuth(auth_handler.AuthHandler): - """Google Compute service account auth handler. - -- The boto library reads the system config file (/etc/boto.cfg) and looks -+ The boto library reads the system config file (%%PREFIX%%/etc/boto.cfg) and looks - at a config value called 'plugin_directory'. It then loads the Python - files and find classes derived from boto.auth_handler.AuthHandler. - """ Property changes on: head/sysutils/py-google-compute-engine/files/patch-google__compute__engine_boto_compute__auth.py ___________________________________________________________________ Deleted: fbsd:nokeywords ## -1 +0,0 ## -on \ No newline at end of property Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: head/sysutils/py-google-compute-engine/files/patch-google__compute__engine_boto_boto__config.py =================================================================== --- head/sysutils/py-google-compute-engine/files/patch-google__compute__engine_boto_boto__config.py (revision 455072) +++ head/sysutils/py-google-compute-engine/files/patch-google__compute__engine_boto_boto__config.py (nonexistent) @@ -1,27 +0,0 @@ -This patch won't be necessary anymore in further versions. -See https://github.com/GoogleCloudPlatform/compute-image-packages/pull/440 - ---- google_compute_engine/boto/boto_config.py.orig 2017-07-23 07:12:16 UTC -+++ google_compute_engine/boto/boto_config.py -@@ -18,8 +18,8 @@ - If a project ID is not provided, this request the project ID from the - metadata server and install the compute authentication plugin. - --Note the config starts with the content in /etc/boto.cfg.template, --overrides settings, and then persists it into /etc/boto.cfg. This -+Note the config starts with the content in %%PREFIX%%/etc/boto.cfg.template, -+overrides settings, and then persists it into %%PREFIX%%/etc/boto.cfg. This - is done so that the system boto.cfg can be removed prior to image - packaging. - """ -@@ -34,8 +34,8 @@ from google_compute_engine import metada - class BotoConfig(object): - """Creates a boto config file for standalone GSUtil.""" - -- boto_config = '/etc/boto.cfg' -- boto_config_template = '/etc/boto.cfg.template' -+ boto_config = '%%PREFIX%%/etc/boto.cfg' -+ boto_config_template = '%%PREFIX%%/etc/boto.cfg.template' - boto_config_script = os.path.abspath(__file__) - boto_config_header = ( - 'This file is automatically created at boot time by the %s script. Do ' Property changes on: head/sysutils/py-google-compute-engine/files/patch-google__compute__engine_boto_boto__config.py ___________________________________________________________________ Deleted: fbsd:nokeywords ## -1 +0,0 ## -on \ No newline at end of property Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: head/sysutils/py-google-compute-engine/files/patch-google__compute__engine_config__manager.py =================================================================== --- head/sysutils/py-google-compute-engine/files/patch-google__compute__engine_config__manager.py (revision 455072) +++ head/sysutils/py-google-compute-engine/files/patch-google__compute__engine_config__manager.py (nonexistent) @@ -1,23 +0,0 @@ -This patch won't be necessary anymore in further versions. -See https://github.com/GoogleCloudPlatform/compute-image-packages/pull/440 - ---- google_compute_engine/config_manager.py.orig 2017-07-23 07:12:16 UTC -+++ google_compute_engine/config_manager.py -@@ -21,7 +21,7 @@ import textwrap - from google_compute_engine import file_utils - from google_compute_engine.compat import parser - --CONFIG = '/etc/default/instance_configs.cfg' -+CONFIG = '%%PREFIX%%/etc/instance_configs.cfg' - - - class ConfigManager(object): -@@ -101,7 +101,7 @@ class ConfigManager(object): - """ - config_file = config_file or self.config_file - config_name = os.path.splitext(os.path.basename(config_file))[0] -- config_lock = '/var/lock/google_%s.lock' % config_name -+ config_lock = '/var/spool/lock/google_%s.lock' % config_name - with file_utils.LockFile(config_lock): - with open(config_file, 'w') as config_fp: - if self.config_header: Property changes on: head/sysutils/py-google-compute-engine/files/patch-google__compute__engine_config__manager.py ___________________________________________________________________ Deleted: fbsd:nokeywords ## -1 +0,0 ## -on \ No newline at end of property Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: head/sysutils/py-google-compute-engine/files/patch-google__compute__engine_metadata__scripts_script__executor.py =================================================================== --- head/sysutils/py-google-compute-engine/files/patch-google__compute__engine_metadata__scripts_script__executor.py (revision 455072) +++ head/sysutils/py-google-compute-engine/files/patch-google__compute__engine_metadata__scripts_script__executor.py (nonexistent) @@ -1,14 +0,0 @@ -This patch won't be necessary anymore in further versions. -See https://github.com/GoogleCloudPlatform/compute-image-packages/pull/440 - ---- google_compute_engine/metadata_scripts/script_executor.py.orig 2017-07-23 07:12:16 UTC -+++ google_compute_engine/metadata_scripts/script_executor.py -@@ -50,7 +50,7 @@ class ScriptExecutor(object): - metadata_script: string, the file location of an executable script. - """ - process = subprocess.Popen( -- metadata_script, shell=True, executable='/bin/bash', -+ metadata_script, shell=True, executable='%%PREFIX%%/bin/bash', - stderr=subprocess.STDOUT, stdout=subprocess.PIPE) - while True: - for line in iter(process.stdout.readline, b''): Property changes on: head/sysutils/py-google-compute-engine/files/patch-google__compute__engine_metadata__scripts_script__executor.py ___________________________________________________________________ Deleted: fbsd:nokeywords ## -1 +0,0 ## -on \ No newline at end of property Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: head/sysutils/py-google-compute-engine/files/patch-google__compute__engine_network__utils.py =================================================================== --- head/sysutils/py-google-compute-engine/files/patch-google__compute__engine_network__utils.py (revision 455072) +++ head/sysutils/py-google-compute-engine/files/patch-google__compute__engine_network__utils.py (nonexistent) @@ -1,30 +0,0 @@ -This patch depends on the follow PR from the upsteram project -https://github.com/GoogleCloudPlatform/compute-image-packages/pull/442 - ---- google_compute_engine/network_utils.py.orig 2017-07-18 16:43:14 UTC -+++ google_compute_engine/network_utils.py -@@ -17,6 +17,7 @@ - - import logging - import os -+import netifaces - - - class NetworkUtils(object): -@@ -38,11 +39,12 @@ class NetworkUtils(object): - dict, string MAC addresses mapped to the string network interface name. - """ - interfaces = {} -- for interface in os.listdir('/sys/class/net'): -+ for interface in netifaces.interfaces(): - try: -- mac_address = open( -- '/sys/class/net/%s/address' % interface).read().strip() -- except (IOError, OSError) as e: -+ mac_address = netifaces.ifaddresses(interface)[netifaces.AF_LINK][0]['addr'] -+ if mac_address == interface: -+ raise Exception('No MAC Address') -+ except Exception as e: - message = 'Unable to determine MAC address for %s. %s.' - self.logger.warning(message, interface, str(e)) - else: Property changes on: head/sysutils/py-google-compute-engine/files/patch-google__compute__engine_network__utils.py ___________________________________________________________________ Deleted: fbsd:nokeywords ## -1 +0,0 ## -on \ No newline at end of property Deleted: svn:eol-style ## -1 +0,0 ## -native \ No newline at end of property Deleted: svn:mime-type ## -1 +0,0 ## -text/plain \ No newline at end of property Index: head/sysutils/py-google-compute-engine/files/instance_configs.cfg.distro.sample =================================================================== --- head/sysutils/py-google-compute-engine/files/instance_configs.cfg.distro.sample (nonexistent) +++ head/sysutils/py-google-compute-engine/files/instance_configs.cfg.distro.sample (revision 455073) @@ -0,0 +1,5 @@ +[Accounts] +useradd_cmd = pw useradd {user} -m +userdel_cmd = pw userdel {user} -r +usermod_cmd = pw usermod {user} -G {groups} +groupadd_cmd = pw groupadd {group} Property changes on: head/sysutils/py-google-compute-engine/files/instance_configs.cfg.distro.sample ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +true \ No newline at end of property Index: 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_clock__skew_clock__skew__daemon.py (revision 455072) +++ head/sysutils/py-google-compute-engine/files/patch-google__compute__engine_clock__skew_clock__skew__daemon.py (revision 455073) @@ -1,28 +1,17 @@ -BSD doesn't have hwclock, use ntpdate instead - ---- google_compute_engine/clock_skew/clock_skew_daemon.py.orig 2017-07-18 16:43:14 UTC +--- 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 -@@ -24,7 +24,7 @@ from google_compute_engine import file_u - from google_compute_engine import logger - from google_compute_engine import metadata_watcher - --LOCKFILE = '/var/lock/google_clock_skew.lock' -+LOCKFILE = '/var/spool/lock/google_clock_skew.lock' - - - class ClockSkewDaemon(object): -@@ -58,9 +58,12 @@ class ClockSkewDaemon(object): +@@ -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: Index: 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 (revision 455072) +++ head/sysutils/py-google-compute-engine/files/patch-google__compute__engine_instance__setup_instance__config.py (revision 455073) @@ -1,49 +1,16 @@ -This patch fixes the paths and disable optimization scripts used only on Linux. -The variables won't be needed to be fixed in further versions -See https://github.com/GoogleCloudPlatform/compute-image-packages/pull/440 - ---- google_compute_engine/instance_setup/instance_config.py.orig 2017-07-23 07:12:16 UTC +--- google_compute_engine/instance_setup/instance_config.py.orig 2017-09-29 00:21:28 UTC +++ google_compute_engine/instance_setup/instance_config.py -@@ -16,8 +16,8 @@ - """A library used to set up the instance's default configurations file. - - Note that the configurations in --/etc/default/instance_configs.cfg.template override the values set in --/etc/default/instance_configs.cfg. The system instance_configs.cfg may be -+%%PREFIX%%/etc/instance_configs.cfg.template override the values set in -+%%PREFIX%%/etc/instance_configs.cfg. The system instance_configs.cfg may be - overridden during package upgrade. - """ - -@@ -32,7 +32,7 @@ from google_compute_engine.compat import - class InstanceConfig(config_manager.ConfigManager): - """Creates a defaults config file for instance configuration.""" - -- instance_config = '/etc/default/instance_configs.cfg' -+ instance_config = '%%PREFIX%%/etc/instance_configs.cfg' - instance_config_distro = '%s.distro' % instance_config - instance_config_template = '%s.template' % instance_config - instance_config_script = os.path.abspath(__file__) -@@ -40,7 +40,7 @@ class InstanceConfig(config_manager.Conf - 'This file is automatically created at boot time by the %s script. Do ' - 'not edit this file directly. If you need to add items to this file, ' - 'create or edit %s instead and then run ' -- '/usr/bin/google_instance_setup.') -+ '%%PREFIX%%/bin/google_instance_setup.') - instance_config_options = { - 'Accounts': { - 'deprovision_remove': 'false', -@@ -55,11 +55,11 @@ class InstanceConfig(config_manager.Conf +@@ -72,11 +72,11 @@ class InstanceConfig(config_manager.Conf 'instance_id': '0', }, 'InstanceSetup': { - 'optimize_local_ssd': 'true', + 'optimize_local_ssd': 'false', 'network_enabled': 'true', 'set_boto_config': 'true', 'set_host_keys': 'true', - 'set_multiqueue': 'true', + 'set_multiqueue': 'false', }, 'IpForwarding': { 'ethernet_proto_id': '66', Index: 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_instance__setup_instance__setup.py (revision 455072) +++ head/sysutils/py-google-compute-engine/files/patch-google__compute__engine_instance__setup_instance__setup.py (revision 455073) @@ -1,26 +1,19 @@ -This patch fixes paths to rc scripts -The PREFIX fix won't be necessary anymore in further versions -See https://github.com/GoogleCloudPlatform/compute-image-packages/pull/440 - ---- google_compute_engine/instance_setup/instance_setup.py.orig 2017-07-18 16:43:14 UTC +--- google_compute_engine/instance_setup/instance_setup.py.orig 2017-09-14 18:08:49 UTC +++ google_compute_engine/instance_setup/instance_setup.py -@@ -143,14 +143,14 @@ class InstanceSetup(object): - """Initialize the SSH daemon.""" - # Exit as early as possible. +@@ -146,12 +146,12 @@ class InstanceSetup(object): # Instance setup systemd scripts block sshd from starting. -- if os.path.exists('/bin/systemctl'): -+ if os.path.exists('%%PREFIX%%/bin/systemctl'): + 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']) Index: 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__daemon.py (revision 455072) +++ head/sysutils/py-google-compute-engine/files/patch-google__compute__engine_ip__forwarding_ip__forwarding__daemon.py (revision 455073) @@ -1,35 +1,25 @@ -This patch depends on the follow PR from the upsteram project -https://github.com/GoogleCloudPlatform/compute-image-packages/pull/442 - ---- google_compute_engine/ip_forwarding/ip_forwarding_daemon.py.orig 2017-07-18 16:43:14 UTC +--- 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 -@@ -38,7 +38,7 @@ from google_compute_engine import networ - - from google_compute_engine.ip_forwarding import ip_forwarding_utils - --LOCKFILE = '/var/lock/google_ip_forwarding.lock' -+LOCKFILE = '/var/spool/lock/google_ip_forwarding.lock' - - - class IpForwardingDaemon(object): -@@ -131,18 +131,18 @@ class IpForwardingDaemon(object): +@@ -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(): Index: 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_ip__forwarding_ip__forwarding__utils.py (revision 455072) +++ head/sysutils/py-google-compute-engine/files/patch-google__compute__engine_ip__forwarding_ip__forwarding__utils.py (revision 455073) @@ -1,80 +1,77 @@ -This patch depends on the follow PR from the upsteram project -https://github.com/GoogleCloudPlatform/compute-image-packages/pull/442 - ---- google_compute_engine/ip_forwarding/ip_forwarding_utils.py.orig 2017-07-18 16:43:14 UTC +--- 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]) Index: head/sysutils/py-google-compute-engine/files/patch-google__compute__engine_network__setup_network__setup.py =================================================================== --- head/sysutils/py-google-compute-engine/files/patch-google__compute__engine_network__setup_network__setup.py (revision 455072) +++ head/sysutils/py-google-compute-engine/files/patch-google__compute__engine_network__setup_network__setup.py (revision 455073) @@ -1,47 +1,27 @@ -dhclient works a bit different in BSD compared to Linux, this patch adapts its usage. - ---- google_compute_engine/network_setup/network_setup.py.orig 2017-07-23 07:12:16 UTC +--- google_compute_engine/network_setup/network_setup.py.orig 2017-09-29 00:21:28 UTC +++ google_compute_engine/network_setup/network_setup.py -@@ -74,7 +74,7 @@ class NetworkSetup(object): - Args: - interfaces: list of string, the output device names enable. - """ -- interface_path = '/etc/sysconfig/network-scripts' -+ interface_path = '%%PREFIX%%/etc/sysconfig/network-scripts' - for interface in interfaces: - interface_config = os.path.join(interface_path, 'ifcfg-%s' % interface) - if os.path.exists(interface_config): -@@ -106,12 +106,18 @@ class NetworkSetup(object): +@@ -107,12 +107,18 @@ class NetworkSetup(object): self.logger.info('Enabling the Ethernet interfaces %s.', interfaces) dhclient_command = ['dhclient'] if os.path.exists(self.dhclient_script): - dhclient_command += ['-sf', self.dhclient_script] - try: - subprocess.check_call(dhclient_command + ['-x'] + interfaces) - subprocess.check_call(dhclient_command + interfaces) - except subprocess.CalledProcessError: - self.logger.warning('Could not enable interfaces %s.', interfaces) + dhclient_conf = '/etc/dhclient.conf' + if os.path.exists(dhclient_conf): + subprocess.call('sed -i "" "/^script/d" ' + dhclient_conf, shell=True) + subprocess.call('echo \'script "%s";\' >> %s' % (self.dhclient_script, dhclient_conf), shell=True) + for interface in interfaces: + try: + subprocess.check_call(['ifconfig', interface, 'down', 'delete']) + # wait previous dhclient to exit + subprocess.check_call(['sleep', '3']) + subprocess.check_call(dhclient_command + [interface]) + except subprocess.CalledProcessError: + self.logger.warning('Could not enable interface %s.', interface) def _EnableNetworkInterfaces(self, interfaces): """Enable the list of network interfaces. -@@ -130,7 +136,7 @@ class NetworkSetup(object): - except subprocess.CalledProcessError: - self.logger.warning('Could not enable Ethernet interfaces.') - else: -- if os.path.exists('/etc/sysconfig/network-scripts'): -+ if os.path.exists('%%PREFIX%%/etc/sysconfig/network-scripts'): - self._DisableNetworkManager(interfaces) - self._ConfigureNetwork(interfaces) - Index: head/sysutils/py-google-compute-engine/files/patch-setup.py =================================================================== --- head/sysutils/py-google-compute-engine/files/patch-setup.py (revision 455072) +++ head/sysutils/py-google-compute-engine/files/patch-setup.py (revision 455073) @@ -1,10 +1,10 @@ ---- setup.py.orig 2017-07-18 16:43:14 UTC +--- setup.py.orig 2017-09-14 18:08:49 UTC +++ setup.py @@ -30,7 +30,6 @@ setuptools.setup( long_description='Google Compute Engine guest environment.', name='google-compute-engine', packages=setuptools.find_packages(), - scripts=glob.glob('scripts/*'), url='https://github.com/GoogleCloudPlatform/compute-image-packages', - version='2.4.1', + version='2.6.1', # Entry points create scripts in /usr/bin that call a function. Index: head/sysutils/py-google-compute-engine/pkg-plist =================================================================== --- head/sysutils/py-google-compute-engine/pkg-plist (nonexistent) +++ head/sysutils/py-google-compute-engine/pkg-plist (revision 455073) @@ -0,0 +1 @@ +@sample etc/instance_configs.cfg.distro.sample Property changes on: head/sysutils/py-google-compute-engine/pkg-plist ___________________________________________________________________ Added: fbsd:nokeywords ## -0,0 +1 ## +true \ No newline at end of property