Re: [Cloud-init-dev] [Merge] ~chad.smith/cloud-init:feature/snap-module into cloud-init:master

2018-03-15 Thread Simon Poirier
Review: Approve

+1 LGTM
-- 
https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/338366
Your team cloud-init commiters is requested to review the proposed merge of 
~chad.smith/cloud-init:feature/snap-module 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] ~chad.smith/cloud-init:feature/snap-module into cloud-init:master

2018-03-15 Thread Server Team CI bot
Review: Approve continuous-integration

PASSED: Continuous integration, rev:a158a134a000178b180e016ba3dafd0633d5789f
https://jenkins.ubuntu.com/server/job/cloud-init-ci/861/
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/861/rebuild

-- 
https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/338366
Your team cloud-init commiters is requested to review the proposed merge of 
~chad.smith/cloud-init:feature/snap-module 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] ~chad.smith/cloud-init:feature/snap-module into cloud-init:master

2018-03-15 Thread Chad Smith


Diff comments:

> diff --git a/cloudinit/config/cc_snap.py b/cloudinit/config/cc_snap.py
> new file mode 100644
> index 000..3210d6d
> --- /dev/null
> +++ b/cloudinit/config/cc_snap.py
> @@ -0,0 +1,272 @@
> +# Copyright (C) 2018 Canonical Ltd.
> +#
> +# This file is part of cloud-init. See LICENSE file for license information.
> +
> +"""Snap: Install, configure and manage snapd and snap packages."""
> +
> +import sys
> +from textwrap import dedent
> +
> +from cloudinit import log as logging
> +from cloudinit.config.schema import (
> +get_schema_doc, validate_cloudconfig_schema)
> +from cloudinit.settings import PER_INSTANCE
> +from cloudinit import util
> +
> +
> +distros = ['ubuntu']
> +frequency = PER_INSTANCE
> +
> +LOG = logging.getLogger(__name__)
> +
> +schema = {
> +'id': 'cc_snap',
> +'name': 'Snap',
> +'title': 'Install, configure and manage snapd and snap packages',
> +'description': dedent("""\
> +This module provides a simple configuration namespace in cloud-init 
> to
> +both setup snapd and install snaps.
> +
> +.. note::
> +Both ``assertions`` and ``commands`` values can be either a
> +dictionary or a list. If these configs are provided as a
> +dictionary, the keys are only used to order the execution of the
> +assertions or commands and the dictionary is merged with any
> +vendor-data snap configuration provided. If a list is provided by
> +the user instead of a dict, any vendor-data snap configuration is
> +ignored.
> +
> +The ``assertions`` configuration option is a dictionary or list of
> +properly-signed snap assertions which will run before any snap
> +``commands``. They will be added to snapd's assertion database by
> +invoking ``snap ack ``.
> +
> +Snap ``commands`` is a dictionary or list of individual snap
> +commands to run on the target system. These commands can be used to
> +create snap users, install snaps and provide snap configuration.
> +
> +.. note::
> +If 'side-loading' private/unpublished snaps on an instance, it is
> +best to create a snap seed directory and seed.yaml manifest in
> +**/var/lib/snapd/seed/** which snapd automatically installs on
> +startup.
> +
> +**Development only**: The ``squashfuse_in_container`` boolean can be
> +set true to install squashfuse package when in a container to enable
> +snap installs. Default is false.
> +"""),
> +'distros': distros,
> +'examples': [dedent("""\
> +snap:
> +assertions:
> +  00: |
> +  signed_assertion_blob_here
> +  02: |
> +  signed_assertion_blob_here
> +commands:
> +  00: snap create-user --sudoer --known @mydomain.com
> +  01: snap install canonical-livepatch
> +  02: canonical-livepatch enable 
> +"""), dedent("""\
> +# LXC-based containers require squashfuse before snaps can be 
> installed
> +snap:
> +commands:
> +00: apt-get install squashfuse -y
> +11: snap install emoj
> +
> +"""), dedent("""\
> +# Convenience: the snap command can be ommited when specifying 
> commands

fixed

> +# as a list and 'snap' will automatically be prepended.
> +# The following commands are equivalent:
> +snap:
> +commands:
> +00: ['install', 'vlc']
> +01: ['snap', 'install', 'vlc']
> +02: snap install vlc
> +03: 'snap install vlc'
> +""")],
> +'frequency': PER_INSTANCE,
> +'type': 'object',
> +'properties': {
> +'snap': {
> +'type': 'object',
> +'properties': {
> +'assertions': {
> +'type': ['object', 'array'],  # Array of strings or dict
> +'items': {'type': 'string'},
> +'additionalItems': False,  # Reject items non-string
> +'minItems': 1,
> +'minProperties': 1,
> +'uniqueItems': True
> +},
> +'commands': {
> +'type': ['object', 'array'],  # Array of strings or dict
> +'items': {
> +'oneOf': [
> +{'type': 'array', 'items': {'type': 'string'}},
> +{'type': 'string'}]
> +},
> +'additionalItems': False,  # Reject non-string & non-list
> +'minItems': 1,
> +'minProperties': 1,
> +'uniqueItems': True
> +},
> +'squashfuse_in_container': {
> +'type': 'boolean'
> +}
> +

[Cloud-init-dev] [Merge] ~chad.smith/cloud-init:feature/snap-module into cloud-init:master

2018-03-15 Thread Chad Smith
The proposal to merge ~chad.smith/cloud-init:feature/snap-module into 
cloud-init:master has been updated.

Description changed to:

see commit message.

to test:
1. make a deb of this branch
make deb;
2. create a container and install the deb
lxc launch ubuntu-daily/bionic myb1;
lxc file push cloud-init_18*deb myb1/;
lxc exec myb1 -- dpkg -i /cloud-init*deb;

3. install snap user-data cloud-config
cat > snap.yaml 

[Cloud-init-dev] [Merge] ~chad.smith/cloud-init:feature/snap-module into cloud-init:master

2018-03-15 Thread Chad Smith
The proposal to merge ~chad.smith/cloud-init:feature/snap-module into 
cloud-init:master has been updated.

Description changed to:

see commit message.

to test:
1. make a deb of this branch
make deb;
2. create a container and install the deb
lxc launch ubuntu-daily/bionic myb1;
lxc file push cloud-init_18*deb myb1/;

3. install snap user-data cloud-config
cat > snap.yaml 

Re: [Cloud-init-dev] [Merge] ~chad.smith/cloud-init:feature/snap-module into cloud-init:master

2018-03-15 Thread Server Team CI bot
Review: Approve continuous-integration

PASSED: Continuous integration, rev:fd11c422178edb75572ba0258369af3a074f6b3a
https://jenkins.ubuntu.com/server/job/cloud-init-ci/858/
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/858/rebuild

-- 
https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/338366
Your team cloud-init commiters is requested to review the proposed merge of 
~chad.smith/cloud-init:feature/snap-module 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] ~chad.smith/cloud-init:feature/snap-module into cloud-init:master

2018-03-15 Thread Simon Poirier


Diff comments:

> diff --git a/cloudinit/config/cc_snap.py b/cloudinit/config/cc_snap.py
> new file mode 100644
> index 000..3210d6d
> --- /dev/null
> +++ b/cloudinit/config/cc_snap.py
> @@ -0,0 +1,272 @@
> +# Copyright (C) 2018 Canonical Ltd.
> +#
> +# This file is part of cloud-init. See LICENSE file for license information.
> +
> +"""Snap: Install, configure and manage snapd and snap packages."""
> +
> +import sys
> +from textwrap import dedent
> +
> +from cloudinit import log as logging
> +from cloudinit.config.schema import (
> +get_schema_doc, validate_cloudconfig_schema)
> +from cloudinit.settings import PER_INSTANCE
> +from cloudinit import util
> +
> +
> +distros = ['ubuntu']
> +frequency = PER_INSTANCE
> +
> +LOG = logging.getLogger(__name__)
> +
> +schema = {
> +'id': 'cc_snap',
> +'name': 'Snap',
> +'title': 'Install, configure and manage snapd and snap packages',
> +'description': dedent("""\
> +This module provides a simple configuration namespace in cloud-init 
> to
> +both setup snapd and install snaps.
> +
> +.. note::
> +Both ``assertions`` and ``commands`` values can be either a
> +dictionary or a list. If these configs are provided as a
> +dictionary, the keys are only used to order the execution of the
> +assertions or commands and the dictionary is merged with any
> +vendor-data snap configuration provided. If a list is provided by
> +the user instead of a dict, any vendor-data snap configuration is
> +ignored.
> +
> +The ``assertions`` configuration option is a dictionary or list of
> +properly-signed snap assertions which will run before any snap
> +``commands``. They will be added to snapd's assertion database by
> +invoking ``snap ack ``.
> +
> +Snap ``commands`` is a dictionary or list of individual snap
> +commands to run on the target system. These commands can be used to
> +create snap users, install snaps and provide snap configuration.
> +
> +.. note::
> +If 'side-loading' private/unpublished snaps on an instance, it is
> +best to create a snap seed directory and seed.yaml manifest in
> +**/var/lib/snapd/seed/** which snapd automatically installs on
> +startup.
> +
> +**Development only**: The ``squashfuse_in_container`` boolean can be
> +set true to install squashfuse package when in a container to enable
> +snap installs. Default is false.
> +"""),
> +'distros': distros,
> +'examples': [dedent("""\
> +snap:
> +assertions:
> +  00: |
> +  signed_assertion_blob_here
> +  02: |
> +  signed_assertion_blob_here
> +commands:
> +  00: snap create-user --sudoer --known @mydomain.com
> +  01: snap install canonical-livepatch
> +  02: canonical-livepatch enable 
> +"""), dedent("""\
> +# LXC-based containers require squashfuse before snaps can be 
> installed
> +snap:
> +commands:
> +00: apt-get install squashfuse -y
> +11: snap install emoj
> +
> +"""), dedent("""\
> +# Convenience: the snap command can be ommited when specifying 
> commands

typo: s/ommited/omitted/

> +# as a list and 'snap' will automatically be prepended.
> +# The following commands are equivalent:
> +snap:
> +commands:
> +00: ['install', 'vlc']
> +01: ['snap', 'install', 'vlc']
> +02: snap install vlc
> +03: 'snap install vlc'
> +""")],
> +'frequency': PER_INSTANCE,
> +'type': 'object',
> +'properties': {
> +'snap': {
> +'type': 'object',
> +'properties': {
> +'assertions': {
> +'type': ['object', 'array'],  # Array of strings or dict
> +'items': {'type': 'string'},
> +'additionalItems': False,  # Reject items non-string
> +'minItems': 1,
> +'minProperties': 1,
> +'uniqueItems': True
> +},
> +'commands': {
> +'type': ['object', 'array'],  # Array of strings or dict
> +'items': {
> +'oneOf': [
> +{'type': 'array', 'items': {'type': 'string'}},
> +{'type': 'string'}]
> +},
> +'additionalItems': False,  # Reject non-string & non-list
> +'minItems': 1,
> +'minProperties': 1,
> +'uniqueItems': True
> +},
> +'squashfuse_in_container': {
> +'type': 'boolean'
> +  

Re: [Cloud-init-dev] [Merge] ~chad.smith/cloud-init:feature/snap-module into cloud-init:master

2018-03-15 Thread Server Team CI bot
Review: Needs Fixing continuous-integration

FAILED: Continuous integration, rev:357e9a9919e45b7455259f55db157f50859b0b28
https://jenkins.ubuntu.com/server/job/cloud-init-ci/857/
Executed test runs:
SUCCESS: Checkout
FAILED: Unit & Style Tests

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

-- 
https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/338366
Your team cloud-init commiters is requested to review the proposed merge of 
~chad.smith/cloud-init:feature/snap-module 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] ~chad.smith/cloud-init:feature/snap-module into cloud-init:master

2018-03-15 Thread Server Team CI bot
Review: Needs Fixing continuous-integration

FAILED: Continuous integration, rev:88980f346d0c926559ce2be207acc3da2f9c8e98
https://jenkins.ubuntu.com/server/job/cloud-init-ci/855/
Executed test runs:
SUCCESS: Checkout
SUCCESS: Unit & Style Tests
SUCCESS: Ubuntu LTS: Build
SUCCESS: Ubuntu LTS: Integration
FAILED: MAAS Compatability Testing

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

-- 
https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/338366
Your team cloud-init commiters is requested to review the proposed merge of 
~chad.smith/cloud-init:feature/snap-module 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] ~chad.smith/cloud-init:feature/snap-module into cloud-init:master

2018-03-15 Thread Server Team CI bot
Review: Needs Fixing continuous-integration

FAILED: Continuous integration, rev:743df1cd81eb55d0fc2670fa480a44d9445b3f5a
https://jenkins.ubuntu.com/server/job/cloud-init-ci/853/
Executed test runs:
SUCCESS: Checkout
SUCCESS: Unit & Style Tests
SUCCESS: Ubuntu LTS: Build
SUCCESS: Ubuntu LTS: Integration
FAILED: MAAS Compatability Testing

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

-- 
https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/338366
Your team cloud-init commiters is requested to review the proposed merge of 
~chad.smith/cloud-init:feature/snap-module 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] ~chad.smith/cloud-init:bug/util-subp-accepts-string-cmd into cloud-init:master

2018-03-15 Thread Server Team CI bot
Review: Needs Fixing continuous-integration

FAILED: Continuous integration, rev:47aea438bc0c278cf48bd9f56087e610ee1e96b0
https://jenkins.ubuntu.com/server/job/cloud-init-ci/850/
Executed test runs:
SUCCESS: Checkout
SUCCESS: Unit & Style Tests
SUCCESS: Ubuntu LTS: Build
FAILED: Ubuntu LTS: Integration

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

-- 
https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/341437
Your team cloud-init commiters is requested to review the proposed merge of 
~chad.smith/cloud-init:bug/util-subp-accepts-string-cmd 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] ~smoser/cloud-init:fix/pylint-bionic-python into cloud-init:master

2018-03-15 Thread Scott Moser
Scott Moser has proposed merging ~smoser/cloud-init:fix/pylint-bionic-python 
into cloud-init:master.

Commit message:
tests: Fix some warnings in tests that popped up with newer python.

When running 'tox -e pylint' on a bionic system (python 3.6.4) I started
seeing errors today like:
  tests/cloud_tests/platforms/__init__.py:5: [E0401(import-error), ]
  Unable to import 'tests.cloud_tests.platforms.ec2'

The fix for those first errors was simply to create the __init__.py.
The second set of changes fixes fallout found from actually now having
pylint properly run on more of the cloud_tests.

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

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

see commit message
-- 
Your team cloud-init commiters is requested to review the proposed merge of 
~smoser/cloud-init:fix/pylint-bionic-python into cloud-init:master.
diff --git a/.pylintrc b/.pylintrc
index 05a086d..0bdfa59 100644
--- a/.pylintrc
+++ b/.pylintrc
@@ -46,7 +46,17 @@ reports=no
 # (useful for modules/projects where namespaces are manipulated during runtime
 # and thus existing member attributes cannot be deduced by static analysis. It
 # supports qualified module names, as well as Unix pattern matching.
-ignored-modules=six.moves,pkg_resources,httplib,http.client,paramiko,simplestreams
+ignored-modules=
+ http.client,
+ httplib,
+ pkg_resources,
+ six.moves,
+ # cloud_tests requirements.
+ boto3,
+ botocore,
+ paramiko,
+ pylxd,
+ simplestreams
 
 # List of class names for which member attributes should not be checked (useful
 # for classes with dynamically set attributes). This supports the use of
diff --git a/tests/cloud_tests/platforms/ec2/__init__.py b/tests/cloud_tests/platforms/ec2/__init__.py
new file mode 100644
index 000..e69de29
--- /dev/null
+++ b/tests/cloud_tests/platforms/ec2/__init__.py
diff --git a/tests/cloud_tests/platforms/lxd/__init__.py b/tests/cloud_tests/platforms/lxd/__init__.py
new file mode 100644
index 000..e69de29
--- /dev/null
+++ b/tests/cloud_tests/platforms/lxd/__init__.py
diff --git a/tests/cloud_tests/platforms/lxd/platform.py b/tests/cloud_tests/platforms/lxd/platform.py
index 6a01692..f7251a0 100644
--- a/tests/cloud_tests/platforms/lxd/platform.py
+++ b/tests/cloud_tests/platforms/lxd/platform.py
@@ -101,8 +101,4 @@ class LXDPlatform(Platform):
 """
 return self.client.images.get_by_alias(alias)
 
-def destroy(self):
-"""Clean up platform data."""
-super(LXDPlatform, self).destroy()
-
 # vi: ts=4 expandtab
diff --git a/tests/cloud_tests/platforms/nocloudkvm/__init__.py b/tests/cloud_tests/platforms/nocloudkvm/__init__.py
new file mode 100644
index 000..e69de29
--- /dev/null
+++ b/tests/cloud_tests/platforms/nocloudkvm/__init__.py
diff --git a/tests/cloud_tests/platforms/nocloudkvm/instance.py b/tests/cloud_tests/platforms/nocloudkvm/instance.py
index 932dc0f..33ff3f2 100644
--- a/tests/cloud_tests/platforms/nocloudkvm/instance.py
+++ b/tests/cloud_tests/platforms/nocloudkvm/instance.py
@@ -109,7 +109,7 @@ class NoCloudKVMInstance(Instance):
 if self.pid:
 try:
 c_util.subp(['kill', '-9', self.pid])
-except util.ProcessExectuionError:
+except c_util.ProcessExecutionError:
 pass
 
 if self.pid_file:
diff --git a/tests/cloud_tests/platforms/nocloudkvm/platform.py b/tests/cloud_tests/platforms/nocloudkvm/platform.py
index a7e6f5d..8593346 100644
--- a/tests/cloud_tests/platforms/nocloudkvm/platform.py
+++ b/tests/cloud_tests/platforms/nocloudkvm/platform.py
@@ -21,10 +21,6 @@ class NoCloudKVMPlatform(Platform):
 
 platform_name = 'nocloud-kvm'
 
-def __init__(self, config):
-"""Set up platform."""
-super(NoCloudKVMPlatform, self).__init__(config)
-
 def get_image(self, img_conf):
 """Get image using specified image configuration.
 
___
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