Re: [Cloud-init-dev] [Merge] ~raharper/cloud-init:fix/netplan-accept-ra-off into cloud-init:master

2018-02-23 Thread Server Team CI bot
Review: Approve continuous-integration

PASSED: Continuous integration, rev:f59bca50f8c24f18a892f937ec18c3bb640baf01
https://jenkins.ubuntu.com/server/job/cloud-init-ci/788/
Executed test runs:
SUCCESS: Checkout
SUCCESS: Unit & Style Tests
SUCCESS: Ubuntu LTS: Build
SUCCESS: Ubuntu LTS: Integration
SUCCESS: MAAS Compatability Testing
IN_PROGRESS: Declarative: Post Actions

Click here to trigger a rebuild:
https://jenkins.ubuntu.com/server/job/cloud-init-ci/788/rebuild

-- 
https://code.launchpad.net/~raharper/cloud-init/+git/cloud-init/+merge/339437
Your team cloud-init commiters is requested to review the proposed merge of 
~raharper/cloud-init:fix/netplan-accept-ra-off into cloud-init:master.

___
Mailing list: https://launchpad.net/~cloud-init-dev
Post to : cloud-init-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~cloud-init-dev
More help   : https://help.launchpad.net/ListHelp


[Cloud-init-dev] [Merge] ~raharper/cloud-init:feature/update-ntp-spec into cloud-init:master

2018-02-23 Thread Ryan Harper
Ryan Harper has proposed merging ~raharper/cloud-init:feature/update-ntp-spec 
into cloud-init:master.

Requested reviews:
  cloud-init commiters (cloud-init-dev)

For more details, see:
https://code.launchpad.net/~raharper/cloud-init/+git/cloud-init/+merge/339438

Implement ntp client spec with auto support for distro selection

Add a common distro handler for determining which ntp client to
use, preferring installed clients over clients which need to be
installed, allow distributions to override the cloud-init defaults

LP: #1749722
-- 
Your team cloud-init commiters is requested to review the proposed merge of 
~raharper/cloud-init:feature/update-ntp-spec into cloud-init:master.
diff --git a/cloudinit/config/cc_ntp.py b/cloudinit/config/cc_ntp.py
index cbd0237..14ed1be 100644
--- a/cloudinit/config/cc_ntp.py
+++ b/cloudinit/config/cc_ntp.py
@@ -15,13 +15,12 @@ from cloudinit import type_utils
 from cloudinit import util
 
 import os
+import tempfile
 from textwrap import dedent
 
 LOG = logging.getLogger(__name__)
 
 frequency = PER_INSTANCE
-NTP_CONF = '/etc/ntp.conf'
-TIMESYNCD_CONF = '/etc/systemd/timesyncd.conf.d/cloud-init.conf'
 NR_POOL_SERVERS = 4
 distros = ['centos', 'debian', 'fedora', 'opensuse', 'sles', 'ubuntu']
 
@@ -49,6 +48,27 @@ schema = {
 'examples': [
 dedent("""\
 ntp:
+  enabled: true
+  ntp_client: myntpclient
+  config:
+ confpath: /etc/myntpclient/myntpclient.conf
+ check_exe: myntpclientd
+ packages:
+   - myntpclient
+ service_name: myntpclient
+ template_name: myntpclient.conf
+ template: |
+ ## template:jinja
+ # My NTP Client config
+ {% if pools -%}# pools{% endif %}
+ {% for pool in pools -%}
+ pool {{pool}} iburst
+ {% endfor %}
+ {%- if servers %}# servers
+ {% endif %}
+ {% for server in servers -%}
+ server {{server}} iburst
+ {% endfor %}
   pools: [0.int.pool.ntp.org, 1.int.pool.ntp.org, ntp.myorg.org]
   servers:
 - ntp.server.local
@@ -83,7 +103,56 @@ schema = {
 List of ntp servers. If both pools and servers are
  empty, 4 default pool servers will be provided with
  the format ``{0-3}.{distro}.pool.ntp.org``.""")
-}
+},
+'ntp_client': {
+'type': 'string',
+'description': dedent("""\
+Name of an NTP client to use to configure system NTP
+"""),
+},
+'enabled': {
+'type': 'boolean',
+'description': "",
+},
+'config': {
+'type': ['object', 'null'],
+'properties': {
+'confpath': {
+'type': 'string',
+'description': "",
+},
+'check_exe': {
+'type': 'string',
+'description': "",
+},
+'name': {
+'type': 'string',
+'description': "",
+},
+'packages': {
+'type': 'array',
+'items': {
+'type': 'string',
+},
+'uniqueItems': True,
+'description': dedent("""\
+List of packages needed to be installed for the
+selected ``ntp_client``."""),
+},
+'service_name': {
+'type': 'string',
+'description': "",
+},
+'template_name': {
+'type': 'string',
+'description': "",
+},
+'template': {
+'type': 'string',
+'description': "",
+},
+},
+},
 },
 'required': [],
 'additionalProperties': False
@@ -103,6 +172,9 @@ def handle(name, cfg, cloud, log, _args):
 ntp_cfg = cfg['ntp']
 if ntp_cfg is None:
 ntp_cfg = {}  # Allow empty config which will install the package
+else:
+# do not allow handle updates to modify the cfg object
+ntp_cfg = cfg['ntp'].copy()
 
 # TODO drop this when validate_cloudconfig_schema is 

[Cloud-init-dev] [Merge] ~raharper/cloud-init:feature/update-ntp-spec into cloud-init:master

2018-02-23 Thread Ryan Harper
The proposal to merge ~raharper/cloud-init:feature/update-ntp-spec into 
cloud-init:master has been updated.

Status: Needs review => Work in progress

For more details, see:
https://code.launchpad.net/~raharper/cloud-init/+git/cloud-init/+merge/339438
-- 
Your team cloud-init commiters is requested to review the proposed merge of 
~raharper/cloud-init:feature/update-ntp-spec into cloud-init:master.

___
Mailing list: https://launchpad.net/~cloud-init-dev
Post to : cloud-init-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~cloud-init-dev
More help   : https://help.launchpad.net/ListHelp


[Cloud-init-dev] [Merge] ~raharper/cloud-init:fix/netplan-accept-ra-off into cloud-init:master

2018-02-23 Thread Ryan Harper
Ryan Harper has proposed merging ~raharper/cloud-init:fix/netplan-accept-ra-off 
into cloud-init:master.

Requested reviews:
  cloud-init commiters (cloud-init-dev)

For more details, see:
https://code.launchpad.net/~raharper/cloud-init/+git/cloud-init/+merge/339437

netplan: disable IPV6 RA mode unless configuring ipv6

On distros using netplan and systemd-networkd the default configuration
is to enable solicitation of of IPV6 Router Advertisments. This incurs
a significant delay during boot, approximately 10 seconds if the network
does not contain any IPV6 routers. If the network configuration that
cloud-init renders is not explicitly configuring IPV6, then disable IPV6 RA
on the interfaces in the configuration.
-- 
Your team cloud-init commiters is requested to review the proposed merge of 
~raharper/cloud-init:fix/netplan-accept-ra-off into cloud-init:master.
diff --git a/cloudinit/net/netplan.py b/cloudinit/net/netplan.py
index d3788af..dc33a47 100644
--- a/cloudinit/net/netplan.py
+++ b/cloudinit/net/netplan.py
@@ -92,6 +92,10 @@ def _extract_addresses(config, entry):
 if sn_type == 'dhcp':
 sn_type += '4'
 entry.update({sn_type: True})
+if sn_type == 'dhcp6':
+entry.update({'accept-ra': True})
+else:
+entry.update({'accept-ra': False})
 elif sn_type in ['static']:
 addr = "%s" % subnet.get('address')
 if 'prefix' in subnet:
@@ -102,6 +106,10 @@ def _extract_addresses(config, entry):
 entry.update({'gateway6': gateway})
 else:
 entry.update({'gateway4': gateway})
+if ':' in addr:
+entry.update({'accept-ra': True})
+else:
+entry.update({'accept-ra': False})
 if 'dns_nameservers' in subnet:
 nameservers += _listify(subnet.get('dns_nameservers', []))
 if 'dns_search' in subnet:
diff --git a/tests/unittests/test_distros/test_netconfig.py b/tests/unittests/test_distros/test_netconfig.py
index 1c2e45f..e9105f1 100644
--- a/tests/unittests/test_distros/test_netconfig.py
+++ b/tests/unittests/test_distros/test_netconfig.py
@@ -126,19 +126,23 @@ network:
 version: 2
 ethernets:
 eth0:
+accept-ra: false
 addresses:
 - 192.168.1.5/24
 gateway4: 192.168.1.254
 eth1:
+accept-ra: false
 dhcp4: true
 """
 
 V2_NET_CFG = {
 'ethernets': {
 'eth7': {
+'accept-ra': False,
 'addresses': ['192.168.1.5/24'],
 'gateway4': '192.168.1.254'},
 'eth9': {
+'accept-ra': True,
 'dhcp4': True}
 },
 'version': 2
@@ -154,10 +158,12 @@ V2_TO_V2_NET_CFG_OUTPUT = """
 network:
 ethernets:
 eth7:
+accept-ra: false
 addresses:
 - 192.168.1.5/24
 gateway4: 192.168.1.254
 eth9:
+accept-ra: true
 dhcp4: true
 version: 2
 """
diff --git a/tests/unittests/test_net.py b/tests/unittests/test_net.py
index ac33e8e..de082cb 100644
--- a/tests/unittests/test_net.py
+++ b/tests/unittests/test_net.py
@@ -403,6 +403,7 @@ NETWORK_CONFIGS = {
 - wark.maas
 set-name: eth1
 eth99:
+accept-ra: false
 addresses:
 - 192.168.21.3/24
 dhcp4: true
@@ -495,6 +496,7 @@ NETWORK_CONFIGS = {
 version: 2
 ethernets:
 iface0:
+accept-ra: true
 dhcp4: true
 dhcp6: true
 """).rstrip(' '),
@@ -528,6 +530,7 @@ NETWORK_CONFIGS = {
 version: 2
 ethernets:
 iface0:
+accept-ra: true
 addresses:
 - 192.168.14.2/24
 - 2001:1::1/64
@@ -719,6 +722,7 @@ pre-down route del -net 10.0.0.0 netmask 255.0.0.0 gw 11.0.0.1 metric 3 || true
 - foobar.maas
 set-name: eth4
 eth5:
+accept-ra: false
 dhcp4: true
 match:
 macaddress: 98:bb:9f:2c:e8:8a
@@ -734,6 +738,7 @@ pre-down route del -net 10.0.0.0 netmask 255.0.0.0 gw 11.0.0.1 metric 3 || true
 set-name: eth5
 bonds:
 bond0:
+accept-ra: true
 dhcp6: true
 interfaces:
 - eth1
@@ -744,6 +749,7 @@ pre-down route del -net 10.0.0.0 netmask 255.0.0.0 gw 11.0.0.1 metric 3 || true
 transmit-hash-policy: 

[Cloud-init-dev] [Merge] ~smoser/cloud-init:bug/1751051-subp-encode-with-utf8 into cloud-init:master

2018-02-23 Thread Scott Moser
The proposal to merge ~smoser/cloud-init:bug/1751051-subp-encode-with-utf8 into 
cloud-init:master has been updated.

Commit Message changed to:

subp: Fix subp usage with non-ascii characters when no system locale.

If python starts up without a locale set, then its default encoding
ends up set as ascii.  That is not easily changed with the likes of
setlocale.  In order to avoid UnicodeDecodeErrors cloud-init will
encode to bytes a python3 string or python2 basestring so that the
values passed to Popen are already bytes.

LP: #1751051

For more details, see:
https://code.launchpad.net/~smoser/cloud-init/+git/cloud-init/+merge/338586
-- 
Your team cloud-init commiters is requested to review the proposed merge of 
~smoser/cloud-init:bug/1751051-subp-encode-with-utf8 into cloud-init:master.

___
Mailing list: https://launchpad.net/~cloud-init-dev
Post to : cloud-init-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~cloud-init-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Cloud-init-dev] [Merge] ~smoser/cloud-init:bug/1751051-subp-encode-with-utf8 into cloud-init:master

2018-02-23 Thread Scott Moser
yeah, good catch. updated commit message and the comment also.

-- 
https://code.launchpad.net/~smoser/cloud-init/+git/cloud-init/+merge/338586
Your team cloud-init commiters is requested to review the proposed merge of 
~smoser/cloud-init:bug/1751051-subp-encode-with-utf8 into cloud-init:master.

___
Mailing list: https://launchpad.net/~cloud-init-dev
Post to : cloud-init-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~cloud-init-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Cloud-init-dev] [Merge] ~smoser/cloud-init:bug/1751051-subp-encode-with-utf8 into cloud-init:master

2018-02-23 Thread Ryan Harper
Nifty test, and good change.  The comment doesn't quite match the code;

'cloud-init will decode' 

should be 'cloud-init will encode' 

Right?
-- 
https://code.launchpad.net/~smoser/cloud-init/+git/cloud-init/+merge/338586
Your team cloud-init commiters is requested to review the proposed merge of 
~smoser/cloud-init:bug/1751051-subp-encode-with-utf8 into cloud-init:master.

___
Mailing list: https://launchpad.net/~cloud-init-dev
Post to : cloud-init-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~cloud-init-dev
More help   : https://help.launchpad.net/ListHelp


Re: [Cloud-init-dev] [Merge] ~rski/cloud-init:puppet_4 into cloud-init:master

2018-02-23 Thread Scott Moser
Romanos,
Sorry to keep bothering you :)

Thanks again for your help.

I looked to pull this in, and found that it has merge conflicts
with master.

I've rebased onto master and would just like you to review my
changes.

See https://code.launchpad.net/~smoser/cloud-init/+git/cloud-init/+merge/339373

With your approval there, I'll merge that.
-- 
https://code.launchpad.net/~rski/cloud-init/+git/cloud-init/+merge/312284
Your team cloud-init commiters is requested to review the proposed merge of 
~rski/cloud-init:puppet_4 into cloud-init:master.

___
Mailing list: https://launchpad.net/~cloud-init-dev
Post to : cloud-init-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~cloud-init-dev
More help   : https://help.launchpad.net/ListHelp