View | Details | Raw Unified | Return to bug 228949 | Differences between
and this patch

Collapse All | Expand All

(-)b/sysutils/py-google-compute-engine/Makefile (-4 / +2 lines)
Lines 1-8 Link Here
1
# $FreeBSD$
1
# $FreeBSD$
2
2
3
PORTNAME=	google-compute-engine
3
PORTNAME=	google-compute-engine
4
DISTVERSION=	2.7.6
4
DISTVERSION=	2.8.3
5
PORTREVISION=	4
6
CATEGORIES=	sysutils python
5
CATEGORIES=	sysutils python
7
MASTER_SITES=	CHEESESHOP
6
MASTER_SITES=	CHEESESHOP
8
PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
7
PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
Lines 24-33 USE_PYTHON= autoplist concurrent distutils Link Here
24
NO_ARCH=	yes
23
NO_ARCH=	yes
25
24
26
USE_RC_SUBR=	google_instance_setup \
25
USE_RC_SUBR=	google_instance_setup \
27
		google_network_setup \
28
		google_accounts_daemon \
26
		google_accounts_daemon \
29
		google_clock_skew_daemon \
27
		google_clock_skew_daemon \
30
		google_ip_forwarding_daemon \
28
		google_network_daemon \
31
		google_startup
29
		google_startup
32
30
33
SUB_LIST=	PYTHON_CMD="${PYTHON_CMD}"
31
SUB_LIST=	PYTHON_CMD="${PYTHON_CMD}"
(-)b/sysutils/py-google-compute-engine/distinfo (-3 / +3 lines)
Lines 1-3 Link Here
1
TIMESTAMP = 1522049559
1
TIMESTAMP = 1528807896
2
SHA256 (google-compute-engine-2.7.6.tar.gz) = 23c764f2fc72db5a0b81cb8f8029c4e5d152bd50faf1eb7322b4a4cff039d003
2
SHA256 (google-compute-engine-2.8.3.tar.gz) = 14947a0cfc20e1d64d1184bbd137b9f3b66d7c94efcbe1b73e21c090e7002af4
3
SIZE (google-compute-engine-2.7.6.tar.gz) = 40742
3
SIZE (google-compute-engine-2.8.3.tar.gz) = 45988
(-)b/sysutils/py-google-compute-engine/files/google_accounts_daemon.in (-1 / +4 lines)
Lines 4-10 Link Here
4
#
4
#
5
# PROVIDE: google_accounts_daemon
5
# PROVIDE: google_accounts_daemon
6
# BEFORE: LOGIN
6
# BEFORE: LOGIN
7
# REQUIRE: NETWORKING syslogd google_instance_setup google_network_setup
7
# REQUIRE: NETWORKING syslogd google_instance_setup google_network_daemon
8
# KEYWORD: shutdown
8
# KEYWORD: shutdown
9
#
9
#
10
# google_accounts_daemon_enable (bool):	Set to NO by default.
10
# google_accounts_daemon_enable (bool):	Set to NO by default.
Lines 13-18 Link Here
13
13
14
. /etc/rc.subr
14
. /etc/rc.subr
15
15
16
# Required to execute scripts
17
export PATH=%%LOCALBASE%%/bin:$PATH
18
16
name="google_accounts_daemon"
19
name="google_accounts_daemon"
17
rcvar="google_accounts_daemon_enable"
20
rcvar="google_accounts_daemon_enable"
18
21
(-)b/sysutils/py-google-compute-engine/files/google_clock_skew_daemon.in (-1 / +1 lines)
Lines 4-10 Link Here
4
#
4
#
5
# PROVIDE: google_clock_skew_daemon
5
# PROVIDE: google_clock_skew_daemon
6
# BEFORE: LOGIN
6
# BEFORE: LOGIN
7
# REQUIRE: NETWORKING syslogd ntpd google_instance_setup google_network_setup
7
# REQUIRE: NETWORKING syslogd ntpd google_instance_setup google_network_daemon
8
# KEYWORD: shutdown
8
# KEYWORD: shutdown
9
#
9
#
10
# google_clock_skew_daemon_enable (bool): Set to NO by default.
10
# google_clock_skew_daemon_enable (bool): Set to NO by default.
(-)b/sysutils/py-google-compute-engine/files/google_network_daemon.in (-9 / +9 lines)
Lines 2-31 Link Here
2
2
3
# $FreeBSD$
3
# $FreeBSD$
4
#
4
#
5
# PROVIDE: google_ip_forwarding_daemon
5
# PROVIDE: google_network_daemon
6
# BEFORE: LOGIN
6
# BEFORE: LOGIN
7
# REQUIRE: NETWORKING syslogd google_instance_setup google_network_setup
7
# REQUIRE: NETWORKING syslogd google_instance_setup google_network_daemon
8
# KEYWORD: shutdown
8
# KEYWORD: shutdown
9
#
9
#
10
# google_ip_forwarding_daemon_enable (bool): Set to NO by default.
10
# google_network_daemon_enable (bool): Set to NO by default.
11
#					     Set it to YES to enable google_ip_forwarding_daemon.
11
#					     Set it to YES to enable google_network_daemon.
12
#
12
#
13
13
14
. /etc/rc.subr
14
. /etc/rc.subr
15
15
16
name="google_ip_forwarding_daemon"
16
name="google_network_daemon"
17
rcvar="google_ip_forwarding_daemon_enable"
17
rcvar="google_network_daemon_enable"
18
18
19
load_rc_config "${name}"
19
load_rc_config "${name}"
20
20
21
: ${google_ip_forwarding_daemon_enable:="NO"}
21
: ${google_network_daemon_enable:="NO"}
22
22
23
command_interpreter="%%PYTHON_CMD%%"
23
command_interpreter="%%PYTHON_CMD%%"
24
command=%%PREFIX%%/bin/${name}
24
command=%%PREFIX%%/bin/${name}
25
pidfile=/var/run/${name}.pid
25
pidfile=/var/run/${name}.pid
26
start_cmd="google_ip_forwarding_daemon_start"
26
start_cmd="google_network_daemon_start"
27
27
28
google_ip_forwarding_daemon_start()
28
google_network_daemon_start()
29
{
29
{
30
  check_startmsgs && echo "Starting ${name}."
30
  check_startmsgs && echo "Starting ${name}."
31
  daemon -p ${pidfile} -t ${name} ${command}
31
  daemon -p ${pidfile} -t ${name} ${command}
(-)a/sysutils/py-google-compute-engine/files/google_network_setup.in (-27 lines)
Removed Link Here
1
#!/bin/sh
2
3
# $FreeBSD$
4
#
5
# PROVIDE: google_network_setup
6
# BEFORE: LOGIN
7
# REQUIRE: NETWORKING syslogd google_instance_setup
8
#
9
# google_network_setup_enable (bool):	Set to NO by default.
10
#					Set it to YES to enable google_network_setup.
11
#
12
13
. /etc/rc.subr
14
15
name="google_network_setup"
16
rcvar="google_network_setup_enable"
17
stop_cmd=":"
18
19
load_rc_config "${name}"
20
21
: ${google_network_setup_enable:="NO"}
22
23
command_interpreter="%%PYTHON_CMD%%"
24
command=%%PREFIX%%/bin/${name}
25
pidfile=/var/run/${name}.pid
26
27
run_rc_command "$1"
(-)b/sysutils/py-google-compute-engine/files/google_startup.in (-1 / +1 lines)
Lines 4-10 Link Here
4
#
4
#
5
# PROVIDE: google_startup
5
# PROVIDE: google_startup
6
# BEFORE: LOGIN
6
# BEFORE: LOGIN
7
# REQUIRE: NETWORKING syslogd google_instance_setup google_network_setup
7
# REQUIRE: NETWORKING syslogd google_instance_setup google_network_daemon
8
# KEYWORD: shutdown
8
# KEYWORD: shutdown
9
#
9
#
10
# google_startup_enable (bool): 		Set to NO by default.
10
# google_startup_enable (bool): 		Set to NO by default.
(-)b/sysutils/py-google-compute-engine/files/instance_configs.cfg.distro.sample (+3 lines)
Lines 3-5 useradd_cmd = pw useradd {user} -m Link Here
3
userdel_cmd = pw userdel {user} -r
3
userdel_cmd = pw userdel {user} -r
4
usermod_cmd = pw usermod {user} -G {groups}
4
usermod_cmd = pw usermod {user} -G {groups}
5
groupadd_cmd = pw groupadd {group}
5
groupadd_cmd = pw groupadd {group}
6
7
[MetadataScripts]
8
default_shell = /bin/bash
(-)a/sysutils/py-google-compute-engine/files/patch-google__compute__engine_clock__skew_clock__skew__daemon.py (-17 lines)
Removed Link Here
1
--- google_compute_engine/clock_skew/clock_skew_daemon.py.orig	2017-09-14 18:08:49 UTC
2
+++ google_compute_engine/clock_skew/clock_skew_daemon.py
3
@@ -59,9 +59,12 @@ class ClockSkewDaemon(object):
4
       response: string, the metadata response with the new drift token value.
5
     """
6
     self.logger.info('Clock drift token has changed: %s.', response)
7
-    command = ['/sbin/hwclock', '--hctosys']
8
+
9
+    ntpd_inactive = subprocess.call(['service', 'ntpd', 'status'])
10
     try:
11
-      subprocess.check_call(command)
12
+      if not ntpd_inactive: subprocess.check_call(['service', 'ntpd', 'stop'])
13
+      subprocess.check_call('ntpdate `awk \'$1=="server" {print $2}\' /etc/ntp.conf`', shell=True)
14
+      if not ntpd_inactive: subprocess.check_call(['service', 'ntpd', 'start'])
15
     except subprocess.CalledProcessError:
16
       self.logger.warning('Failed to sync system time with hardware clock.')
17
     else:
(-)b/sysutils/py-google-compute-engine/files/patch-google__compute__engine_constants.py (+11 lines)
Added Link Here
1
--- google_compute_engine/constants.py.orig	2018-06-11 23:51:09 UTC
2
+++ google_compute_engine/constants.py
3
@@ -18,7 +18,7 @@
4
 import platform
5
 
6
 OSLOGIN_CONTROL_SCRIPT = 'google_oslogin_control'
7
-OSLOGIN_NSS_CACHE = '/etc/oslogin_passwd.cache'
8
+OSLOGIN_NSS_CACHE = '/usr/local/etc/oslogin_passwd.cache'
9
 OSLOGIN_NSS_CACHE_SCRIPT = 'google_oslogin_nss_cache'
10
 
11
 if platform.system() == 'FreeBSD':
(-)b/sysutils/py-google-compute-engine/files/patch-google__compute__engine_instance__setup_instance__config.py (-2 / +2 lines)
Lines 1-6 Link Here
1
--- google_compute_engine/instance_setup/instance_config.py.orig	2018-02-22 19:44:17 UTC
1
--- google_compute_engine/instance_setup/instance_config.py.orig	2018-06-11 23:51:09 UTC
2
+++ google_compute_engine/instance_setup/instance_config.py
2
+++ google_compute_engine/instance_setup/instance_config.py
3
@@ -73,11 +73,11 @@ class InstanceConfig(config_manager.Conf
3
@@ -74,11 +74,11 @@ class InstanceConfig(config_manager.Conf
4
       },
4
       },
5
       'InstanceSetup': {
5
       'InstanceSetup': {
6
           'host_key_types': 'ecdsa,ed25519,rsa',
6
           'host_key_types': 'ecdsa,ed25519,rsa',
(-)a/sysutils/py-google-compute-engine/files/patch-google__compute__engine_instance__setup_instance__setup.py (-19 lines)
Removed Link Here
1
--- google_compute_engine/instance_setup/instance_setup.py.orig	2017-09-14 18:08:49 UTC
2
+++ google_compute_engine/instance_setup/instance_setup.py
3
@@ -146,12 +146,12 @@ class InstanceSetup(object):
4
     # Instance setup systemd scripts block sshd from starting.
5
     if os.path.exists(constants.LOCALBASE + '/bin/systemctl'):
6
       return
7
-    elif (os.path.exists('/etc/init.d/ssh') or
8
-          os.path.exists('/etc/init/ssh.conf')):
9
+    elif (os.path.exists('/etc/rc.d/ssh') or
10
+          os.path.exists('/etc/rc/ssh.conf')):
11
       subprocess.call(['service', 'ssh', 'start'])
12
       subprocess.call(['service', 'ssh', 'reload'])
13
-    elif (os.path.exists('/etc/init.d/sshd') or
14
-          os.path.exists('/etc/init/sshd.conf')):
15
+    elif (os.path.exists('/etc/rc.d/sshd') or
16
+          os.path.exists('/etc/rc/sshd.conf')):
17
       subprocess.call(['service', 'sshd', 'start'])
18
       subprocess.call(['service', 'sshd', 'reload'])
19
 
(-)a/sysutils/py-google-compute-engine/files/patch-google__compute__engine_ip__forwarding_ip__forwarding__daemon.py (-25 lines)
Removed Link Here
1
--- google_compute_engine/ip_forwarding/ip_forwarding_daemon.py.orig	2017-09-14 18:08:49 UTC
2
+++ google_compute_engine/ip_forwarding/ip_forwarding_daemon.py
3
@@ -137,20 +137,20 @@ class IpForwardingDaemon(object):
4
     Args:
5
       result: dict, the metadata response with the new network interfaces.
6
     """
7
+    ip_addresses = []
8
     for network_interface in result:
9
       mac_address = network_interface.get('mac')
10
       interface = self.network_utils.GetNetworkInterface(mac_address)
11
-      ip_addresses = []
12
       if interface:
13
         ip_addresses.extend(network_interface.get('forwardedIps', []))
14
         if self.ip_aliases:
15
           ip_addresses.extend(network_interface.get('ipAliases', []))
16
         if self.target_instance_ips:
17
           ip_addresses.extend(network_interface.get('targetInstanceIps', []))
18
-        self._HandleForwardedIps(ip_addresses, interface)
19
       else:
20
         message = 'Network interface not found for MAC address: %s.'
21
         self.logger.warning(message, mac_address)
22
+    self._HandleForwardedIps(ip_addresses, 'lo' + self.ip_forwarding_utils.proto_id)
23
 
24
 
25
 def main():
(-)a/sysutils/py-google-compute-engine/files/patch-google__compute__engine_ip__forwarding_ip__forwarding__utils.py (-77 lines)
Removed Link Here
1
--- google_compute_engine/ip_forwarding/ip_forwarding_utils.py.orig	2017-09-14 18:08:49 UTC
2
+++ google_compute_engine/ip_forwarding/ip_forwarding_utils.py
3
@@ -17,6 +17,8 @@
4
 
5
 import re
6
 import subprocess
7
+import netifaces
8
+import netaddr
9
 
10
 IP_REGEX = re.compile(r'\A(\d{1,3}\.){3}\d{1,3}\Z')
11
 IP_ALIAS_REGEX = re.compile(r'\A(\d{1,3}\.){3}\d{1,3}/\d{1,2}\Z')
12
@@ -51,8 +53,8 @@ class IpForwardingUtils(object):
13
     options.update(kwargs)
14
     return options
15
 
16
-  def _RunIpRoute(self, args=None, options=None):
17
-    """Run a command with ip route and return the response.
18
+  def _RunIfconfig(self, args=None, options=None):
19
+    """Run a command with ifconfig and return the response.
20
 
21
     Args:
22
       args: list, the string ip route command args to execute.
23
@@ -63,7 +65,7 @@ class IpForwardingUtils(object):
24
     """
25
     args = args or []
26
     options = options or {}
27
-    command = ['ip', 'route']
28
+    command = ['ifconfig']
29
     command.extend(args)
30
     for item in options.items():
31
       command.extend(item)
32
@@ -108,10 +110,15 @@ class IpForwardingUtils(object):
33
     Returns:
34
       list, the IP address strings.
35
     """
36
-    args = ['ls', 'table', 'local', 'type', 'local']
37
-    options = self._CreateRouteOptions(dev=interface)
38
-    result = self._RunIpRoute(args=args, options=options)
39
-    return self.ParseForwardedIps(result.split())
40
+    try:
41
+      ips = netifaces.ifaddresses('lo' + self.proto_id)
42
+      ips = ips[netifaces.AF_INET]
43
+    except (ValueError, KeyError) as e:
44
+      return []
45
+    forwarded_ips = []
46
+    for ip in ips:
47
+      forwarded_ips.append(ip['addr'] + '/' + str(netaddr.IPAddress(ip['netmask']).netmask_bits()))
48
+    return self.ParseForwardedIps(forwarded_ips)
49
 
50
   def AddForwardedIp(self, address, interface):
51
     """Configure a new IP address on the network interface.
52
@@ -121,9 +128,12 @@ class IpForwardingUtils(object):
53
       interface: string, the output device to use.
54
     """
55
     address = address if IP_ALIAS_REGEX.match(address) else '%s/32' % address
56
-    args = ['add', 'to', 'local', address]
57
-    options = self._CreateRouteOptions(dev=interface)
58
-    self._RunIpRoute(args=args, options=options)
59
+    cmd = 'alias'
60
+    try:
61
+      forwarded_ips = netifaces.ifaddresses(interface)
62
+    except (ValueError, KeyError) as e:
63
+      cmd = 'create'
64
+    self._RunIfconfig(args=[interface, cmd, address])
65
 
66
   def RemoveForwardedIp(self, address, interface):
67
     """Delete an IP address on the network interface.
68
@@ -132,7 +142,5 @@ class IpForwardingUtils(object):
69
       address: string, the IP address to configure.
70
       interface: string, the output device to use.
71
     """
72
-    address = address if IP_ALIAS_REGEX.match(address) else '%s/32' % address
73
-    args = ['delete', 'to', 'local', address]
74
-    options = self._CreateRouteOptions(dev=interface)
75
-    self._RunIpRoute(args=args, options=options)
76
+    address = address if IP_REGEX.match(address) else address[:-3]
77
+    self._RunIfconfig(args=[interface, '-alias', address])
(-)a/sysutils/py-google-compute-engine/files/patch-google__compute__engine_metadata__scripts_script__executor.py (-11 lines)
Removed Link Here
1
--- google_compute_engine/metadata_scripts/script_executor.py.orig	2018-02-22 19:44:17 UTC
2
+++ google_compute_engine/metadata_scripts/script_executor.py
3
@@ -53,7 +53,7 @@ class ScriptExecutor(object):
4
     """
5
     process = subprocess.Popen(
6
         metadata_script, shell=True,
7
-        executable=constants.LOCALBASE + '/bin/bash',
8
+        executable='/bin/sh',
9
         stderr=subprocess.STDOUT, stdout=subprocess.PIPE)
10
     while True:
11
       for line in iter(process.stdout.readline, b''):
(-)b/sysutils/py-google-compute-engine/files/patch-google__compute__engine_networking_ip__forwarding_ip__forwarding.py (+22 lines)
Added Link Here
1
--- google_compute_engine/networking/ip_forwarding/ip_forwarding.py.orig	2018-06-11 23:51:09 UTC
2
+++ google_compute_engine/networking/ip_forwarding/ip_forwarding.py
3
@@ -85,15 +85,17 @@ class IpForwarding(object):
4
     for address in forwarded_ips:
5
       self.ip_forwarding_utils.RemoveForwardedIp(address, interface)
6
 
7
-  def HandleForwardedIps(self, interface, forwarded_ips):
8
+  def HandleForwardedIps(self, interface, forwarded_ips, interface_ip):
9
     """Handle changes to the forwarded IPs on a network interface.
10
 
11
     Args:
12
       interface: string, the output device to configure.
13
       forwarded_ips: list, the forwarded IP address strings desired.
14
+      interface_ip: string, current interface ip address.
15
     """
16
     desired = self.ip_forwarding_utils.ParseForwardedIps(forwarded_ips)
17
-    configured = self.ip_forwarding_utils.GetForwardedIps(interface)
18
+    configured = self.ip_forwarding_utils.GetForwardedIps(
19
+        interface, interface_ip)
20
     to_add = sorted(set(desired) - set(configured))
21
     to_remove = sorted(set(configured) - set(desired))
22
     self._LogForwardedIpChanges(
(-)b/sysutils/py-google-compute-engine/files/patch-google__compute__engine_networking_ip__forwarding_ip__forwarding__utils.py (+115 lines)
Added Link Here
1
--- google_compute_engine/networking/ip_forwarding/ip_forwarding_utils.py.orig	2018-06-11 23:51:09 UTC
2
+++ google_compute_engine/networking/ip_forwarding/ip_forwarding_utils.py
3
@@ -15,6 +15,8 @@
4
 
5
 """Utilities for configuring IP address forwarding."""
6
 
7
+import netaddr
8
+import netifaces
9
 import re
10
 import subprocess
11
 
12
@@ -32,27 +34,11 @@ class IpForwardingUtils(object):
13
       logger: logger object, used to write to SysLog and serial port.
14
       proto_id: string, the routing protocol identifier for Google IP changes.
15
     """
16
-    self.logger = logger
17
-    self.proto_id = proto_id or '66'
18
 
19
-  def _CreateRouteOptions(self, **kwargs):
20
-    """Create a dictionary of parameters to append to the ip route command.
21
-
22
-    Args:
23
-      **kwargs: dict, the string parameters to update in the ip route command.
24
-
25
-    Returns:
26
-      dict, the string parameters to append to the ip route command.
27
-    """
28
-    options = {
29
-        'proto': self.proto_id,
30
-        'scope': 'host',
31
-    }
32
-    options.update(kwargs)
33
-    return options
34
+    self.logger = logger
35
 
36
-  def _RunIpRoute(self, args=None, options=None):
37
-    """Run a command with ip route and return the response.
38
+  def _RunIfconfig(self, args=None, options=None):
39
+    """Run a command with ifconfig and return the response.
40
 
41
     Args:
42
       args: list, the string ip route command args to execute.
43
@@ -63,7 +49,7 @@ class IpForwardingUtils(object):
44
     """
45
     args = args or []
46
     options = options or {}
47
-    command = ['ip', 'route']
48
+    command = ['ifconfig']
49
     command.extend(args)
50
     for item in options.items():
51
       command.extend(item)
52
@@ -94,25 +80,33 @@ class IpForwardingUtils(object):
53
     forwarded_ips = forwarded_ips or []
54
     for ip in forwarded_ips:
55
       if ip and (IP_REGEX.match(ip) or IP_ALIAS_REGEX.match(ip)):
56
-        addresses.append(ip[:-3] if ip.endswith('/32') else ip)
57
+        addresses.extend([str(addr) for addr in list(netaddr.IPNetwork(ip))])
58
       else:
59
         self.logger.warning('Could not parse IP address: "%s".', ip)
60
     return addresses
61
 
62
-  def GetForwardedIps(self, interface):
63
+  def GetForwardedIps(self, interface, interface_ip):
64
     """Retrieve the list of configured forwarded IP addresses.
65
 
66
     Args:
67
       interface: string, the output device to query.
68
+      interface_ip: string, current interface ip address.
69
 
70
     Returns:
71
       list, the IP address strings.
72
     """
73
-    args = ['ls', 'table', 'local', 'type', 'local']
74
-    options = self._CreateRouteOptions(dev=interface)
75
-    result = self._RunIpRoute(args=args, options=options)
76
-    result = re.sub(r'local\s', r'', result)
77
-    return self.ParseForwardedIps(result.split())
78
+    try:
79
+      ips = netifaces.ifaddresses(interface)
80
+      ips = ips[netifaces.AF_INET]
81
+    except (ValueError, IndexError):
82
+      return []
83
+    forwarded_ips = []
84
+    for ip in ips:
85
+      if ip['addr'] != interface_ip:
86
+        forwarded_ips.append(
87
+            '%s/%d' % (ip['addr'],
88
+            netaddr.IPAddress(ip['netmask']).netmask_bits()))
89
+    return self.ParseForwardedIps(forwarded_ips)
90
 
91
   def AddForwardedIp(self, address, interface):
92
     """Configure a new IP address on the network interface.
93
@@ -121,10 +115,8 @@ class IpForwardingUtils(object):
94
       address: string, the IP address to configure.
95
       interface: string, the output device to use.
96
     """
97
-    address = address if IP_ALIAS_REGEX.match(address) else '%s/32' % address
98
-    args = ['add', 'to', 'local', address]
99
-    options = self._CreateRouteOptions(dev=interface)
100
-    self._RunIpRoute(args=args, options=options)
101
+    for ip in list(netaddr.IPNetwork(address)):
102
+      self._RunIfconfig(args=[interface, 'alias', '%s/32' % str(ip)])
103
 
104
   def RemoveForwardedIp(self, address, interface):
105
     """Delete an IP address on the network interface.
106
@@ -133,7 +125,5 @@ class IpForwardingUtils(object):
107
       address: string, the IP address to configure.
108
       interface: string, the output device to use.
109
     """
110
-    address = address if IP_ALIAS_REGEX.match(address) else '%s/32' % address
111
-    args = ['delete', 'to', 'local', address]
112
-    options = self._CreateRouteOptions(dev=interface)
113
-    self._RunIpRoute(args=args, options=options)
114
+    ip = netaddr.IPNetwork(address)
115
+    self._RunIfconfig(args=[interface, '-alias', str(ip.ip)])
(-)b/sysutils/py-google-compute-engine/files/patch-google__compute__engine_networking_network__daemon.py (+33 lines)
Added Link Here
1
--- google_compute_engine/networking/network_daemon.py.orig	2018-06-11 23:51:09 UTC
2
+++ google_compute_engine/networking/network_daemon.py
3
@@ -96,7 +96,7 @@ class NetworkDaemon(object):
4
     for interface in network_interfaces:
5
       if self.ip_forwarding_enabled:
6
         self.ip_forwarding.HandleForwardedIps(
7
-            interface.name, interface.forwarded_ips)
8
+            interface.name, interface.forwarded_ips, interface.ip)
9
 
10
   def _ExtractInterfaceMetadata(self, metadata):
11
     """Extracts network interface metadata.
12
@@ -119,7 +119,8 @@ class NetworkDaemon(object):
13
         if self.target_instance_ips:
14
           ip_addresses.extend(network_interface.get('targetInstanceIps', []))
15
         interfaces.append(NetworkDaemon.NetworkInterface(
16
-            interface, ip_addresses))
17
+            interface, ip_addresses, network_interface.get('ip', [])))
18
+
19
       else:
20
         message = 'Network interface not found for MAC address: %s.'
21
         self.logger.warning(message, mac_address)
22
@@ -128,9 +129,10 @@ class NetworkDaemon(object):
23
   class NetworkInterface(object):
24
     """Network interface information extracted from metadata."""
25
 
26
-    def __init__(self, name, forwarded_ips=None):
27
+    def __init__(self, name, forwarded_ips=None, ip=None):
28
       self.name = name
29
       self.forwarded_ips = forwarded_ips
30
+      self.ip = ip
31
 
32
 
33
 def main():
(-)b/sysutils/py-google-compute-engine/files/patch-setup.py (-2 / +2 lines)
Lines 1-4 Link Here
1
--- setup.py.orig	2018-02-22 19:44:17 UTC
1
--- setup.py.orig	2018-06-11 23:51:09 UTC
2
+++ setup.py
2
+++ setup.py
3
@@ -34,7 +34,6 @@ setuptools.setup(
3
@@ -34,7 +34,6 @@ setuptools.setup(
4
     long_description='Google Compute Engine guest environment.',
4
     long_description='Google Compute Engine guest environment.',
Lines 6-10 Link Here
6
     packages=setuptools.find_packages(),
6
     packages=setuptools.find_packages(),
7
-    scripts=glob.glob('scripts/*'),
7
-    scripts=glob.glob('scripts/*'),
8
     url='https://github.com/GoogleCloudPlatform/compute-image-packages',
8
     url='https://github.com/GoogleCloudPlatform/compute-image-packages',
9
     version='2.7.6',
9
     version='2.8.3',
10
     # Entry points create scripts in /usr/bin that call a function.
10
     # Entry points create scripts in /usr/bin that call a function.
(-)b/sysutils/py-google-compute-engine/pkg-message (-5 / +2 lines)
Lines 9-18 google_accounts_daemon Responsible for provisioning and Link Here
9
google_clock_skew_daemon	Responsible for syncing the software clock with
9
google_clock_skew_daemon	Responsible for syncing the software clock with
10
				the hypervisor clock
10
				the hypervisor clock
11
google_instance_setup		Configure the guest at boot
11
google_instance_setup		Configure the guest at boot
12
google_ip_forwarding_daemon	Responsible to setup or remove IP routes in the
12
google_network_daemon		Responsible to manage network interfaces and ip
13
				guest
13
				routes in the guest
14
google_network_setup		Responsible to enables all associated network
15
				interfaces
16
google_startup			Implement support for running host provided
14
google_startup			Implement support for running host provided
17
                                startup / shutdown scripts
15
                                startup / shutdown scripts
18
16
19
- 

Return to bug 228949