Re: [Cloud-init-dev] [Merge] ~adam-collard/cloud-init:migrate-lp-to-github into cloud-init:main

2022-02-24 Thread Chad Smith
Confirmed this character is who he says he is, and maps to github user 
sparkiegeek
-- 
https://code.launchpad.net/~adam-collard/cloud-init/+git/cloud-init/+merge/416016
Your team cloud-init Commiters is requested to review the proposed merge of 
~adam-collard/cloud-init:migrate-lp-to-github into cloud-init:main.


___
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] ~vorlon/cloud-init:lp.1959343 into cloud-init:main

2022-01-27 Thread Chad Smith
The proposal to merge ~vorlon/cloud-init:lp.1959343 into cloud-init:main has 
been updated.

Status: Needs review => Rejected

For more details, see:
https://code.launchpad.net/~vorlon/cloud-init/+git/cloud-init/+merge/414703
-- 
Your team cloud-init Commiters is requested to review the proposed merge of 
~vorlon/cloud-init:lp.1959343 into cloud-init:main.


___
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] ~vorlon/cloud-init:lp.1959343 into cloud-init:main

2022-01-27 Thread Chad Smith
I approve this message, we can easily carry a quily patch in our ubuntu/focal & 
ubuntu/bionic upstream branches to leave this commented out apt source 
unredacted. No reason to carry that template formard  on upstream/main.


Since our git+launchpad repo is simply a mirror of our upstream repo, I'd 
prefer if we proposed and landed a PR up here 
https://github.com/canonical/cloud-init/pulls.  Then James, Brett or myself 
will make sure to observe correct/unchanged behavior on 20.04 and 18.04 in our 
next SRU.
-- 
https://code.launchpad.net/~vorlon/cloud-init/+git/cloud-init/+merge/414703
Your team cloud-init Commiters is requested to review the proposed merge of 
~vorlon/cloud-init:lp.1959343 into cloud-init:main.


___
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] cloud-init merge proposal landed

2019-12-04 Thread Chad Smith


This merge has landed in commit 5454fbb1 to cloud-init branch master.

To view that commit see the following URL:
https://github.com/canonical/cloud-init/commit/5454fbb1
-- 
https://code.launchpad.net/~ahosmanmsft/cloud-init/+git/cloud-init/+merge/376350
Your team cloud-init Commiters is requested to review the proposed merge of 
~ahosmanmsft/cloud-init:migrate-lp-to-github 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] ~ahosmanmsft/cloud-init:migrate-lp-to-github into cloud-init:master

2019-12-04 Thread Chad Smith
The proposal to merge ~ahosmanmsft/cloud-init:migrate-lp-to-github into 
cloud-init:master has been updated.

Status: Approved => Merged

For more details, see:
https://code.launchpad.net/~ahosmanmsft/cloud-init/+git/cloud-init/+merge/376350
-- 
Your team cloud-init Commiters is requested to review the proposed merge of 
~ahosmanmsft/cloud-init:migrate-lp-to-github 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] ~ahosmanmsft/cloud-init:migrate-lp-to-github into cloud-init:master

2019-12-04 Thread Chad Smith
The proposal to merge ~ahosmanmsft/cloud-init:migrate-lp-to-github into 
cloud-init:master has been updated.

Status: Needs review => Approved

For more details, see:
https://code.launchpad.net/~ahosmanmsft/cloud-init/+git/cloud-init/+merge/376350
-- 
Your team cloud-init Commiters is requested to review the proposed merge of 
~ahosmanmsft/cloud-init:migrate-lp-to-github 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] ~d-info-e/cloud-init:migrate-lp-to-github into cloud-init:master

2019-11-25 Thread Chad Smith
The proposal to merge ~d-info-e/cloud-init:migrate-lp-to-github into 
cloud-init:master has been updated.

Status: Approved => Merged

For more details, see:
https://code.launchpad.net/~d-info-e/cloud-init/+git/cloud-init/+merge/375953
-- 
Your team cloud-init Commiters is requested to review the proposed merge of 
~d-info-e/cloud-init:migrate-lp-to-github 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] cloud-init merge proposal landed

2019-11-25 Thread Chad Smith


This merge has landed in commit aa935aef to cloud-init branch master.

To view that commit see the following URL:
https://github.com/canonical/cloud-init/commit/aa935aef
-- 
https://code.launchpad.net/~d-info-e/cloud-init/+git/cloud-init/+merge/375953
Your team cloud-init Commiters is requested to review the proposed merge of 
~d-info-e/cloud-init:migrate-lp-to-github 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] ~d-info-e/cloud-init:migrate-lp-to-github into cloud-init:master

2019-11-25 Thread Chad Smith
The proposal to merge ~d-info-e/cloud-init:migrate-lp-to-github into 
cloud-init:master has been updated.

Status: Needs review => Approved

For more details, see:
https://code.launchpad.net/~d-info-e/cloud-init/+git/cloud-init/+merge/375953
-- 
Your team cloud-init Commiters is requested to review the proposed merge of 
~d-info-e/cloud-init:migrate-lp-to-github 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] ~harald-jensas/cloud-init:migrate-lp-to-github into cloud-init:master

2019-11-15 Thread Chad Smith
The proposal to merge ~harald-jensas/cloud-init:migrate-lp-to-github into 
cloud-init:master has been updated.

Status: Approved => Merged

For more details, see:
https://code.launchpad.net/~harald-jensas/cloud-init/+git/cloud-init/+merge/375595
-- 
Your team cloud-init Commiters is requested to review the proposed merge of 
~harald-jensas/cloud-init:migrate-lp-to-github 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] cloud-init merge proposal landed

2019-11-15 Thread Chad Smith


This merge has landed in commit 3baabe76 to cloud-init branch master.

To view that commit see the following URL:
https://github.com/canonical/cloud-init/commit/3baabe76
-- 
https://code.launchpad.net/~harald-jensas/cloud-init/+git/cloud-init/+merge/375595
Your team cloud-init Commiters is requested to review the proposed merge of 
~harald-jensas/cloud-init:migrate-lp-to-github 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] ~harald-jensas/cloud-init:migrate-lp-to-github into cloud-init:master

2019-11-15 Thread Chad Smith
The proposal to merge ~harald-jensas/cloud-init:migrate-lp-to-github into 
cloud-init:master has been updated.

Status: Merged => Approved

For more details, see:
https://code.launchpad.net/~harald-jensas/cloud-init/+git/cloud-init/+merge/375595
-- 
Your team cloud-init Commiters is requested to review the proposed merge of 
~harald-jensas/cloud-init:migrate-lp-to-github 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] ~harald-jensas/cloud-init:migrate-lp-to-github into cloud-init:master

2019-11-15 Thread Chad Smith
The proposal to merge ~harald-jensas/cloud-init:migrate-lp-to-github into 
cloud-init:master has been updated.

Status: Approved => Merged

For more details, see:
https://code.launchpad.net/~harald-jensas/cloud-init/+git/cloud-init/+merge/375595
-- 
Your team cloud-init Commiters is requested to review the proposed merge of 
~harald-jensas/cloud-init:migrate-lp-to-github 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] cloud-init merge proposal landed

2019-11-15 Thread Chad Smith


This merge has landed in commit 68fc7b7b to cloud-init branch master.

To view that commit see the following URL:
https://git.launchpad.net/cloud-init/commit/?id=68fc7b7b
-- 
https://code.launchpad.net/~harald-jensas/cloud-init/+git/cloud-init/+merge/375595
Your team cloud-init Commiters is requested to review the proposed merge of 
~harald-jensas/cloud-init:migrate-lp-to-github 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] ~harald-jensas/cloud-init:migrate-lp-to-github into cloud-init:master

2019-11-15 Thread Chad Smith
The proposal to merge ~harald-jensas/cloud-init:migrate-lp-to-github into 
cloud-init:master has been updated.

Status: Needs review => Approved

For more details, see:
https://code.launchpad.net/~harald-jensas/cloud-init/+git/cloud-init/+merge/375595
-- 
Your team cloud-init Commiters is requested to review the proposed merge of 
~harald-jensas/cloud-init:migrate-lp-to-github 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] ~legovini/cloud-init:migrate-lp-to-github into cloud-init:master

2019-11-08 Thread Chad Smith
The proposal to merge ~legovini/cloud-init:migrate-lp-to-github into 
cloud-init:master has been updated.

Status: Approved => Merged

For more details, see:
https://code.launchpad.net/~legovini/cloud-init/+git/cloud-init/+merge/375330
-- 
Your team cloud-init Commiters is requested to review the proposed merge of 
~legovini/cloud-init:migrate-lp-to-github 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] cloud-init merge proposal landed

2019-11-08 Thread Chad Smith


This merge has landed in commit 8ae0a703 to cloud-init branch master.

To view that commit see the following URL:
https://github.com/canonical/cloud-init/commit/8ae0a703
-- 
https://code.launchpad.net/~legovini/cloud-init/+git/cloud-init/+merge/375330
Your team cloud-init Commiters is requested to review the proposed merge of 
~legovini/cloud-init:migrate-lp-to-github 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] ~legovini/cloud-init:migrate-lp-to-github into cloud-init:master

2019-11-08 Thread Chad Smith
The proposal to merge ~legovini/cloud-init:migrate-lp-to-github into 
cloud-init:master has been updated.

Status: Needs review => Approved

For more details, see:
https://code.launchpad.net/~legovini/cloud-init/+git/cloud-init/+merge/375330
-- 
Your team cloud-init Commiters is requested to review the proposed merge of 
~legovini/cloud-init:migrate-lp-to-github 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] ~chad.smith/cloud-init:migrate-lp-to-github into cloud-init:master

2019-11-07 Thread Chad Smith
Chad Smith has proposed merging ~chad.smith/cloud-init:migrate-lp-to-github 
into cloud-init:master.

Commit message:
lp-to-git-users: adding blackboxsw

Mapped from chad.smith


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

For more details, see:
https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/375298
-- 
Your team cloud-init Commiters is requested to review the proposed merge of 
~chad.smith/cloud-init:migrate-lp-to-github into cloud-init:master.
diff --git a/tools/.lp-to-git-user b/tools/.lp-to-git-user
index 0967ef4..214bf5c 100644
--- a/tools/.lp-to-git-user
+++ b/tools/.lp-to-git-user
@@ -1 +1,3 @@
-{}
+{
+ "chad.smith": "blackboxsw"
+}
\ No newline at end of file
___
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] ~chad.smith/cloud-init:docs/intro into cloud-init:master

2019-11-07 Thread Chad Smith
Chad Smith has proposed merging ~chad.smith/cloud-init:docs/intro into 
cloud-init:master.

Commit message:
docs: touchups in rtd intro and README.md

- rtd/index.rst: update sentence to read:
  cloud-init will also parse and process any optional user data
- README.md:
  - update travis badge url to project home: github/canonical/cloud-init
  - update page title to:
Cloud-init official project upstream as of 11/2019

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

For more details, see:
https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/375282
-- 
Your team cloud-init Commiters is requested to review the proposed merge of 
~chad.smith/cloud-init:docs/intro into cloud-init:master.
diff --git a/README.md b/README.md
index 07347d9..9e47b28 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,7 @@
-# Cloud-init official mirror synced from https://launchpad.net/cloud-init
+# Cloud-init official project upstream as of 11/2019
+This repository is also mirrored to https://launchpad.net/cloud-init
 
-[![Build Status](https://travis-ci.org/cloud-init/cloud-init.svg?branch=master)](https://travis-ci.org/cloud-init/cloud-init) [![Read the Docs](https://readthedocs.org/projects/cloudinit/badge/?version=latest=flat)](https://cloudinit.readthedocs.org)
+[![Build Status](https://travis-ci.org/canonical/cloud-init.svg?branch=master)](https://travis-ci.org/canonical/cloud-init) [![Read the Docs](https://readthedocs.org/projects/cloudinit/badge/?version=latest=flat)](https://cloudinit.readthedocs.org)
 
 Cloud-init is the *industry standard* multi-distribution method for
 cross-platform cloud instance initialization. It is supported across all
@@ -21,7 +22,7 @@ also parse and process any optional user or vendor data that was passed to the
 instance.
 
 ## Getting involved
-All contributions welcome! [Join us easily following our hacking guide](https://cloudinit.readthedocs.io/en/latest/topics/hacking.html)
+All contributions welcome! [Submit code and docs by following our hacking guide](https://cloudinit.readthedocs.io/en/latest/topics/hacking.html)
 
 ## Getting help
 
diff --git a/doc/rtd/index.rst b/doc/rtd/index.rst
index db1cdb4..826e8c4 100644
--- a/doc/rtd/index.rst
+++ b/doc/rtd/index.rst
@@ -18,7 +18,7 @@ Cloud-init will identify the cloud it is running on during boot, read any
 provided metadata from the cloud and initialize the system accordingly. This
 may involve setting up the network and storage devices to configuring SSH
 access key and many other aspects of a system. Later on the cloud-init will
-also parse and any optional user or vendor data that was passed to the
+also parse and process any optional user or vendor data that was passed to the
 instance.
 
 Getting help
___
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] ~chad.smith/cloud-init:tools/migrate-script-v2 into cloud-init:master

2019-11-07 Thread Chad Smith
The proposal to merge ~chad.smith/cloud-init:tools/migrate-script-v2 into 
cloud-init:master has been updated.

Status: Needs review => Approved

For more details, see:
https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/375273
-- 
Your team cloud-init Commiters is requested to review the proposed merge of 
~chad.smith/cloud-init:tools/migrate-script-v2 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] ~chad.smith/cloud-init:tools/migrate-script-v2 into cloud-init:master

2019-11-07 Thread Chad Smith
Chad Smith has proposed merging ~chad.smith/cloud-init:tools/migrate-script-v2 
into cloud-init:master.

Commit message:
tools: migrate script needs to write tools/.lp-to-git-user

Also fix commit message lint


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

For more details, see:
https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/375273
-- 
Your team cloud-init Commiters is requested to review the proposed merge of 
~chad.smith/cloud-init:tools/migrate-script-v2 into cloud-init:master.
diff --git a/tools/migrate-lp-user-to-github b/tools/migrate-lp-user-to-github
index 6b095a1..f012d31 100755
--- a/tools/migrate-lp-user-to-github
+++ b/tools/migrate-lp-user-to-github
@@ -56,7 +56,7 @@ GITHUB_REMOTE_PATH_TMPL = 'g...@github.com:{github_user}/cloud-init.git'
 
 
 # Comment templates
-COMMIT_MSG_TMPL = '''
+COMMIT_MSG_TMPL = '''\
 lp-to-git-users: adding {gh_username}
 
 Mapped from {lp_username}
@@ -146,7 +146,7 @@ def create_migration_branch(
 MIGRATE_BRANCH_NAME))
 create_publish_branch(upstream, MIGRATE_BRANCH_NAME)
 lp_to_git_map = {}
-lp_to_git_file = os.path.join(os.getcwd(), LP_TO_GIT_USER_FILE)
+lp_to_git_file = os.path.join(os.getcwd(), 'tools', LP_TO_GIT_USER_FILE)
 if os.path.exists(lp_to_git_file):
 with open(lp_to_git_file) as stream:
 lp_to_git_map = util.load_json(stream.read())
___
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] ~chad.smith/cloud-init:migrate-lp-to-github into cloud-init:master

2019-11-06 Thread Chad Smith
Chad Smith has proposed merging ~chad.smith/cloud-init:migrate-lp-to-github 
into cloud-init:master.

Commit message:

lp-to-git-users: adding blackboxsw

Mapped from chad.smith


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

For more details, see:
https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/375249
-- 
Your team cloud-init Commiters is requested to review the proposed merge of 
~chad.smith/cloud-init:migrate-lp-to-github into cloud-init:master.
diff --git a/.lp-to-git-user b/.lp-to-git-user
new file mode 100644
index 000..214bf5c
--- /dev/null
+++ b/.lp-to-git-user
@@ -0,0 +1,3 @@
+{
+ "chad.smith": "blackboxsw"
+}
\ No newline at end of file
___
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] ~powersj/cloud-init:migrate-lp-to-github into cloud-init:master

2019-11-06 Thread Chad Smith
The proposal to merge ~powersj/cloud-init:migrate-lp-to-github into 
cloud-init:master has been updated.

Commit message changed to:

lp-to-git-users: adding powersj

Mapped from powersj

For more details, see:
https://code.launchpad.net/~powersj/cloud-init/+git/cloud-init/+merge/375227
-- 
Your team cloud-init Commiters is requested to review the proposed merge of 
~powersj/cloud-init:migrate-lp-to-github 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] ~chad.smith/cloud-init:migrate-lp-to-github into cloud-init:master

2019-11-06 Thread Chad Smith
Chad Smith has proposed merging ~chad.smith/cloud-init:migrate-lp-to-github 
into cloud-init:master.

Commit message:

lp-to-git-users: adding blackboxsw

Mapped from chad.smith


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

For more details, see:
https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/375239
-- 
Your team cloud-init Commiters is requested to review the proposed merge of 
~chad.smith/cloud-init:migrate-lp-to-github into cloud-init:master.
diff --git a/.lp-to-git-user b/.lp-to-git-user
new file mode 100644
index 000..214bf5c
--- /dev/null
+++ b/.lp-to-git-user
@@ -0,0 +1,3 @@
+{
+ "chad.smith": "blackboxsw"
+}
\ No newline at end of file
___
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] ~chad.smith/cloud-init:github/readme into cloud-init:master

2019-11-05 Thread Chad Smith
Chad Smith has proposed merging ~chad.smith/cloud-init:github/readme into 
cloud-init:master.

Commit message:
github: new basic project readme

See rendered content at 
https://github.com/blackboxsw/cloud-init/tree/github/readme

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

For more details, see:
https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/375194
-- 
Your team cloud-init Commiters is requested to review the proposed merge of 
~chad.smith/cloud-init:github/readme into cloud-init:master.
diff --git a/README.md b/README.md
new file mode 100644
index 000..04045e8
--- /dev/null
+++ b/README.md
@@ -0,0 +1,76 @@
+# Cloud-init official mirror synced from https://launchpad.net/cloud-init
+
+[![Build Status](https://travis-ci.org/cloud-init/cloud-init.svg?branch=master)](https://travis-ci.org/cloud-init/cloud-init) [![Read the Docs](https://readthedocs.org/projects/cloudinit/badge/?version=latest=flat)](https://cloudinit.readthedocs.org)
+
+Cloud-init is the *industry standard* multi-distribution method for
+cross-platform cloud instance initialization. It is supported across all
+major public cloud providers, provisioning systems for private cloud
+infrastructure, and bare-metal installations.
+
+Cloud instances are initialized from a disk image and instance data:
+
+- Cloud metadata
+- User data (optional)
+- Vendor data (optional)
+
+Cloud-init will identify the cloud it is running on during boot, read any
+provided metadata from the cloud and initialize the system accordingly. This
+may involve setting up the network and storage devices to configuring SSH
+access key and many other aspects of a system. Later on the cloud-init will
+also parse and any optional user or vendor data that was passed to the
+instance.
+
+## Getting involved
+All contributions welcome! [Join us easily following our hacking guide](https://cloudinit.readthedocs.io/en/latest/topics/hacking.html)
+
+## Getting help
+
+Having trouble? We would like to help!
+
+- Ask a question in the [``#cloud-init`` IRC channel on Freenode](https://webchat.freenode.net/?channel=#cloud-init)
+- Join and ask questions on the [cloud-init mailing list ](https://launchpad.net/~cloud-init)
+- Find a bug? [Report bugs on Launchpad](https://bugs.launchpad.net/cloud-init/+filebug)
+
+## Recent cloud-init upstream releases
+Upstream release version | Release date |
+---   | ---  |
+19.4 | planned (2019-12-XX) |
+[19.3](https://launchpad.net/cloud-init/+milestone/19.3)  | 2019-11-05 |
+[19.2](https://launchpad.net/cloud-init/+milestone/19.2)  | 2019-07-17 |
+[19.1](https://launchpad.net/cloud-init/+milestone/19.1)  | 2019-05-10 |
+
+
+## Cloud-init distribution support
+Each linux distribution tracks cloud-init upstream updates at a different pace.
+
+The table below represents current and planned releases of cloud-init by each distribution.
+
+OS  | Cloud-init version|  Update schedule
+--- | ---   | ---
+CentOS 8| 18.5.1 | 
+CentOS 7| 18.5.3 | 
+Debian stable| 18.3-6 | 
+Debian testing| 19.2-4 | 
+Debian unstable| 19.2-4 | 
+FreeBSD | [19.2](https://www.freshports.org/net/cloud-init/) | 
+Fedora 31| 17.1.11 | 
+Fedora 29| 17.1.7 | 
+openSUSE Tumbleweed | 19.2 |
+openSUSE Leap 15.1 | 19.1 |
+Oracle Linux 7 | 18.5.3 |
+Oracle Linux 6 | 0.7.5.6 |
+Ubuntu 20.04 (Focal)| 19.3-0 | Weekly
+Ubuntu 19.10 (Eoan)| [19.2-36-g059d049c-0ubuntu3](https://github.com/cloud-init/cloud-init/tree/ubuntu/19.2-36-g059d049c-0ubuntu3) | Quarterly
+Ubuntu 18.04 (Bionic)| [19.2-36-g059d049c-0ubuntu2~18.04.1](https://github.com/cloud-init/cloud-init/tree/ubuntu/19.2-36-g059d049c-0ubuntu2~18.04.1) | QuarterlyUbuntu 16.04 (Xenial)| [19.2-36-g059d049c- 0ubuntu2~16.04.1](https://github.com/cloud-init/cloud-init/tree/ubuntu/19.2-36-g059d049c-0ubuntu2~16.04.1) | Quarterly
+Ubuntu 14.04 (Trusty)|[0.7.5-0ubuntu1.23](https://github.com/cloud-init/cloud-init/tree/ubuntu/0.7.5-0ubuntu1.23) | None
+Ubuntu 12.04 (Precise)| [0.6.3-0ubuntu1.25](https://github.com/cloud-init/cloud-init/tree/ubuntu/0.6.3-0ubuntu1.25) | None
+
+## Alternative cloud-init package updates
+We host daily [Ubuntu Daily PPAs](https://code.launchpad.net/~cloud-init-dev/+recipes) that build package for each Ubuntu series from tip of cloud-init
+
+For CentOS 7/8 we publish to a couple of COPR build repos:
+
+ * [**cloud-init-dev**: daily builds from cloud-init tip](https://copr.fedorainfracloud.org/coprs/g/cloud-init/cloud-init-dev/)
+ * [**el-testing**: gets updates only for upstream releases or any version that is published as a Stable Release Update to stable Ubuntu series](https://copr.fedorainfracloud.org/coprs/g/cloud-init/el-testing/)
+ * [**el-stable**: Provide newer/stable updates than those available in EPEL repos](https://copr.fedorainfracloud.org/coprs/g/cloud-init/el-stable/)
+
___
Mailing list: https

[Cloud-init-dev] [Merge] ~chad.smith/cloud-init:upstream/19.3 into cloud-init:master

2019-11-05 Thread Chad Smith
Chad Smith has proposed merging ~chad.smith/cloud-init:upstream/19.3 into 
cloud-init:master.

Commit message:
Release 19.3

Bump the version in cloudinit/version.py to be 19.3 and update ChangeLog.

LP: #1851428


Requested reviews:
  cloud-init Commiters (cloud-init-dev)
Related bugs:
  Bug #1851428 in cloud-init: "Release 19.3"
  https://bugs.launchpad.net/cloud-init/+bug/1851428

For more details, see:
https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/375178
-- 
Your team cloud-init Commiters is requested to review the proposed merge of 
~chad.smith/cloud-init:upstream/19.3 into cloud-init:master.
diff --git a/ChangeLog b/ChangeLog
index a98f8c2..2b8edb4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,102 @@
+19.3
+ - azure: support matching dhcp route-metrics for dual-stack ipv4 ipv6
+   (LP: #1850308)
+ - configdrive: fix subplatform config-drive for /config-drive source
+   [David Kindred] (LP: #1849731)
+ - DataSourceSmartOS: reconfigure network on each boot
+   [Mike Gerdts] (LP: #1765801)
+ - Add config for ssh-key import and consuming user-data [Pavel Zakharov]
+ - net: fix subnet_is_ipv6() for stateless|stateful
+   [Harald Jensås] (LP: #1848690)
+ - OVF: disable custom script execution by default [Xiaofeng Wang]
+ - cc_puppet: Implement csr_attributes.yaml support [Matthias Baur]
+ - cloud-init.service: on centos/fedora/redhat wait on NetworkManager.service
+   (LP: #1843334)
+ - azure: Do not lock user on instance id change [Sam Eiderman] (LP: #1849677)
+ - net/netplan: use ipv6-mtu key for specifying ipv6 mtu values
+ - Fix usages of yaml, and move yaml_dump to safeyaml.dumps. (LP: #1849640)
+ - exoscale: Increase url_max_wait to 120s. [Chris Glass]
+ - net/sysconfig: fix available check on SUSE distros
+   [Robert Schweikert] (LP: #1849378)
+ - docs: Fix incorrect Azure IMDS IP address [Joshua Powers] (LP: #1849508)
+ - introduce .travis.yml
+ - net: enable infiniband support in eni and sysconfig renderers
+   [Darren Birkett] (LP: #1847114)
+ - guestcust_util: handle special characters in config file [Xiaofeng Wang]
+ - fix some more typos in comments [Dominic Schlegel]
+ - replace any deprecated log.warn with log.warning
+   [Dominic Schlegel] (LP: #1508442)
+ - net: handle openstack dhcpv6-stateless configuration
+   [Harald Jensås] (LP: #1847517)
+ - Add .venv/ to .gitignore [Dominic Schlegel]
+ - Small typo fixes in code comments. [Dominic Schlegel]
+ - cloud_test/lxd: Retry container delete a few times
+ - Add Support for e24cloud to Ec2 datasource. (LP: #1696476)
+ - Add RbxCloud datasource [Adam Dobrawy]
+ - get_interfaces: don't exclude bridge and bond members (LP: #1846535)
+ - Add support for Arch Linux in render-cloudcfg [Conrad Hoffmann]
+ - util: json.dumps on python 2.7 will handle UnicodeDecodeError on binary
+   (LP: #1801364)
+ - debian/ubuntu: add missing word to netplan/ENI header (LP: #1845669)
+ - ovf: do not generate random instance-id for IMC customization path
+ - sysconfig: only write resolv.conf if network_state has DNS values
+   (LP: #1843634)
+ - sysconfig: use distro variant to check if available (LP: #1843584)
+ - systemd/cloud-init.service.tmpl: start after wicked.service
+   [Robert Schweikert]
+ - docs: fix zstack documentation lints
+ - analyze/show: remove trailing space in output
+ - Add missing space in warning: "not avalid seed" [Brian Candler]
+ - pylintrc: add 'enter_context' to generated-members list
+ - Add datasource for ZStack platform. [Shixin Ruan] (LP: #1841181)
+ - docs: organize TOC and update summary of project [Joshua Powers]
+ - tools: make clean now cleans the dev directory, not the system
+ - docs: create cli specific page [Joshua Powers]
+ - docs: added output examples to analyze.rst [Joshua Powers]
+ - docs: doc8 fixes for instancedata page [Joshua Powers]
+ - docs: clean up formatting, organize boot page [Joshua Powers]
+ - net: add is_master check for filtering device list (LP: #1844191)
+ - docs: more complete list of availability [Joshua Powers]
+ - docs: start FAQ page [Joshua Powers]
+ - docs: cleanup output & order of datasource page [Joshua Powers]
+ - Brightbox: restrict detection to require full domain match .brightbox.com
+ - VMWware: add option into VMTools config to enable/disable custom script.
+   [Xiaofeng Wang]
+ - net,Oracle: Add support for netfailover detection
+ - atomic_helper: add DEBUG logging to write_file (LP: #1843276)
+ - doc: document doc, create makefile and tox target [Joshua Powers]
+ - .gitignore: ignore files produced by package builds
+ - docs: fix whitespace, spelling, and line length [Joshua Powers]
+ - docs: remove unnecessary file in doc directory [Joshua Powers]
+ - Oracle: Render secondary vnic IP and MTU values only
+ - exoscale: fix sysconfig cloud_config_modules overrides (LP: #1841454)
+ - net/cmdline: refactor to allow multiple initramfs network config sources
+ - ubuntu-drivers: call db_x_loadtemplatefile to accept NVIDIA EULA
+   (LP: #

[Cloud-init-dev] [Merge] ~chad.smith/cloud-init:tools/migrate-script into cloud-init:master

2019-11-05 Thread Chad Smith
Chad Smith has proposed merging ~chad.smith/cloud-init:tools/migrate-script 
into cloud-init:master.

Commit message:
tools: add migrate-lp-user-to-github script to link LP to github

To link a launchpad account name to your github account for licensing
accountability each LP user should publish a merge proposal in launchpad
with their LP account and a matching merge proposal in github using
their github user.

Cloud-init will track these usename maps in ./tools/.lp-to-git-user as
JSON.

Run ./tools/migrate-lp-user-to-github  
to automatically create merge proposals in launchpad and your github
account.

Requested reviews:
  Server Team CI bot (server-team-bot): continuous-integration
  cloud-init Commiters (cloud-init-dev)

For more details, see:
https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/375163
-- 
Your team cloud-init Commiters is requested to review the proposed merge of 
~chad.smith/cloud-init:tools/migrate-script into cloud-init:master.
diff --git a/tools/.lp-to-git-user b/tools/.lp-to-git-user
new file mode 100644
index 000..0967ef4
--- /dev/null
+++ b/tools/.lp-to-git-user
@@ -0,0 +1 @@
+{}
diff --git a/tools/migrate-lp-user-to-github b/tools/migrate-lp-user-to-github
new file mode 100755
index 000..4fa36b6
--- /dev/null
+++ b/tools/migrate-lp-user-to-github
@@ -0,0 +1,201 @@
+#!/usr/bin/python3
+"""Link your Launchpad user to github, proposing branches to LP and Github"""
+
+from argparse import ArgumentParser
+from launchpadlib.launchpad import Launchpad
+from subprocess import Popen, PIPE
+import os
+import sys
+
+if "avoid-pep8-E402-import-not-top-of-file":
+_tdir = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
+sys.path.insert(0, _tdir)
+from cloudinit import util
+
+
+VERBOSITY = 0
+DRYRUN = False
+LP_TO_GIT_USER_FILE=os.path.abspath(
+os.path.join(os.path.dirname(__file__), '.lp-to-git-user'))
+MIGRATE_USER_BRANCH_NAME='migrate-lp-to-github'
+GITHUB_PULL_URL='https://github.com/cloud-init/cloud-init/compare/master...{github_user}:{branch}'
+
+def error(message):
+if isinstance(message, bytes):
+message = message.decode('utf-8')
+log('ERROR: {error}'.format(error=message))
+sys.exit(1)
+
+
+def log(message, verbosity=0):
+'''Print a message to logs when VERBOSITY >= verbosity.'''
+if VERBOSITY >= verbosity:
+print(message)
+
+
+def subp(cmd, skip=False):
+log('$ {command}'.format(command=' '.join(cmd)),
+verbosity=0 if (DRYRUN or skip) else 1)
+if skip:
+return
+proc = Popen(cmd, stdout=PIPE, stderr=PIPE)
+out, err = proc.communicate()
+if proc.returncode:
+error(err if err else out)
+return out.decode('utf-8')
+
+
+RE_MERGE_URL_TMPL = (r'https://code.launchpad.net/~(?P[^/]+)/'
+ r'{project}/\+git/{project}/\+merge/\d+')
+LP_REMOTE_PATH_TMPL = 'git+ssh://{launchpad_user}@git.launchpad.net/~{launchpad_user}/{project}'
+GITHUB_REMOTE_PATH_TMPL = 'g...@github.com:{github_user}/cloud-init.git'
+
+
+# Comment templates
+COMMIT_MSG_TMPL = '''
+lp-to-git-users: adding {gh_username}
+
+Mapped from {lp_username}
+'''
+
+
+def get_parser():
+parser = ArgumentParser(description=__doc__)
+parser.add_argument(
+'--dryrun', required=False, default=False, action='store_true',
+help=('Run commands and review operation in dryrun mode, '
+  'making not changes.'))
+parser.add_argument('launchpad_user', help='Your launchpad username.')
+parser.add_argument('github_user', help='Your github username.')
+parser.add_argument(
+'--upstream-branch', required=False, dest='upstream',
+default='origin/master',
+help=('The name of remote branch target into which we will merge.'
+  ' Default: origin/master'))
+parser.add_argument(
+'-v', '--verbose', required=False, default=False, action='store_true',
+help=('Print all actions.'))
+parser.add_argument(
+'--push-remote', required=False, dest='pushremote',
+help=('QA-only provide remote name into which you want to push'))
+return parser
+
+
+def create_publish_branch(upstream, publish_branch):
+'''Create clean publish branch target in the current git repo.'''
+branches = subp(['git', 'branch'])
+upstream_remote, upstream_branch = upstream.split('/', 1)
+subp(['git', 'checkout', upstream_branch])
+subp(['git', 'pull'])
+if publish_branch in branches:
+subp(['git', 'branch', '-D', publish_branch])
+subp(['git', 'checkout', upstream, '-b', publish_branch])
+
+
+def add_lp_and_github_remotes(lp_user, gh_user):
+"""Add lp and github remotes if not present.
+
+@return Tuple with (lp_remote_name, gh_remote_name)
+"""
+lp_remote = LP_REMOTE_PATH_TMPL.format(
+launchpad_user=lp_user, project='cloud-init')
+gh_remote = GITHUB_

[Cloud-init-dev] [Merge] ~chad.smith/cloud-init:migrate-lp-to-github into cloud-init:master

2019-11-05 Thread Chad Smith
Chad Smith has proposed merging ~chad.smith/cloud-init:migrate-lp-to-github 
into cloud-init:master.

Commit message:

lp-to-git-users: adding blackboxsw

Mapped from chad.smith


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

For more details, see:
https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/375162
-- 
Your team cloud-init Commiters is requested to review the proposed merge of 
~chad.smith/cloud-init:migrate-lp-to-github into cloud-init:master.
diff --git a/tools/.lp-to-git-user b/tools/.lp-to-git-user
new file mode 100644
index 000..214bf5c
--- /dev/null
+++ b/tools/.lp-to-git-user
@@ -0,0 +1,3 @@
+{
+ "chad.smith": "blackboxsw"
+}
\ No newline at end of file
___
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] ~david-kindred/cloud-init:configdrive-fix-for-subplatform into cloud-init:master

2019-11-04 Thread Chad Smith
Thanks David,

I've updated the commit message at the top of this PR to meet our commit 
message format linting.
If the commit message above works for you it will be what's used to squash 
merge this changeset.


Much thanks again. (I'm just waiting on our CI to automatically vote on this 
and we'll land it today)

-- 
https://code.launchpad.net/~david-kindred/cloud-init/+git/cloud-init/+merge/375113
Your team cloud-init Commiters is requested to review the proposed merge of 
~david-kindred/cloud-init:configdrive-fix-for-subplatform 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] ~david-kindred/cloud-init:configdrive-fix-for-subplatform into cloud-init:master

2019-11-04 Thread Chad Smith
The proposal to merge ~david-kindred/cloud-init:configdrive-fix-for-subplatform 
into cloud-init:master has been updated.

Commit message changed to:

configdrive: fix subplatform config-drive for /config-drive source


When ConfigDrive discovers the source path /config-drive, subplatform
is now reports 'config-drive'

LP: #1849731

For more details, see:
https://code.launchpad.net/~david-kindred/cloud-init/+git/cloud-init/+merge/375113
-- 
Your team cloud-init Commiters is requested to review the proposed merge of 
~david-kindred/cloud-init:configdrive-fix-for-subplatform 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] ~chad.smith/cloud-init:bug/azure-dhcp6-metric into cloud-init:master

2019-10-31 Thread Chad Smith
Chad Smith has proposed merging ~chad.smith/cloud-init:bug/azure-dhcp6-metric 
into cloud-init:master.

Commit message:
azure: support matching dhcp route-metrics for dual-stack ipv4 ipv6

When an Azure vm has multiple nics set to dhcp, use increasing
route-metric values for each nic to ensure the default route chosen is
the primary nic (eth0). For netplan configuration, if providing
dhcp4-overrides: route-metric, the same route-metric value also needs to
be provided as a dhcp6-override.  Otherwise the network config is
rejected wholesale and a the system is left without network.

When reading Azure IMDS, cloud-init will enable dhcp4 or dhcp6 for the
first ip allocated to the primary NIC with a dhcp[46]-overrrides
route-metric of 100. For every additional NIC attached to the vm, the
route-metric override is increased by 100.

When configuring IP addresses on each NIC:
  - The primary IP for a NIC will be configured via dhcp (or dhcp6 if
allocated the the vm).
  - Any additional ipv4 or ipv6 addresses configured
will be setup as secondary static IP addresses on the NIC.

LP: #1850308


Requested reviews:
  cloud-init Commiters (cloud-init-dev)
Related bugs:
  Bug #1850308 in cloud-init: "cloud-init on azure with dual stack needs to add 
route-metric for dhcp6 also"
  https://bugs.launchpad.net/cloud-init/+bug/1850308

For more details, see:
https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/374994
-- 
Your team cloud-init Commiters is requested to review the proposed merge of 
~chad.smith/cloud-init:bug/azure-dhcp6-metric into cloud-init:master.
diff --git a/cloudinit/sources/DataSourceAzure.py b/cloudinit/sources/DataSourceAzure.py
index cdf49d3..434d8f2 100755
--- a/cloudinit/sources/DataSourceAzure.py
+++ b/cloudinit/sources/DataSourceAzure.py
@@ -1322,7 +1322,7 @@ def parse_network_config(imds_metadata):
 network_metadata = imds_metadata['network']
 for idx, intf in enumerate(network_metadata['interface']):
 nicname = 'eth{idx}'.format(idx=idx)
-dev_config = {}
+dev_config = {'addresses': []}
 for addr4 in intf['ipv4']['ipAddress']:
 privateIpv4 = addr4['privateIpAddress']
 if privateIpv4:
@@ -1330,8 +1330,6 @@ def parse_network_config(imds_metadata):
 # Append static address config for ip > 1
 netPrefix = intf['ipv4']['subnet'][0].get(
 'prefix', '24')
-if not dev_config.get('addresses'):
-dev_config['addresses'] = []
 dev_config['addresses'].append(
 '{ip}/{prefix}'.format(
 ip=privateIpv4, prefix=netPrefix))
@@ -1345,8 +1343,22 @@ def parse_network_config(imds_metadata):
 for addr6 in intf['ipv6']['ipAddress']:
 privateIpv6 = addr6['privateIpAddress']
 if privateIpv6:
-dev_config['dhcp6'] = True
-break
+if dev_config.get('dhcp6', False):
+# Append static address config for ip > 1
+netPrefix = intf['ipv6']['subnet'][0].get(
+'prefix', '64')
+dev_config['addresses'].append(
+'{ip}/{prefix}'.format(
+ip=privateIpv6, prefix=netPrefix))
+else:
+# non-primary interfaces should have a higher
+# route-metric (cost) so default routes prefer
+# primary nic due to lower route-metric value
+dev_config['dhcp6-overrides'] = {
+'route-metric': (idx + 1) * 100}
+dev_config['dhcp6'] = True
+if dev_config['addresses'] == []:  # drop addresses if empty
+   dev_config.pop('addresses')
 if dev_config:
 mac = ':'.join(re.findall(r'..', intf['macAddress']))
 dev_config.update(
diff --git a/tests/unittests/test_datasource/test_azure.py b/tests/unittests/test_datasource/test_azure.py
index 80c6f01..f8ecd95 100644
--- a/tests/unittests/test_datasource/test_azure.py
+++ b/tests/unittests/test_datasource/test_azure.py
@@ -132,9 +132,7 @@ NETWORK_METADATA = {
 
 SECONDARY_INTERFACE = {
 "macAddress": "220D3A047598",
-"ipv6": {
-"ipAddress": []
-},
+"ipv6": {"ipAddress": []},
 "ipv4": {
 "subnet": [
 {
@@ -153,6 +151,93 @@ SECONDARY_INTERFACE = {
 MOCKPATH = 'cloudinit.sources

Re: [Cloud-init-dev] [Merge] ~daniel-thewatkins/cloud-init/+git/cloud-init:travis into cloud-init:master

2019-10-21 Thread Chad Smith



Diff comments:

> diff --git a/.travis.yml b/.travis.yml
> new file mode 100644
> index 000..834a568
> --- /dev/null
> +++ b/.travis.yml
> @@ -0,0 +1,55 @@
> +language: python
> +dist: bionic
> +
> +install:
> +# Required so `git describe` will definitely find a tag; see
> +# https://github.com/travis-ci/travis-ci/issues/7422
> +- git fetch --unshallow
> +- pip install tox
> +
> +script:
> +- tox
> +
> +matrix:
> +fast_finish: true
> +include:
> +- python: 3.6
> +  env: TOXENV=py3
> +- install:
> +- git fetch --unshallow
> +- sudo apt-get build-dep -y cloud-init
> +- sudo apt-get install -y --install-recommends sbuild 
> ubuntu-dev-tools fakeroot tox
> +# These are build deps but not pulled in by the build-dep call 
> above
> +- sudo apt-get install -y --install-recommends dh-systemd 
> python3-coverage python3-contextlib2
> +- pip install .
> +- pip install tox
> +# bionic has lxd from deb installed, remove it first to ensure
> +# pylxd talks only to the lxd from snap
> +- sudo apt remove --purge lxd lxd-client
> +- sudo rm -Rf /var/lib/lxd
> +- sudo snap install lxd
> +- sudo lxd init --auto
> +- sudo mkdir --mode=1777 -p /var/snap/lxd/common/consoles

Can we add a comment about why  we need this mkdir?

> +- sudo usermod -a -G lxd $USER
> +- sudo sbuild-adduser $USER
> +- cp /usr/share/doc/sbuild/examples/example.sbuildrc 
> /home/$USER/.sbuildrc
> +  script:
> +# Ubuntu LTS: Build
> +- ./packages/bddeb -S
> +# Use this to get a new shell where we're in the sbuild group
> +- sudo -E su $USER -c 'mk-sbuild xenial'
> +- sudo -E su $USER -c 'sbuild --nolog --verbose --dist=xenial 
> cloud-init_*.dsc'
> +# Ubuntu LTS: Integration
> +- sg lxd -c 'tox -e citest -- run --verbose --preserve-data 
> --data-dir results --os-name xenial --test 
> modules/apt_configure_sources_list.yaml --test modules/ntp_servers --test 
> modules/set_password_list --test modules/user_groups --deb 
> cloud-init_*_all.deb'
> +- python: 2.7
> +  env: TOXENV=py27
> +- python: 3.4
> +  env: TOXENV=xenial
> +  # Travis doesn't support Python 3.4 on bionic, so use xenial
> +  dist: xenial
> +- python: 3.6
> +  env: TOXENV=pycodestyle
> +- python: 3.6
> +  env: TOXENV=pyflakes
> +- python: 3.6
> +  env: TOXENV=pylint


-- 
https://code.launchpad.net/~daniel-thewatkins/cloud-init/+git/cloud-init/+merge/374462
Your team cloud-init Commiters is requested to review the proposed merge of 
~daniel-thewatkins/cloud-init/+git/cloud-init:travis 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] ~chad.smith/cloud-init:bug/180134-openstack-random-seed-encoding into cloud-init:master

2019-09-27 Thread Chad Smith
The proposal to merge 
~chad.smith/cloud-init:bug/180134-openstack-random-seed-encoding into 
cloud-init:master has been updated.

Status: Needs review => Approved

For more details, see:
https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/373291
-- 
Your team cloud-init Commiters is requested to review the proposed merge of 
~chad.smith/cloud-init:bug/180134-openstack-random-seed-encoding 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] ~chad.smith/cloud-init:bug/180134-openstack-random-seed-encoding into cloud-init:master

2019-09-26 Thread Chad Smith
Chad Smith has proposed merging 
~chad.smith/cloud-init:bug/180134-openstack-random-seed-encoding into 
cloud-init:master.

Commit message:
util: json.dumps on python 2.7 will handle unicodedecodeerror on binary

Since python 2.7 doesn't handle UnicodeDecodeErrors with the default
handler

LP: #1801364


Requested reviews:
  Server Team CI bot (server-team-bot): continuous-integration
  cloud-init Commiters (cloud-init-dev)
Related bugs:
  Bug #1801364 in cloud-init: "persisting OpenStack metadata fails"
  https://bugs.launchpad.net/cloud-init/+bug/1801364

For more details, see:
https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/373291
-- 
Your team cloud-init Commiters is requested to review the proposed merge of 
~chad.smith/cloud-init:bug/180134-openstack-random-seed-encoding into 
cloud-init:master.
diff --git a/cloudinit/sources/tests/test_init.py b/cloudinit/sources/tests/test_init.py
index 6378e98..d93210a 100644
--- a/cloudinit/sources/tests/test_init.py
+++ b/cloudinit/sources/tests/test_init.py
@@ -456,21 +456,6 @@ class TestDataSource(CiTestCase):
 {'key1': 'val1', 'key2': {'key2.1': '\x123'}},
 instance_json['ds']['meta_data'])
 
-@skipIf(not six.PY2, "Only python2 hits UnicodeDecodeErrors on non-utf8")
-def test_non_utf8_encoding_logs_warning(self):
-"""When non-utf-8 values exist in py2 instance-data is not written."""
-tmp = self.tmp_dir()
-datasource = DataSourceTestSubclassNet(
-self.sys_cfg, self.distro, Paths({'run_dir': tmp}),
-custom_metadata={'key1': 'val1', 'key2': {'key2.1': b'ab\xaadef'}})
-self.assertTrue(datasource.get_data())
-json_file = self.tmp_path(INSTANCE_JSON_FILE, tmp)
-self.assertFalse(os.path.exists(json_file))
-self.assertIn(
-"WARNING: Error persisting instance-data.json: 'utf8' codec can't"
-" decode byte 0xaa in position 2: invalid start byte",
-self.logs.getvalue())
-
 def test_get_hostname_subclass_support(self):
 """Validate get_hostname signature on all subclasses of DataSource."""
 # Use inspect.getfullargspec when we drop py2.6 and py2.7
diff --git a/cloudinit/tests/test_util.py b/cloudinit/tests/test_util.py
index e3d2dba..7302f4a 100644
--- a/cloudinit/tests/test_util.py
+++ b/cloudinit/tests/test_util.py
@@ -2,7 +2,9 @@
 
 """Tests for cloudinit.util"""
 
+import base64
 import logging
+import json
 import platform
 
 import cloudinit.util as util
@@ -528,6 +530,25 @@ class TestGetLinuxDistro(CiTestCase):
 self.assertEqual(('foo', '1.1', 'aarch64'), dist)
 
 
+class TestJsonDumps(CiTestCase):
+def test_is_str(self):
+"""json_dumps should return a string."""
+self.assertTrue(isinstance(util.json_dumps({'abc': '123'}), str))
+
+def test_utf8(self):
+smiley = '\\ud83d\\ude03'
+self.assertEqual(
+{'smiley': smiley},
+json.loads(util.json_dumps({'smiley': smiley})))
+
+def test_non_utf8(self):
+blob = b'\xba\x03Qx-#y\xea'
+self.assertEqual(
+{'blob': 'ci-b64:' + base64.b64encode(blob).decode('utf-8')},
+json.loads(util.json_dumps({'blob': blob})))
+
+
+
 @mock.patch('os.path.exists')
 class TestIsLXD(CiTestCase):
 
diff --git a/cloudinit/util.py b/cloudinit/util.py
index aa23b3f..49433dc 100644
--- a/cloudinit/util.py
+++ b/cloudinit/util.py
@@ -1599,10 +1599,36 @@ def json_serialize_default(_obj):
 return 'Warning: redacted unserializable type {0}'.format(type(_obj))
 
 
+def json_preserialize_binary(data):
+"""Preserialize any discovered binary values to avoid json.dumps issues.
+
+Used only on python 2.7 where default type handling is not honored for
+failure to encode binary data. LP: #1801364.
+TODO(Drop this function when py2.7 support is dropped from cloud-init)
+"""
+data = obj_copy.deepcopy(data)
+for key, value in data.items():
+if isinstance(value, (dict)):
+data[key] = json_preserialize_binary(value)
+if isinstance(value, bytes):
+data[key] = 'ci-b64:{0}'.format(b64e(value))
+return data
+
+
 def json_dumps(data):
 """Return data in nicely formatted json."""
-return json.dumps(data, indent=1, sort_keys=True,
-  separators=(',', ': '), default=json_serialize_default)
+try:
+return json.dumps(
+data, indent=1, sort_keys=True, separators=(',', ': '),
+default=json_serialize_default)
+except UnicodeDecodeError as e:
+from cloudinit.sources import process_instance_metadata
+if sys.version_info[:2] == (2, 7):
+data = json_preserialize_binary(data)
+

[Cloud-init-dev] [Merge] ~chad.smith/cloud-init:cleanup/zstack-docs into cloud-init:master

2019-09-26 Thread Chad Smith
Chad Smith has proposed merging ~chad.smith/cloud-init:cleanup/zstack-docs into 
cloud-init:master.

Commit message:
docs: fix zstack documentation lints

Resolve the following lints raised by 'make doc':
- doc/rtd/topics/datasources/zstack.rst:5: D001 Line too long
- doc/rtd/topics/datasources/zstack.rst:10: D001 Line too long


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

For more details, see:
https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/373241
-- 
Your team cloud-init Commiters is requested to review the proposed merge of 
~chad.smith/cloud-init:cleanup/zstack-docs into cloud-init:master.
diff --git a/doc/rtd/topics/datasources/zstack.rst b/doc/rtd/topics/datasources/zstack.rst
index 36e60ff..93a2791 100644
--- a/doc/rtd/topics/datasources/zstack.rst
+++ b/doc/rtd/topics/datasources/zstack.rst
@@ -2,14 +2,15 @@
 
 ZStack
 ==
-ZStack platform provides a AWS Ec2 metadata service, but with different datasource identity.
+ZStack platform provides a AWS Ec2 metadata service, but with different
+datasource identity.
 More information about ZStack can be found at `ZStack <https://www.zstack.io>`__.
 
 Discovery
 -
-To determine whether a vm running on ZStack platform, cloud-init checks DMI information
-by 'dmidecode -s chassis-asset-tag', if the output ends with '.zstack.io', it's running
-on ZStack platform:
+To determine whether a vm running on ZStack platform, cloud-init checks DMI
+information by 'dmidecode -s chassis-asset-tag', if the output ends with
+'.zstack.io', it's running on ZStack platform:
 
 
 Metadata
___
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] ~chad.smith/cloud-init:cleanup/make-clean-cleans-docs into cloud-init:master

2019-09-18 Thread Chad Smith
Chad Smith has proposed merging 
~chad.smith/cloud-init:cleanup/make-clean-cleans-docs into cloud-init:master.

Commit message:
tools: make clean now cleans the dev directory, not the system

Remove pyc files, .tox directories and docs during make clean.

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

For more details, see:
https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/372932
-- 
Your team cloud-init Commiters is requested to review the proposed merge of 
~chad.smith/cloud-init:cleanup/make-clean-cleans-docs into cloud-init:master.
diff --git a/Makefile b/Makefile
index 2c6d0c8..315e6b4 100644
--- a/Makefile
+++ b/Makefile
@@ -80,9 +80,10 @@ config/cloud.cfg:
 
 clean_pyc:
 	@find . -type f -name "*.pyc" -delete
+	@find . -type d -name __pycache__ -delete
 
 clean: clean_pyc
-	rm -rf /var/log/cloud-init.log /var/lib/cloud/
+	rm -rf doc/rtd_html .tox .coverage
 
 yaml:
 	@$(PYVER) $(CWD)/tools/validate-yaml.py $(YAML_FILES)
___
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] ~powersj/cloud-init:docs/instancedata into cloud-init:master

2019-09-18 Thread Chad Smith
Thanks Josh! +1
-- 
https://code.launchpad.net/~powersj/cloud-init/+git/cloud-init/+merge/372645
Your team cloud-init Commiters is requested to review the proposed merge of 
~powersj/cloud-init:docs/instancedata 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] ~chad.smith/cloud-init:ubuntu/disco into cloud-init:ubuntu/disco

2019-09-17 Thread Chad Smith
Chad Smith has proposed merging ~chad.smith/cloud-init:ubuntu/disco into 
cloud-init:ubuntu/disco.

Commit message:
New upstream snapshot for disco

Requested reviews:
  cloud-init Commiters (cloud-init-dev)
Related bugs:
  Bug #1844191 in cloud-init: "azure advanced networking sometimes triggers 
duplicate mac detection"
  https://bugs.launchpad.net/cloud-init/+bug/1844191

For more details, see:
https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/372894
-- 
Your team cloud-init Commiters is requested to review the proposed merge of 
~chad.smith/cloud-init:ubuntu/disco into cloud-init:ubuntu/disco.
diff --git a/.gitignore b/.gitignore
index 80c509e..b9b98e7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,3 +12,14 @@ stage
 *.snap
 *.cover
 .idea/
+
+# Ignore packaging artifacts
+cloud-init.dsc
+cloud-init_*.build
+cloud-init_*.buildinfo
+cloud-init_*.changes
+cloud-init_*.deb
+cloud-init_*.dsc
+cloud-init_*.orig.tar.gz
+cloud-init_*.tar.xz
+cloud-init_*.upload
diff --git a/Makefile b/Makefile
index 4ace227..2c6d0c8 100644
--- a/Makefile
+++ b/Makefile
@@ -106,7 +106,9 @@ deb-src:
 		  echo sudo apt-get install devscripts; exit 1; }
 	$(PYVER) ./packages/bddeb -S -d
 
+doc:
+	tox -e doc
 
 .PHONY: test pyflakes pyflakes3 clean pep8 rpm srpm deb deb-src yaml
 .PHONY: check_version pip-test-requirements pip-requirements clean_pyc
-.PHONY: unittest unittest3 style-check
+.PHONY: unittest unittest3 style-check doc
diff --git a/cloudinit/atomic_helper.py b/cloudinit/atomic_helper.py
index 587b994..1f61faa 100644
--- a/cloudinit/atomic_helper.py
+++ b/cloudinit/atomic_helper.py
@@ -1,11 +1,13 @@
 # This file is part of cloud-init. See LICENSE file for license information.
 
 import json
+import logging
 import os
 import stat
 import tempfile
 
 _DEF_PERMS = 0o644
+LOG = logging.getLogger(__name__)
 
 
 def write_file(filename, content, mode=_DEF_PERMS,
@@ -23,6 +25,10 @@ def write_file(filename, content, mode=_DEF_PERMS,
 try:
 tf = tempfile.NamedTemporaryFile(dir=os.path.dirname(filename),
  delete=False, mode=omode)
+LOG.debug(
+"Atomically writing to file %s (via temporary file %s) - %s: [%o]"
+" %d bytes/chars",
+filename, tf.name, omode, mode, len(content))
 tf.write(content)
 tf.close()
 os.chmod(tf.name, mode)
diff --git a/cloudinit/net/__init__.py b/cloudinit/net/__init__.py
index ea707c0..5de5c6d 100644
--- a/cloudinit/net/__init__.py
+++ b/cloudinit/net/__init__.py
@@ -109,6 +109,127 @@ def is_bond(devname):
 return os.path.exists(sys_dev_path(devname, "bonding"))
 
 
+def has_master(devname):
+return os.path.exists(sys_dev_path(devname, path="master"))
+
+
+def is_netfailover(devname, driver=None):
+""" netfailover driver uses 3 nics, master, primary and standby.
+this returns True if the device is either the primary or standby
+as these devices are to be ignored.
+"""
+if driver is None:
+driver = device_driver(devname)
+if is_netfail_primary(devname, driver) or is_netfail_standby(devname,
+ driver):
+return True
+return False
+
+
+def get_dev_features(devname):
+""" Returns a str from reading /sys/class/net//device/features."""
+features = ''
+try:
+features = read_sys_net(devname, 'device/features')
+except Exception:
+pass
+return features
+
+
+def has_netfail_standby_feature(devname):
+""" Return True if VIRTIO_NET_F_STANDBY bit (62) is set.
+
+https://github.com/torvalds/linux/blob/ \
+089cf7f6ecb266b6a4164919a2e69bd2f938374a/ \
+include/uapi/linux/virtio_net.h#L60
+"""
+features = get_dev_features(devname)
+if not features or len(features) < 64:
+return False
+return features[62] == "1"
+
+
+def is_netfail_master(devname, driver=None):
+""" A device is a "netfail master" device if:
+
+- The device does NOT have the 'master' sysfs attribute
+- The device driver is 'virtio_net'
+- The device has the standby feature bit set
+
+Return True if all of the above is True.
+"""
+if has_master(devname):
+return False
+
+if driver is None:
+driver = device_driver(devname)
+
+if driver != "virtio_net":
+return False
+
+if not has_netfail_standby_feature(devname):
+return False
+
+return True
+
+
+def is_netfail_primary(devname, driver=None):
+""" A device is a "netfail primary" device if:
+
+- the device has a 'master' sysfs file
+- the device driver is not 'virtio_net'
+- the 'master' sysfs file points to device with v

[Cloud-init-dev] [Merge] ~chad.smith/cloud-init:ubuntu/bionic into cloud-init:ubuntu/bionic

2019-09-17 Thread Chad Smith
Chad Smith has proposed merging ~chad.smith/cloud-init:ubuntu/bionic into 
cloud-init:ubuntu/bionic.

Commit message:
New upstream snapshot for release into Bionic

Requested reviews:
  cloud-init Commiters (cloud-init-dev)
Related bugs:
  Bug #1844191 in cloud-init: "azure advanced networking sometimes triggers 
duplicate mac detection"
  https://bugs.launchpad.net/cloud-init/+bug/1844191

For more details, see:
https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/372893
-- 
Your team cloud-init Commiters is requested to review the proposed merge of 
~chad.smith/cloud-init:ubuntu/bionic into cloud-init:ubuntu/bionic.
diff --git a/.gitignore b/.gitignore
index 80c509e..b9b98e7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,3 +12,14 @@ stage
 *.snap
 *.cover
 .idea/
+
+# Ignore packaging artifacts
+cloud-init.dsc
+cloud-init_*.build
+cloud-init_*.buildinfo
+cloud-init_*.changes
+cloud-init_*.deb
+cloud-init_*.dsc
+cloud-init_*.orig.tar.gz
+cloud-init_*.tar.xz
+cloud-init_*.upload
diff --git a/Makefile b/Makefile
index 4ace227..2c6d0c8 100644
--- a/Makefile
+++ b/Makefile
@@ -106,7 +106,9 @@ deb-src:
 		  echo sudo apt-get install devscripts; exit 1; }
 	$(PYVER) ./packages/bddeb -S -d
 
+doc:
+	tox -e doc
 
 .PHONY: test pyflakes pyflakes3 clean pep8 rpm srpm deb deb-src yaml
 .PHONY: check_version pip-test-requirements pip-requirements clean_pyc
-.PHONY: unittest unittest3 style-check
+.PHONY: unittest unittest3 style-check doc
diff --git a/cloudinit/atomic_helper.py b/cloudinit/atomic_helper.py
index 587b994..1f61faa 100644
--- a/cloudinit/atomic_helper.py
+++ b/cloudinit/atomic_helper.py
@@ -1,11 +1,13 @@
 # This file is part of cloud-init. See LICENSE file for license information.
 
 import json
+import logging
 import os
 import stat
 import tempfile
 
 _DEF_PERMS = 0o644
+LOG = logging.getLogger(__name__)
 
 
 def write_file(filename, content, mode=_DEF_PERMS,
@@ -23,6 +25,10 @@ def write_file(filename, content, mode=_DEF_PERMS,
 try:
 tf = tempfile.NamedTemporaryFile(dir=os.path.dirname(filename),
  delete=False, mode=omode)
+LOG.debug(
+"Atomically writing to file %s (via temporary file %s) - %s: [%o]"
+" %d bytes/chars",
+filename, tf.name, omode, mode, len(content))
 tf.write(content)
 tf.close()
 os.chmod(tf.name, mode)
diff --git a/cloudinit/net/__init__.py b/cloudinit/net/__init__.py
index ea707c0..5de5c6d 100644
--- a/cloudinit/net/__init__.py
+++ b/cloudinit/net/__init__.py
@@ -109,6 +109,127 @@ def is_bond(devname):
 return os.path.exists(sys_dev_path(devname, "bonding"))
 
 
+def has_master(devname):
+return os.path.exists(sys_dev_path(devname, path="master"))
+
+
+def is_netfailover(devname, driver=None):
+""" netfailover driver uses 3 nics, master, primary and standby.
+this returns True if the device is either the primary or standby
+as these devices are to be ignored.
+"""
+if driver is None:
+driver = device_driver(devname)
+if is_netfail_primary(devname, driver) or is_netfail_standby(devname,
+ driver):
+return True
+return False
+
+
+def get_dev_features(devname):
+""" Returns a str from reading /sys/class/net//device/features."""
+features = ''
+try:
+features = read_sys_net(devname, 'device/features')
+except Exception:
+pass
+return features
+
+
+def has_netfail_standby_feature(devname):
+""" Return True if VIRTIO_NET_F_STANDBY bit (62) is set.
+
+https://github.com/torvalds/linux/blob/ \
+089cf7f6ecb266b6a4164919a2e69bd2f938374a/ \
+include/uapi/linux/virtio_net.h#L60
+"""
+features = get_dev_features(devname)
+if not features or len(features) < 64:
+return False
+return features[62] == "1"
+
+
+def is_netfail_master(devname, driver=None):
+""" A device is a "netfail master" device if:
+
+- The device does NOT have the 'master' sysfs attribute
+- The device driver is 'virtio_net'
+- The device has the standby feature bit set
+
+Return True if all of the above is True.
+"""
+if has_master(devname):
+return False
+
+if driver is None:
+driver = device_driver(devname)
+
+if driver != "virtio_net":
+return False
+
+if not has_netfail_standby_feature(devname):
+return False
+
+return True
+
+
+def is_netfail_primary(devname, driver=None):
+""" A device is a "netfail primary" device if:
+
+- the device has a 'master' sysfs file
+- the device driver is not 'virtio_net'
+- the 'master' sysfs file 

[Cloud-init-dev] [Merge] ~chad.smith/cloud-init:ubuntu/xenial into cloud-init:ubuntu/xenial

2019-09-17 Thread Chad Smith
Chad Smith has proposed merging ~chad.smith/cloud-init:ubuntu/xenial into 
cloud-init:ubuntu/xenial.

Commit message:
new-upstream snapshot for SRU into Xenial

Requested reviews:
  cloud-init Commiters (cloud-init-dev)
Related bugs:
  Bug #1844191 in cloud-init: "azure advanced networking sometimes triggers 
duplicate mac detection"
  https://bugs.launchpad.net/cloud-init/+bug/1844191

For more details, see:
https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/372891
-- 
Your team cloud-init Commiters is requested to review the proposed merge of 
~chad.smith/cloud-init:ubuntu/xenial into cloud-init:ubuntu/xenial.
diff --git a/.gitignore b/.gitignore
index 80c509e..b9b98e7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,3 +12,14 @@ stage
 *.snap
 *.cover
 .idea/
+
+# Ignore packaging artifacts
+cloud-init.dsc
+cloud-init_*.build
+cloud-init_*.buildinfo
+cloud-init_*.changes
+cloud-init_*.deb
+cloud-init_*.dsc
+cloud-init_*.orig.tar.gz
+cloud-init_*.tar.xz
+cloud-init_*.upload
diff --git a/Makefile b/Makefile
index 4ace227..2c6d0c8 100644
--- a/Makefile
+++ b/Makefile
@@ -106,7 +106,9 @@ deb-src:
 		  echo sudo apt-get install devscripts; exit 1; }
 	$(PYVER) ./packages/bddeb -S -d
 
+doc:
+	tox -e doc
 
 .PHONY: test pyflakes pyflakes3 clean pep8 rpm srpm deb deb-src yaml
 .PHONY: check_version pip-test-requirements pip-requirements clean_pyc
-.PHONY: unittest unittest3 style-check
+.PHONY: unittest unittest3 style-check doc
diff --git a/cloudinit/atomic_helper.py b/cloudinit/atomic_helper.py
index 587b994..1f61faa 100644
--- a/cloudinit/atomic_helper.py
+++ b/cloudinit/atomic_helper.py
@@ -1,11 +1,13 @@
 # This file is part of cloud-init. See LICENSE file for license information.
 
 import json
+import logging
 import os
 import stat
 import tempfile
 
 _DEF_PERMS = 0o644
+LOG = logging.getLogger(__name__)
 
 
 def write_file(filename, content, mode=_DEF_PERMS,
@@ -23,6 +25,10 @@ def write_file(filename, content, mode=_DEF_PERMS,
 try:
 tf = tempfile.NamedTemporaryFile(dir=os.path.dirname(filename),
  delete=False, mode=omode)
+LOG.debug(
+"Atomically writing to file %s (via temporary file %s) - %s: [%o]"
+" %d bytes/chars",
+filename, tf.name, omode, mode, len(content))
 tf.write(content)
 tf.close()
 os.chmod(tf.name, mode)
diff --git a/cloudinit/net/__init__.py b/cloudinit/net/__init__.py
index ea707c0..5de5c6d 100644
--- a/cloudinit/net/__init__.py
+++ b/cloudinit/net/__init__.py
@@ -109,6 +109,127 @@ def is_bond(devname):
 return os.path.exists(sys_dev_path(devname, "bonding"))
 
 
+def has_master(devname):
+return os.path.exists(sys_dev_path(devname, path="master"))
+
+
+def is_netfailover(devname, driver=None):
+""" netfailover driver uses 3 nics, master, primary and standby.
+this returns True if the device is either the primary or standby
+as these devices are to be ignored.
+"""
+if driver is None:
+driver = device_driver(devname)
+if is_netfail_primary(devname, driver) or is_netfail_standby(devname,
+ driver):
+return True
+return False
+
+
+def get_dev_features(devname):
+""" Returns a str from reading /sys/class/net//device/features."""
+features = ''
+try:
+features = read_sys_net(devname, 'device/features')
+except Exception:
+pass
+return features
+
+
+def has_netfail_standby_feature(devname):
+""" Return True if VIRTIO_NET_F_STANDBY bit (62) is set.
+
+https://github.com/torvalds/linux/blob/ \
+089cf7f6ecb266b6a4164919a2e69bd2f938374a/ \
+include/uapi/linux/virtio_net.h#L60
+"""
+features = get_dev_features(devname)
+if not features or len(features) < 64:
+return False
+return features[62] == "1"
+
+
+def is_netfail_master(devname, driver=None):
+""" A device is a "netfail master" device if:
+
+- The device does NOT have the 'master' sysfs attribute
+- The device driver is 'virtio_net'
+- The device has the standby feature bit set
+
+Return True if all of the above is True.
+"""
+if has_master(devname):
+return False
+
+if driver is None:
+driver = device_driver(devname)
+
+if driver != "virtio_net":
+return False
+
+if not has_netfail_standby_feature(devname):
+return False
+
+return True
+
+
+def is_netfail_primary(devname, driver=None):
+""" A device is a "netfail primary" device if:
+
+- the device has a 'master' sysfs file
+- the device driver is not 'virtio_net'
+- the 'master' sysfs file 

[Cloud-init-dev] [Merge] ~chad.smith/cloud-init:stable-18.4 into cloud-init:stable-18.4

2019-09-09 Thread Chad Smith
The proposal to merge ~chad.smith/cloud-init:stable-18.4 into 
cloud-init:stable-18.4 has been updated.

Status: Needs review => Approved

For more details, see:
https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/372432
-- 
Your team cloud-init Commiters is requested to review the proposed merge of 
~chad.smith/cloud-init:stable-18.4 into cloud-init:stable-18.4.

___
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] ~chad.smith/cloud-init:stable-18.4 into cloud-init:stable-18.4

2019-09-06 Thread Chad Smith
Chad Smith has proposed merging ~chad.smith/cloud-init:stable-18.4 into 
cloud-init:stable-18.4.

Commit message:
Add brief README.md describing the branch intent for those that attempt to use 
this branch.

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

For more details, see:
https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/372432
-- 
Your team cloud-init Commiters is requested to review the proposed merge of 
~chad.smith/cloud-init:stable-18.4 into cloud-init:stable-18.4.
diff --git a/README.md b/README.md
new file mode 100644
index 000..c14df30
--- /dev/null
+++ b/README.md
@@ -0,0 +1,9 @@
+# cloud-init stable-18.4: last python 2.6 support
+
+This branch (stable-18.4) is an unmaintained branch cut from upstream git tag 18.4.
+
+The intent of this stable branch:
+* It is the last revision on cloud-init that fully supports python 2.6.
+* No ongoing upstream maintenance or feature work is planned for stable-18.4
+* stable-18.4 will continue to be hosted for community-driven python 2.6 support
+* For ongoing upstream cloud-init feature development, propose branches against '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] ~daniel-thewatkins/cloud-init/+git/cloud-init:networking into cloud-init:master

2019-09-04 Thread Chad Smith



Diff comments:

> diff --git a/cloudinit/net/__init__.py b/cloudinit/net/__init__.py
> index ea707c0..f308d03 100644
> --- a/cloudinit/net/__init__.py
> +++ b/cloudinit/net/__init__.py
> @@ -756,7 +756,11 @@ class EphemeralIPv4Network(object):
>  ' to %s', self.connectivity_url)
>  return
>  
> -self._bringup_device()
> +device_brought_up = self._bringup_device()
> +if not device_brought_up:

Probably don't need the local var defined as you explain it in the comment:

if not self._bringup_device():
   # If we didn't bring the device up, no need to do anything else
   # with it
   return

> +# If we didn't bring the device up, no need to do anything else
> +# with it
> +return
>  
>  # rfc3442 requires us to ignore the router config *if* classless 
> static
>  # routes are provided.


-- 
https://code.launchpad.net/~daniel-thewatkins/cloud-init/+git/cloud-init/+merge/372289
Your team cloud-init commiters is requested to review the proposed merge of 
~daniel-thewatkins/cloud-init/+git/cloud-init:networking 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] ~chad.smith/cloud-init:feature/openstack-network-v2-multi-nic into cloud-init:master

2019-08-29 Thread Chad Smith
Chad Smith has proposed merging 
~chad.smith/cloud-init:feature/openstack-network-v2-multi-nic into 
cloud-init:master.

Commit message:
Work in progress for initial review:

openstack: return network v2 from parsed network_data.json


TODO: sort promotion of global dns

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

For more details, see:
https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/372009
-- 
Your team cloud-init commiters is requested to review the proposed merge of 
~chad.smith/cloud-init:feature/openstack-network-v2-multi-nic into 
cloud-init:master.
diff --git a/cloudinit/cmd/devel/net_convert.py b/cloudinit/cmd/devel/net_convert.py
index 1ad7e0b..7b4ae3f 100755
--- a/cloudinit/cmd/devel/net_convert.py
+++ b/cloudinit/cmd/devel/net_convert.py
@@ -81,12 +81,8 @@ def handle_args(name, args):
 pre_ns = yaml.load(net_data)
 if 'network' in pre_ns:
 pre_ns = pre_ns.get('network')
-if args.debug:
-sys.stderr.write('\n'.join(
-["Input YAML",
- yaml.dump(pre_ns, default_flow_style=False, indent=4), ""]))
 elif args.kind == 'network_data.json':
-pre_ns = openstack.convert_net_json(
+pre_ns = openstack.convert_net_json_v2(
 json.loads(net_data), known_macs=known_macs)
 elif args.kind == 'azure-imds':
 pre_ns = azure.parse_network_config(json.loads(net_data))
@@ -94,6 +90,10 @@ def handle_args(name, args):
 config = ovf.Config(ovf.ConfigFile(args.network_data.name))
 pre_ns = ovf.get_network_config_from_conf(config, False)
 
+if args.debug:
+sys.stderr.write('\n'.join(
+["Input YAML",
+ yaml.dump(pre_ns, default_flow_style=False, indent=4), ""]))
 ns = network_state.parse_net_config_data(pre_ns)
 if not ns:
 raise RuntimeError("No valid network_state object created from"
diff --git a/cloudinit/net/network_state.py b/cloudinit/net/network_state.py
index c0c415d..a7454f7 100644
--- a/cloudinit/net/network_state.py
+++ b/cloudinit/net/network_state.py
@@ -4,6 +4,7 @@
 #
 # This file is part of cloud-init. See LICENSE file for license information.
 
+from collections import defaultdict
 import copy
 import functools
 import logging
@@ -159,6 +160,10 @@ class NetworkState(object):
 return self._version
 
 @property
+def _global_dns_counts(self):
+return self._network_state['global_dns_counts']
+
+@property
 def dns_nameservers(self):
 try:
 return self._network_state['dns']['nameservers']
@@ -234,6 +239,10 @@ class NetworkStateInterpreter(object):
 self._network_state = copy.deepcopy(self.initial_network_state)
 self._network_state['config'] = config
 self._parsed = False
+# Reference counters to promote to global
+self._global_dns_refs = {
+'nameserver': defaultdict(list), 'search': defaultdict(list)}
+self._network_state['global_dns_refs'] = self._global_dns_refs
 
 @property
 def network_state(self):
@@ -318,7 +327,7 @@ class NetworkStateInterpreter(object):
" command '%s'" % command_type)
 try:
 handler(self, command)
-self._v2_common(command)
+self._maybe_promote_v2_common(command)
 except InvalidCommand:
 if not skip_broken:
 raise
@@ -326,6 +335,41 @@ class NetworkStateInterpreter(object):
 LOG.warning("Skipping invalid command: %s", command,
 exc_info=True)
 LOG.debug(self.dump_network_state())
+# Post-process v2 dns promotions if needed
+# count interfaces with ip, compare unpromoted global dns
+self._cleanup_v2_common_from_interfaces()
+
+def _cleanup_v2_common_from_interfaces(self):
+"""Strip any promoted global dns/search from specific interfaces."""
+interfaces = self._network_state.get('interfaces')
+global_dns = set(self._network_state['dns'].get('nameservers', []))
+global_search = set(self._network_state['dns'].get('search', []))
+dns_refs = self._global_dns_refs['nameserver']
+search_refs = self._global_dns_refs['search']
+promoted_dns = global_dns.intersection(dns_refs)
+promoted_search = global_dns.intersection(search_refs)
+for intf_name, intf_cfg in interfaces.items():
+for subnet in intf_cfg['subnets']:
+promote_dns = bool(not promoted_dns and len(interfaces) == 1)
+subnet_dns = subnet.get('dns_nameservers', [])
+if promote_dns and (subnet_dns or subnet.get('dns_search')):
+name_cmd = {'type': 'nameserver',
+  

[Cloud-init-dev] [Merge] ~chad.smith/cloud-init:feature/openstack-network-v2-multi-nic into cloud-init:master

2019-08-29 Thread Chad Smith
The proposal to merge 
~chad.smith/cloud-init:feature/openstack-network-v2-multi-nic into 
cloud-init:master has been updated.

Status: Needs review => Work in progress

For more details, see:
https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/372009
-- 
Your team cloud-init commiters is requested to review the proposed merge of 
~chad.smith/cloud-init:feature/openstack-network-v2-multi-nic 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] ~chad.smith/cloud-init:ubuntu/xenial into cloud-init:ubuntu/xenial

2019-08-28 Thread Chad Smith
Chad Smith has proposed merging ~chad.smith/cloud-init:ubuntu/xenial into 
cloud-init:ubuntu/xenial.

Commit message:
new-upstream-snapshot to include Exoscale fixes in current SRU

Requested reviews:
  Server Team CI bot (server-team-bot): continuous-integration
  cloud-init commiters (cloud-init-dev)
Related bugs:
  Bug #1841454 in cloud-init: "Exoscale datasource overwrites *all* 
cloud_config_modules"
  https://bugs.launchpad.net/cloud-init/+bug/1841454

For more details, see:
https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/371963
-- 
Your team cloud-init commiters is requested to review the proposed merge of 
~chad.smith/cloud-init:ubuntu/xenial into cloud-init:ubuntu/xenial.
diff --git a/cloudinit/net/cmdline.py b/cloudinit/net/cmdline.py
index 556a10f..55166ea 100755
--- a/cloudinit/net/cmdline.py
+++ b/cloudinit/net/cmdline.py
@@ -5,20 +5,95 @@
 #
 # This file is part of cloud-init. See LICENSE file for license information.
 
+import abc
 import base64
 import glob
 import gzip
 import io
 import os
 
-from . import get_devicelist
-from . import read_sys_net_safe
+import six
 
 from cloudinit import util
 
+from . import get_devicelist
+from . import read_sys_net_safe
+
 _OPEN_ISCSI_INTERFACE_FILE = "/run/initramfs/open-iscsi.interface"
 
 
+@six.add_metaclass(abc.ABCMeta)
+class InitramfsNetworkConfigSource(object):
+"""ABC for net config sources that read config written by initramfses"""
+
+@abc.abstractmethod
+def is_applicable(self):
+# type: () -> bool
+"""Is this initramfs config source applicable to the current system?"""
+pass
+
+@abc.abstractmethod
+def render_config(self):
+# type: () -> dict
+"""Render a v1 network config from the initramfs configuration"""
+pass
+
+
+class KlibcNetworkConfigSource(InitramfsNetworkConfigSource):
+"""InitramfsNetworkConfigSource for klibc initramfs (i.e. Debian/Ubuntu)
+
+Has three parameters, but they are intended to make testing simpler, _not_
+for use in production code.  (This is indicated by the prepended
+underscores.)
+"""
+
+def __init__(self, _files=None, _mac_addrs=None, _cmdline=None):
+self._files = _files
+self._mac_addrs = _mac_addrs
+self._cmdline = _cmdline
+
+# Set defaults here, as they require computation that we don't want to
+# do at method definition time
+if self._files is None:
+self._files = _get_klibc_net_cfg_files()
+if self._cmdline is None:
+self._cmdline = util.get_cmdline()
+if self._mac_addrs is None:
+self._mac_addrs = {}
+for k in get_devicelist():
+mac_addr = read_sys_net_safe(k, 'address')
+if mac_addr:
+self._mac_addrs[k] = mac_addr
+
+def is_applicable(self):
+# type: () -> bool
+"""
+Return whether this system has klibc initramfs network config or not
+
+Will return True if:
+(a) klibc files exist in /run, AND
+(b) either:
+(i) ip= or ip6= are on the kernel cmdline, OR
+(ii) an open-iscsi interface file is present in the system
+"""
+if self._files:
+if 'ip=' in self._cmdline or 'ip6=' in self._cmdline:
+return True
+if os.path.exists(_OPEN_ISCSI_INTERFACE_FILE):
+# iBft can configure networking without ip=
+return True
+return False
+
+def render_config(self):
+# type: () -> dict
+return config_from_klibc_net_cfg(
+files=self._files, mac_addrs=self._mac_addrs,
+)
+
+
+_INITRAMFS_CONFIG_SOURCES = [KlibcNetworkConfigSource]
+
+
 def _klibc_to_config_entry(content, mac_addrs=None):
 """Convert a klibc written shell content file to a 'config' entry
 When ip= is seen on the kernel command line in debian initramfs
@@ -137,6 +212,24 @@ def config_from_klibc_net_cfg(files=None, mac_addrs=None):
 return {'config': entries, 'version': 1}
 
 
+def read_initramfs_config():
+"""
+Return v1 network config for initramfs-configured networking (or None)
+
+This will consider each _INITRAMFS_CONFIG_SOURCES entry in turn, and return
+v1 network configuration for the first one that is applicable.  If none are
+applicable, return None.
+"""
+for src_cls in _INITRAMFS_CONFIG_SOURCES:
+cfg_source = src_cls()
+
+if not cfg_source.is_applicable():
+continue
+
+return cfg_source.render_config()
+return None
+
+
 def _decomp_gzip(blob, strict=True):
 # decompress blob. raise exception if not compressed unless strict=False.
   

[Cloud-init-dev] [Merge] ~chad.smith/cloud-init:ubuntu/disco into cloud-init:ubuntu/disco

2019-08-28 Thread Chad Smith
Chad Smith has proposed merging ~chad.smith/cloud-init:ubuntu/disco into 
cloud-init:ubuntu/disco.

Commit message:
new-upstream snapshot to get exoscale fixes before we complete current 
-proposed SRU

Requested reviews:
  cloud-init commiters (cloud-init-dev)
Related bugs:
  Bug #1841454 in cloud-init: "Exoscale datasource overwrites *all* 
cloud_config_modules"
  https://bugs.launchpad.net/cloud-init/+bug/1841454

For more details, see:
https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/371959
-- 
Your team cloud-init commiters is requested to review the proposed merge of 
~chad.smith/cloud-init:ubuntu/disco into cloud-init:ubuntu/disco.
diff --git a/cloudinit/net/cmdline.py b/cloudinit/net/cmdline.py
index 556a10f..55166ea 100755
--- a/cloudinit/net/cmdline.py
+++ b/cloudinit/net/cmdline.py
@@ -5,20 +5,95 @@
 #
 # This file is part of cloud-init. See LICENSE file for license information.
 
+import abc
 import base64
 import glob
 import gzip
 import io
 import os
 
-from . import get_devicelist
-from . import read_sys_net_safe
+import six
 
 from cloudinit import util
 
+from . import get_devicelist
+from . import read_sys_net_safe
+
 _OPEN_ISCSI_INTERFACE_FILE = "/run/initramfs/open-iscsi.interface"
 
 
+@six.add_metaclass(abc.ABCMeta)
+class InitramfsNetworkConfigSource(object):
+"""ABC for net config sources that read config written by initramfses"""
+
+@abc.abstractmethod
+def is_applicable(self):
+# type: () -> bool
+"""Is this initramfs config source applicable to the current system?"""
+pass
+
+@abc.abstractmethod
+def render_config(self):
+# type: () -> dict
+"""Render a v1 network config from the initramfs configuration"""
+pass
+
+
+class KlibcNetworkConfigSource(InitramfsNetworkConfigSource):
+"""InitramfsNetworkConfigSource for klibc initramfs (i.e. Debian/Ubuntu)
+
+Has three parameters, but they are intended to make testing simpler, _not_
+for use in production code.  (This is indicated by the prepended
+underscores.)
+"""
+
+def __init__(self, _files=None, _mac_addrs=None, _cmdline=None):
+self._files = _files
+self._mac_addrs = _mac_addrs
+self._cmdline = _cmdline
+
+# Set defaults here, as they require computation that we don't want to
+# do at method definition time
+if self._files is None:
+self._files = _get_klibc_net_cfg_files()
+if self._cmdline is None:
+self._cmdline = util.get_cmdline()
+if self._mac_addrs is None:
+self._mac_addrs = {}
+for k in get_devicelist():
+mac_addr = read_sys_net_safe(k, 'address')
+if mac_addr:
+self._mac_addrs[k] = mac_addr
+
+def is_applicable(self):
+# type: () -> bool
+"""
+Return whether this system has klibc initramfs network config or not
+
+Will return True if:
+(a) klibc files exist in /run, AND
+(b) either:
+(i) ip= or ip6= are on the kernel cmdline, OR
+(ii) an open-iscsi interface file is present in the system
+"""
+if self._files:
+if 'ip=' in self._cmdline or 'ip6=' in self._cmdline:
+return True
+if os.path.exists(_OPEN_ISCSI_INTERFACE_FILE):
+# iBft can configure networking without ip=
+return True
+return False
+
+def render_config(self):
+# type: () -> dict
+return config_from_klibc_net_cfg(
+files=self._files, mac_addrs=self._mac_addrs,
+)
+
+
+_INITRAMFS_CONFIG_SOURCES = [KlibcNetworkConfigSource]
+
+
 def _klibc_to_config_entry(content, mac_addrs=None):
 """Convert a klibc written shell content file to a 'config' entry
 When ip= is seen on the kernel command line in debian initramfs
@@ -137,6 +212,24 @@ def config_from_klibc_net_cfg(files=None, mac_addrs=None):
 return {'config': entries, 'version': 1}
 
 
+def read_initramfs_config():
+"""
+Return v1 network config for initramfs-configured networking (or None)
+
+This will consider each _INITRAMFS_CONFIG_SOURCES entry in turn, and return
+v1 network configuration for the first one that is applicable.  If none are
+applicable, return None.
+"""
+for src_cls in _INITRAMFS_CONFIG_SOURCES:
+cfg_source = src_cls()
+
+if not cfg_source.is_applicable():
+continue
+
+return cfg_source.render_config()
+return None
+
+
 def _decomp_gzip(blob, strict=True):
 # decompress blob. raise exception if not compressed unless strict=False.
 with io.BytesIO(blob) as iobuf:
@@ -167,36 +260,6 @@ 

Re: [Cloud-init-dev] [Merge] ~raharper/cloud-init:fix/debian-config-yaml-spaces into cloud-init:ubuntu/devel

2019-08-28 Thread Chad Smith



Diff comments:

> diff --git a/debian/cloud-init.config b/debian/cloud-init.config
> index 6e9c6f7..4c35e50 100644
> --- a/debian/cloud-init.config
> +++ b/debian/cloud-init.config
> @@ -32,13 +32,13 @@ hasEc2Md() {
>  get_yaml_list() {
>   # get_yaml_list(file, key, def): return a comma delimited list with the 
> value
>   # for the yaml array defined in 'key' from 'file'. if not found , 
> return 'def'
> - # only really supports 'key: [en1, en2 ]' format.
> + # only really supports 'key: [ en1, en2 ]' or 'key: [en1, en2]' formats.
>   local file="$1" key="$2" default="$3"
>   [ -f "$file" ] || return 1
>   # any thing that didn't match the key is deleted so the final 'p' only
>   # prints things that matched.
> - RET=$(sed -n -e "/^$key:/"'!'d -e "s/$key:[ \[]*//"\
> - -e "s, \]$,," -e p "$file")
> + RET=$(sed -n -e "/^$key:/"'!'d -e "s/$key:[[[:space:]]+\[]*//"\

We could simplify this sed to the following I think.  I'd like to avoid calling 
python3 from shell because of the potential dependency baggage from shell that 
Scott mentioned. I'd also like to avoid hoisting/duplicating the 37 lines out 
of ds-identify here too for this iteration.

Below is the sed that does the following operations:
  1. strips all whitespace 
  2. deletes all lines not unmatching ^key:
  3. strips leading ":[" and trailing "]" and replaces "," with ", "



diff --git a/debian/cloud-init.config b/debian/cloud-init.config
index 4c35e5053..7a8043f05 100644
--- a/debian/cloud-init.config
+++ b/debian/cloud-init.config
@@ -35,10 +35,10 @@ get_yaml_list() {
# only really supports 'key: [ en1, en2 ]' or 'key: [en1, en2]' formats.
local file="$1" key="$2" default="$3"
[ -f "$file" ] || return 1
-   # any thing that didn't match the key is deleted so the final 'p' only
-   # prints things that matched.
-   RET=$(sed -n -e "/^$key:/"'!'d -e "s/$key:[[[:space:]]+\[]*//"\
--e "s,[[:space:]]+\]$,," -e p "$file")
+# strip all whitespace, delete lines not matching key:,
+# strip key: and [] and replace ',' with ', '
+   RET=$(sed -e "s/\s//g" -e "/^$key:/"'!'d\
+-e "s/$key:\[//;s/]//;s/,/, /g" $file)
[ -n "$RET" ] || RET="$default"
 }

> +-e "s,[[:space:]]+\]$,," -e p "$file")
>   [ -n "$RET" ] || RET="$default"
>  }
>  


-- 
https://code.launchpad.net/~raharper/cloud-init/+git/cloud-init/+merge/371919
Your team cloud-init commiters is requested to review the proposed merge of 
~raharper/cloud-init:fix/debian-config-yaml-spaces into cloud-init:ubuntu/devel.

___
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] ~chad.smith/cloud-init:bug/1841454-exoscale-config-modules into cloud-init:master

2019-08-26 Thread Chad Smith
Chad Smith has proposed merging 
~chad.smith/cloud-init:bug/1841454-exoscale-config-modules into 
cloud-init:master.

Commit message:
exoscale: fix sysconfig cloud_config_modules overrides

Make sure Exoscale supplements or overrides existing system config
setting cloud_config_modules instead of replacing it with a one item
list set-passords

LP: #1841454


Requested reviews:
  cloud-init commiters (cloud-init-dev)
Related bugs:
  Bug #1841454 in cloud-init: "Exoscale datasource overwrites *all* 
cloud_config_modules"
  https://bugs.launchpad.net/cloud-init/+bug/1841454

For more details, see:
https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/371823
-- 
Your team cloud-init commiters is requested to review the proposed merge of 
~chad.smith/cloud-init:bug/1841454-exoscale-config-modules into 
cloud-init:master.
diff --git a/cloudinit/sources/DataSourceExoscale.py b/cloudinit/sources/DataSourceExoscale.py
index 52e7f6f..14be3fd 100644
--- a/cloudinit/sources/DataSourceExoscale.py
+++ b/cloudinit/sources/DataSourceExoscale.py
@@ -20,12 +20,10 @@ URL_RETRIES = 6
 
 EXOSCALE_DMI_NAME = "Exoscale"
 
-BUILTIN_DS_CONFIG = {
-# We run the set password config module on every boot in order to enable
-# resetting the instance's password via the exoscale console (and a
-# subsequent instance reboot).
-'cloud_config_modules': [["set-passwords", "always"]]
-}
+# We run the set password config module on every boot in order to enable
+# resetting the instance's password via the exoscale console (and a
+# subsequent instance reboot).
+BUILTIN_SYS_CONFIG_MODULE_OVERRIDES = [['set-passwords', 'always']]
 
 
 class DataSourceExoscale(sources.DataSource):
@@ -43,7 +41,20 @@ class DataSourceExoscale(sources.DataSource):
 self.url_timeout = self.ds_cfg.get('timeout', URL_TIMEOUT)
 self.url_retries = self.ds_cfg.get('retries', URL_RETRIES)
 
-self.extra_config = BUILTIN_DS_CONFIG
+# Override sysconfig cloud_config_modules frequency with builtin
+cloud_config_modules = []
+for config_module in sys_cfg.get('cloud_config_modules', []):
+for name, frequency in BUILTIN_SYS_CONFIG_MODULE_OVERRIDES:
+if config_module[0] == name:  # handle tuple/lists
+cloud_config_modules.append([name, frequency])
+elif config_module == name:   # handle str
+cloud_config_modules.append([name, frequency])
+else:
+cloud_config_modules.append(config_module)
+for override in BUILTIN_SYS_CONFIG_MODULE_OVERRIDES:
+if override not in cloud_config_modules:
+cloud_config_modules.append(override)
+self.extra_config = {'cloud_config_modules': cloud_config_modules}
 
 def wait_for_metadata_service(self):
 """Wait for the metadata service to be reachable."""
diff --git a/tests/unittests/test_datasource/test_exoscale.py b/tests/unittests/test_datasource/test_exoscale.py
index 350c330..9663845 100644
--- a/tests/unittests/test_datasource/test_exoscale.py
+++ b/tests/unittests/test_datasource/test_exoscale.py
@@ -63,6 +63,28 @@ class TestDatasourceExoscale(HttprettyTestCase):
 password = get_password()
 self.assertEqual(expected_password, password)
 
+def test_init_extends_existing_sys_config_cloud_config_modules(self):
+"""Extend any existing cloud_config_modules settings from SysConfig."""
+ds = DataSourceExoscale(
+{'cloud_config_modules': ['something']}, None, {})
+self.assertEqual(
+['something', ['set-passwords', 'always']],
+ds.get_config_obj()['cloud_config_modules'])
+
+def test_init_replaces_existing_sys_config_cloud_config_modules(self):
+"""Replace set-passwords when present in SysConfig settings."""
+ds = DataSourceExoscale(
+{'cloud_config_modules': ['set-passwords', 'something']}, None, {})
+self.assertEqual(
+[['set-passwords', 'always'], 'something'],
+ds.get_config_obj()['cloud_config_modules'])
+ds = DataSourceExoscale(
+{'cloud_config_modules': [
+ ['set-passwords', 'per-instance'], 'something']}, None, {})
+self.assertEqual(
+[['set-passwords', 'always'], 'something'],
+ds.get_config_obj()['cloud_config_modules'])
+
 def test_get_data(self):
 """The datasource conforms to expected behavior when supplied
 full test data."""
___
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] ~chad.smith/cloud-init:ubuntu/bionic into cloud-init:ubuntu/bionic

2019-08-22 Thread Chad Smith
The proposal to merge ~chad.smith/cloud-init:ubuntu/bionic into 
cloud-init:ubuntu/bionic has been updated.

Commit message changed to:

Upstream snapshot for SRU into bionic
Also enables Exoscale in debian/cloud-init.templates

For more details, see:
https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/371686
-- 
Your team cloud-init commiters is requested to review the proposed merge of 
~chad.smith/cloud-init:ubuntu/bionic into cloud-init:ubuntu/bionic.

___
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] ~chad.smith/cloud-init:ubuntu/xenial into cloud-init:ubuntu/xenial

2019-08-22 Thread Chad Smith
The proposal to merge ~chad.smith/cloud-init:ubuntu/xenial into 
cloud-init:ubuntu/xenial has been updated.

Commit message changed to:

Upstream snapshot for SRU into Xenial

also enables Exoscale in debian/cloud-init.templates

For more details, see:
https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/371685
-- 
Your team cloud-init commiters is requested to review the proposed merge of 
~chad.smith/cloud-init:ubuntu/xenial into cloud-init:ubuntu/xenial.

___
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] ~chad.smith/cloud-init:ubuntu/disco into cloud-init:ubuntu/disco

2019-08-22 Thread Chad Smith
The proposal to merge ~chad.smith/cloud-init:ubuntu/disco into 
cloud-init:ubuntu/disco has been updated.

Commit message changed to:

Upstream snapshot for SRU
Also enables Exoscale in debian/cloud-init.tempaltes.

For more details, see:
https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/371687
-- 
Your team cloud-init commiters is requested to review the proposed merge of 
~chad.smith/cloud-init:ubuntu/disco into cloud-init:ubuntu/disco.

___
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] ~chad.smith/cloud-init:bug/1840080-ubuntu-drivers-emit-latelink-v2 into cloud-init:master

2019-08-22 Thread Chad Smith
The proposal to merge 
~chad.smith/cloud-init:bug/1840080-ubuntu-drivers-emit-latelink-v2 into 
cloud-init:master has been updated.

Status: Needs review => Approved

For more details, see:
https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/371546
-- 
Your team cloud-init commiters is requested to review the proposed merge of 
~chad.smith/cloud-init:bug/1840080-ubuntu-drivers-emit-latelink-v2 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/1840080-ubuntu-drivers-emit-latelink-v2 into cloud-init:master

2019-08-21 Thread Chad Smith
Just validated on Eoan that this package properly sets up linux/nvidia/latelink 
true via debconf-get-selections.


The ubuntu-drivers-common package fixes has not yet published to Eoan. So, 
end-to-end validation will not be possible until an updated 
ubuntu-drivers-common and linux-modules-nvidia* is published.

As it is, this behavior paves the way for the 
ubuntu-drivers-common/linux-modules-nvidia package features.


# cloud-init properly registers and sets linux/nvidia/latelink : true
ubuntu@ip-172-31-30-68:~$ sudo debconf-get-selections  | egrep 'cloud-init|late'
cloud-init  linux/nvidia/latelink   boolean true
cloud-init  cloud-init/datasources  multiselect NoCloud, ConfigDrive, 
OpenNebula, DigitalOcean, Azure, AltCloud, OVF, MAAS, GCE, OpenStack, 
CloudSigma, SmartOS, Bigstep, Scaleway, AliYun, Ec2, CloudStack, Hetzner, 
IBMCloud, None

# ubuntu-drivers-common was installed, but no linux-modules-nvidia-* yet
dpkg -l | egrep 'cloud-init|nvidia|ubuntu-drivers'
ii  cloud-init 19.2-21-gcdd84698-1~bddeb   all  
Init scripts for cloud instances
ii  cloud-initramfs-copymods   0.44ubuntu1 all  
copy initramfs modules into root filesystem for later use
ii  cloud-initramfs-dyn-netconf0.44ubuntu1 all  
write a network interface file in /run for BOOTIF
ii  libnvidia-cfg1-430:amd64   430.40-0ubuntu2 amd64
NVIDIA binary OpenGL/GLX configuration library
ii  libnvidia-compute-430:amd64430.40-0ubuntu2 amd64
NVIDIA libcompute package
ii  nvidia-compute-utils-430   430.40-0ubuntu2 amd64
NVIDIA compute utilities
ii  nvidia-headless-no-dkms-430430.40-0ubuntu2 amd64
NVIDIA headless metapackage - no DKMS
ii  nvidia-kernel-source-430   430.40-0ubuntu2 amd64
NVIDIA kernel source package
ii  ubuntu-drivers-common  1:0.7.5 amd64
Detect and install additional Ubuntu driver packages


### If we manually install linux-modules-nvidia-430-generic, latelink appears 
set true
ubuntu@ip-172-31-16-66:~$ sudo debconf-get-selections | grep late
cloud-init  linux/nvidia/latelink   boolean true
linux-modules-nvidia-430-5.2.0-13-generic   linux/nvidia/latelink   
booleantrue

# from dpkg -l on eoan-proposed
ii  linux-modules-nvidia-430-5.2.0-13-generic 5.2.0-13.14 amd64 
   Linux kernel nvidia modules for version 5.2.0-13


-- 
https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/371546
Your team cloud-init commiters is requested to review the proposed merge of 
~chad.smith/cloud-init:bug/1840080-ubuntu-drivers-emit-latelink-v2 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/1840080-ubuntu-drivers-emit-latelink-v2 into cloud-init:master

2019-08-20 Thread Chad Smith



Diff comments:

> diff --git a/cloudinit/config/cc_ubuntu_drivers.py 
> b/cloudinit/config/cc_ubuntu_drivers.py
> index 4da34ee..44a2bfe 100644
> --- a/cloudinit/config/cc_ubuntu_drivers.py
> +++ b/cloudinit/config/cc_ubuntu_drivers.py
> @@ -65,6 +65,39 @@ OLD_UBUNTU_DRIVERS_STDERR_NEEDLE = (
>  __doc__ = get_schema_doc(schema)  # Supplement python help()
>  
>  
> +# debconf template to allow cloud-init pre-configure the global debconf
> +# variable linux/nvidia/latelink to true, allowing linux-restricted-modules
> +# to accept the NVIDIA EULA and automatically link drivers to the running
> +# kernel.
> +# EOL_XENIAL: can then drop this script and use python3-debconf which is only
> +# available in Bionic and later. Can't use python3-debconf currently as it
> +# isn't in Xenial and doesn't yet support X_LOADTEMPLATEFILE debconf command.
> +
> +NVIDIA_DRIVER_LATELINK_DEBCONF_TMPL = """\

done. Per your other comments, I've simplified the  
NVIDIA_DRIVER_LATELINK_DEBCONF_SCRIPT and we'll also write the separate 
NVIDIA_DEBCONF_CONTENT which can be passed to the script as $1

> +#/bin/sh
> +# Allow cloud-init to trigger EULA acceptance via registering a debconf
> +# template to set linux/nvidia/latelink true
> +
> +. /usr/share/debconf/confmodule
> +
> +SCRIPT=$(readlink -f "$0")
> +DIRNAME=$(dirname "$SCRIPT")
> +tmpfile=$(mktemp -p ${DIRNAME} -t 
> "cloud-init-ubuntu-drivers-XX.template")
> +cat > "$tmpfile" << EOF
> +Template: linux/nvidia/latelink
> +Type: boolean
> +Default: true
> +Description: Late-link NVIDIA kernel modules?
> + Enable this to link the NVIDIA kernel modules in cloud-init and
> + make them available for use.
> +EOF
> +echo BEFORE $tmpfile

Good suggestion, done.

> +db_x_loadtemplatefile "$tmpfile" cloud-init
> +echo AFTER $tmpfile
> +rm "$tmpfile"
> +"""
> +
> +
>  def install_drivers(cfg, pkg_install_func):
>  if not isinstance(cfg, dict):
>  raise TypeError(
> @@ -90,17 +123,22 @@ def install_drivers(cfg, pkg_install_func):
>  if version_cfg:
>  driver_arg += ':{}'.format(version_cfg)
>  
> -LOG.debug("Installing NVIDIA drivers (%s=%s, version=%s)",
> +LOG.debug("Installing and activating NVIDIA drivers (%s=%s, version=%s)",
>cfgpath, nv_acc, version_cfg if version_cfg else 'latest')
>  
> -# Setting NVIDIA latelink confirms acceptance of EULA for the package
> -# linux-restricted-modules
> -# Reference code defining debconf variable is here
> -# https://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/
> -# linux-restricted-modules/+git/eoan/tree/debian/templates/
> -# nvidia.templates.in
> -selections = b'linux-restricted-modules linux/nvidia/latelink boolean 
> true'
> -cc_apt_configure.debconf_set_selections(selections)
> +# Register and set debconf selection linux/nvidia/latelink = true
> +with temp_utils.ExtendedTemporaryFile(
> +suffix=".sh", needs_exe=True) as tmpf:
> +try:
> +tmpf.write(util.encode_text(NVIDIA_DRIVER_LATELINK_DEBCONF_TMPL))
> +tmpf.flush()
> +util.chmod(tmpf.name, 0o755)

Agreed. fixed.

> +util.subp([tmpf.name])
> +except Exception as e:
> +util.logexc(
> +LOG,
> +"Failed to register NVIDIA debconf template: %s", str(e))
> +raise
>  
>  try:
>  util.subp(['ubuntu-drivers', 'install', '--gpgpu', driver_arg])


-- 
https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/371546
Your team cloud-init commiters is requested to review the proposed merge of 
~chad.smith/cloud-init:bug/1840080-ubuntu-drivers-emit-latelink-v2 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] ~chad.smith/cloud-init:bug/1840080-ubuntu-drivers-emit-latelink-v2 into cloud-init:master

2019-08-20 Thread Chad Smith
Chad Smith has proposed merging 
~chad.smith/cloud-init:bug/1840080-ubuntu-drivers-emit-latelink-v2 into 
cloud-init:master.

Commit message:
ubuntu-drivers: call db_x_loadtemplatefile to accept NVIDIA EULA

Emit a script allowing cloud-init to set linux/nvidia/latelink
debconf selection to true. This avoids having to call
debconf-set-selections and allows cloud-init to pre-confgure
linux-restricted-modules to link NVIDIA drivers to the running kernel.

Cloud-init loads this debconf template and sets the value to true in the
debconf database by sourcing debconf's /usr/share/debconf/confmodule and
uses db_x_loadtemplatefile to register cloud-init's setting for
linux/nvidia/latelink.

LP: #1840080

Requested reviews:
  cloud-init commiters (cloud-init-dev)
Related bugs:
  Bug #1840080 in cloud-init (Ubuntu): "cloud-init cc_ubuntu_drivers does not 
set up /etc/default/linux-modules-nvidia"
  https://bugs.launchpad.net/ubuntu/+source/cloud-init/+bug/1840080

For more details, see:
https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/371546
-- 
Your team cloud-init commiters is requested to review the proposed merge of 
~chad.smith/cloud-init:bug/1840080-ubuntu-drivers-emit-latelink-v2 into 
cloud-init:master.
diff --git a/cloudinit/config/cc_ubuntu_drivers.py b/cloudinit/config/cc_ubuntu_drivers.py
index 4da34ee..44a2bfe 100644
--- a/cloudinit/config/cc_ubuntu_drivers.py
+++ b/cloudinit/config/cc_ubuntu_drivers.py
@@ -4,11 +4,11 @@
 
 from textwrap import dedent
 
-from cloudinit.config import cc_apt_configure
 from cloudinit.config.schema import (
 get_schema_doc, validate_cloudconfig_schema)
 from cloudinit import log as logging
 from cloudinit.settings import PER_INSTANCE
+from cloudinit import temp_utils
 from cloudinit import type_utils
 from cloudinit import util
 
@@ -65,6 +65,39 @@ OLD_UBUNTU_DRIVERS_STDERR_NEEDLE = (
 __doc__ = get_schema_doc(schema)  # Supplement python help()
 
 
+# debconf template to allow cloud-init pre-configure the global debconf
+# variable linux/nvidia/latelink to true, allowing linux-restricted-modules
+# to accept the NVIDIA EULA and automatically link drivers to the running
+# kernel.
+# EOL_XENIAL: can then drop this script and use python3-debconf which is only
+# available in Bionic and later. Can't use python3-debconf currently as it
+# isn't in Xenial and doesn't yet support X_LOADTEMPLATEFILE debconf command.
+
+NVIDIA_DRIVER_LATELINK_DEBCONF_TMPL = """\
+#/bin/sh
+# Allow cloud-init to trigger EULA acceptance via registering a debconf
+# template to set linux/nvidia/latelink true
+
+. /usr/share/debconf/confmodule
+
+SCRIPT=$(readlink -f "$0")
+DIRNAME=$(dirname "$SCRIPT")
+tmpfile=$(mktemp -p ${DIRNAME} -t "cloud-init-ubuntu-drivers-XX.template")
+cat > "$tmpfile" << EOF
+Template: linux/nvidia/latelink
+Type: boolean
+Default: true
+Description: Late-link NVIDIA kernel modules?
+ Enable this to link the NVIDIA kernel modules in cloud-init and
+ make them available for use.
+EOF
+echo BEFORE $tmpfile
+db_x_loadtemplatefile "$tmpfile" cloud-init
+echo AFTER $tmpfile
+rm "$tmpfile"
+"""
+
+
 def install_drivers(cfg, pkg_install_func):
 if not isinstance(cfg, dict):
 raise TypeError(
@@ -90,17 +123,22 @@ def install_drivers(cfg, pkg_install_func):
 if version_cfg:
 driver_arg += ':{}'.format(version_cfg)
 
-LOG.debug("Installing NVIDIA drivers (%s=%s, version=%s)",
+LOG.debug("Installing and activating NVIDIA drivers (%s=%s, version=%s)",
   cfgpath, nv_acc, version_cfg if version_cfg else 'latest')
 
-# Setting NVIDIA latelink confirms acceptance of EULA for the package
-# linux-restricted-modules
-# Reference code defining debconf variable is here
-# https://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/
-# linux-restricted-modules/+git/eoan/tree/debian/templates/
-# nvidia.templates.in
-selections = b'linux-restricted-modules linux/nvidia/latelink boolean true'
-cc_apt_configure.debconf_set_selections(selections)
+# Register and set debconf selection linux/nvidia/latelink = true
+with temp_utils.ExtendedTemporaryFile(
+suffix=".sh", needs_exe=True) as tmpf:
+try:
+tmpf.write(util.encode_text(NVIDIA_DRIVER_LATELINK_DEBCONF_TMPL))
+tmpf.flush()
+util.chmod(tmpf.name, 0o755)
+util.subp([tmpf.name])
+except Exception as e:
+util.logexc(
+LOG,
+"Failed to register NVIDIA debconf template: %s", str(e))
+raise
 
 try:
 util.subp(['ubuntu-drivers', 'install', '--gpgpu', driver_arg])
diff --git a/cloudinit/config/tests/test_ubuntu_drivers.py b/cloudinit/config/tests/test_ubuntu_drivers.py
index 6a763bd..ca44d63 100644
--- a/cloudinit/config/tests/test_ubuntu_drivers.py

[Cloud-init-dev] [Merge] ~rjschwei/cloud-init:triggerudev into cloud-init:master

2019-08-19 Thread Chad Smith
The proposal to merge ~rjschwei/cloud-init:triggerudev into cloud-init:master 
has been updated.

Status: Needs review => Rejected

For more details, see:
https://code.launchpad.net/~rjschwei/cloud-init/+git/cloud-init/+merge/363571
-- 
Your team cloud-init commiters is requested to review the proposed merge of 
~rjschwei/cloud-init:triggerudev 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] ~chad.smith/cloud-init:bug/1840080-ubuntu-drivers-emit-latelink into cloud-init:master

2019-08-15 Thread Chad Smith
Chad Smith has proposed merging 
~chad.smith/cloud-init:bug/1840080-ubuntu-drivers-emit-latelink into 
cloud-init:master.

Commit message:
ubuntu-drivers: emit latelink=true to /etc/default/ to accept nvidia eula

To accept NVIDIA EULA, cloud-init needs to emit latelink=true to the INI
file /etc/default/linux-modules-nvidia prior to installing nvidia drivers
with the ubuntu-drivers command. This will allow NVIDIA modules
prior to installing drivers enabled for linking to the running kernel.

LP: #1840080

Requested reviews:
  cloud-init commiters (cloud-init-dev)
Related bugs:
  Bug #1840080 in cloud-init (Ubuntu): "cloud-init cc_ubuntu_drivers does not 
set up /etc/default/linux-modules-nvidia"
  https://bugs.launchpad.net/ubuntu/+source/cloud-init/+bug/1840080

For more details, see:
https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/371369
-- 
Your team cloud-init commiters is requested to review the proposed merge of 
~chad.smith/cloud-init:bug/1840080-ubuntu-drivers-emit-latelink into 
cloud-init:master.
diff --git a/cloudinit/config/cc_ubuntu_drivers.py b/cloudinit/config/cc_ubuntu_drivers.py
index 91feb60..593b1b0 100644
--- a/cloudinit/config/cc_ubuntu_drivers.py
+++ b/cloudinit/config/cc_ubuntu_drivers.py
@@ -2,6 +2,7 @@
 
 """Ubuntu Drivers: Interact with third party drivers in Ubuntu."""
 
+import os
 from textwrap import dedent
 
 from cloudinit.config.schema import (
@@ -61,9 +62,48 @@ schema = {
 OLD_UBUNTU_DRIVERS_STDERR_NEEDLE = (
 "ubuntu-drivers: error: argument : invalid choice: 'install'")
 
+ETC_DEFAULT_FILE_NVIDIA='/etc/default/linux-modules-nvidia'
+
 __doc__ = get_schema_doc(schema)  # Supplement python help()
 
 
+def ammend_driver_defaults(config, config_file):
+"""Update INI-type config_file with config values provided.
+
+Create config_file if it doesn't exist.
+
+Other tools in  linux-restricted-modules cloud have been executed to write
+the config_file. So, preserve any pre-existing content and updating
+config keys to new values if already present.
+
+Append config key=value lines if key is not yet in
+config_file.
+
+@param config: Dict of key value pairs to write or update in config_file
+@param config_file: path to defaults file.
+"""
+if not config_file:
+config_file = ETC_DEFAULT_FILE_NVIDIA
+if os.path.exists(config_file):
+lines = util.load_file(config_file).splitlines()
+replaced_keys = set()
+for idx, line in enumerate(lines):
+for key in config.keys():
+if line.startswith('{k}='.format(k=key)):
+lines[idx] = '{k}={v}'.format(k=key, v=config[key])
+replaced_keys.update([key])
+break
+new_keys = set(config.keys()).difference(replaced_keys)
+lines.extend(
+['{k}={v}'.format(k=k, v=config[k]) for k in new_keys] + [''])
+else:
+lines = [
+'{k}={v}'.format(k=k, v=v) for (k, v) in sorted(config.items())]
+lines.insert(0, '# Written by cloud-init #cloud-config')
+lines.append('')
+util.write_file(config_file, '\n'.join(lines))
+
+
 def install_drivers(cfg, pkg_install_func):
 if not isinstance(cfg, dict):
 raise TypeError(
@@ -92,6 +132,8 @@ def install_drivers(cfg, pkg_install_func):
 LOG.debug("Installing NVIDIA drivers (%s=%s, version=%s)",
   cfgpath, nv_acc, version_cfg if version_cfg else 'latest')
 
+ammend_driver_defaults({'latelink':'true'}, ETC_DEFAULT_FILE_NVIDIA)
+
 try:
 util.subp(['ubuntu-drivers', 'install', '--gpgpu', driver_arg])
 except util.ProcessExecutionError as exc:
diff --git a/cloudinit/config/tests/test_ubuntu_drivers.py b/cloudinit/config/tests/test_ubuntu_drivers.py
index efba4ce..73f6fda 100644
--- a/cloudinit/config/tests/test_ubuntu_drivers.py
+++ b/cloudinit/config/tests/test_ubuntu_drivers.py
@@ -6,7 +6,7 @@ from cloudinit.tests.helpers import CiTestCase, skipUnlessJsonSchema, mock
 from cloudinit.config.schema import (
 SchemaValidationError, validate_cloudconfig_schema)
 from cloudinit.config import cc_ubuntu_drivers as drivers
-from cloudinit.util import ProcessExecutionError
+from cloudinit.util import ProcessExecutionError, load_file, write_file
 
 MPATH = "cloudinit.config.cc_ubuntu_drivers."
 OLD_UBUNTU_DRIVERS_ERROR_STDERR = (
@@ -14,6 +14,26 @@ OLD_UBUNTU_DRIVERS_ERROR_STDERR = (
 "(choose from 'list', 'autoinstall', 'devices', 'debug')\n")
 
 
+class TestAmmendDriverDefaults(CiTestCase):
+
+def test_write_new_file_sorted_if_absent(self):
+"""Create config_file with cloud-init header comment if absent."""
+outfile = self.tmp_path('driver-config')
+drivers.ammend_driver_defaults({'k2': 'v2', 'k1': 'v1'}, outfile)
+expected = '# Written by c

Re: [Cloud-init-dev] [Merge] ~daniel-thewatkins/cloud-init/+git/cloud-init:oci-vnic into cloud-init:master

2019-08-08 Thread Chad Smith



Diff comments:

> diff --git a/cloudinit/sources/DataSourceOracle.py 
> b/cloudinit/sources/DataSourceOracle.py
> index 76cfa38..f18e5a0 100644
> --- a/cloudinit/sources/DataSourceOracle.py
> +++ b/cloudinit/sources/DataSourceOracle.py
> @@ -28,8 +28,70 @@ import re
>  
>  LOG = logging.getLogger(__name__)
>  
> +BUILTIN_DS_CONFIG = {
> +# Don't use IMDS to configure secondary NICs by default
> +'configure_secondary_nics': False,
> +}
>  CHASSIS_ASSET_TAG = "OracleCloud.com"
>  METADATA_ENDPOINT = "http://169.254.169.254/openstack/;
> +VNIC_METADATA_URL = 'http://169.254.169.254/opc/v1/vnics/'
> +
> +
> +def _network_config_from_opc_imds(network_config):
> +"""
> +Fetch data from Oracle's IMDS and generate secondary NIC config.
> +
> +The primary NIC configuration should not be modified based on the IMDS
> +values, as it should continue to be configured for DHCP.  As such, this
> +takes an existing network_config dict which is expected to have the 
> primary
> +NIC configuration already present.
> +
> +:param network_config:
> +A v1 network config dict with the primary NIC already configured.  
> This
> +dict will be mutated.
> +
> +:raises:
> +Exceptions are not handled within this function.  Likely exceptions 
> are
> +those raised by url_helper.readurl (if communicating with the IMDS
> +fails), ValueError/JSONDecodeError (if the IMDS returns invalid 
> JSON),
> +and KeyError/IndexError (if the IMDS returns valid JSON with 
> unexpected
> +contents).
> +
> +:return:
> +The ``network_config`` dict with secondary NICs added.
> +"""
> +resp = readurl(VNIC_METADATA_URL)
> +vnics = json.loads(str(resp))
> +
> +if 'nicIndex' in vnics[0]:
> +LOG.debug('VNIC metadata indicates this is a bare metal machine;'

Is this a warning because we configured it for secondary nics but didn't get 
that feature?

> +  ' skipping secondary VNIC configuration.')
> +return network_config
> +
> +interfaces_by_mac = get_interfaces_by_mac()
> +
> +for vnic_dict in vnics[1:]:
> +mac_address = vnic_dict['macAddr'].lower()
> +if mac_address not in interfaces_by_mac:
> +LOG.info('Interface with MAC %s not found; skipping', 
> mac_address)
> +continue
> +name = interfaces_by_mac[mac_address]
> +subnet = {
> +'type': 'static',
> +'address': vnic_dict['privateIp'],
> +'netmask': vnic_dict['subnetCidrBlock'].split('/')[1],
> +'gateway': vnic_dict['virtualRouterIp'],
> +'control': 'manual',
> +}
> +network_config['config'].append({
> +'name': name,
> +'type': 'physical',
> +'mac_address': mac_address,
> +'mtu': 9000,
> +'subnets': [subnet],
> +})
> +
> +return network_config
>  
>  
>  class DataSourceOracle(sources.DataSource):
> @@ -121,6 +190,14 @@ class DataSourceOracle(sources.DataSource):
>  self._network_config = cmdline.read_initramfs_config()
>  if not self._network_config:
>  self._network_config = self.distro.generate_fallback_config()
> +if self.ds_cfg.get('configure_secondary_nics'):

Shall we use util.is_true(self.ds_cfg.get('configure_secondary_nics')) to 
retain flexibility with True 'true', 1 'on', yes?

> +try:
> +self._network_config = _network_config_from_opc_imds(
> +self._network_config)
> +except Exception:
> +util.logexc(
> +LOG,
> +"Failed to fetch secondary network configuration!")
>  return self._network_config
>  
>  


-- 
https://code.launchpad.net/~daniel-thewatkins/cloud-init/+git/cloud-init/+merge/371053
Your team cloud-init commiters is requested to review the proposed merge of 
~daniel-thewatkins/cloud-init/+git/cloud-init:oci-vnic 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] ~chad.smith/cloud-init:feature/ec2-secondary-nics into cloud-init:master

2019-08-06 Thread Chad Smith
The proposal to merge ~chad.smith/cloud-init:feature/ec2-secondary-nics into 
cloud-init:master has been updated.

Status: Needs review => Work in progress

For more details, see:
https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/369792
-- 
Your team cloud-init commiters is requested to review the proposed merge of 
~chad.smith/cloud-init:feature/ec2-secondary-nics 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/azure-to-network-v2 into cloud-init:master

2019-08-06 Thread Chad Smith



Diff comments:

> diff --git a/cloudinit/net/network_state.py b/cloudinit/net/network_state.py
> index 0ca576b..c0c415d 100644
> --- a/cloudinit/net/network_state.py
> +++ b/cloudinit/net/network_state.py
> @@ -596,6 +596,7 @@ class NetworkStateInterpreter(object):
>eno1:
>  match:
>macaddress: 00:11:22:33:44:55
> +  driver: hv_netsvc

ohh was just a docstring addition, wanted a more complete reference.

>  wakeonlan: true
>  dhcp4: true
>  dhcp6: false
> diff --git a/tests/unittests/test_datasource/test_azure.py 
> b/tests/unittests/test_datasource/test_azure.py
> index 2de2aea..3ed9e4e 100644
> --- a/tests/unittests/test_datasource/test_azure.py
> +++ b/tests/unittests/test_datasource/test_azure.py
> @@ -997,7 +997,7 @@ scbus-1 on xpt0 bus 0
>  netconfig = dsrc.network_config
>  self.assertEqual(netconfig, fallback_config)
>  mock_fallback.assert_called_with(blacklist_drivers=['mlx4_core'],
> - config_driver=True)
> + config_driver=True, 
> network_version=2)

oops. that should have failed/

>  
>  @mock.patch('cloudinit.net.get_interface_mac')
>  @mock.patch('cloudinit.net.get_devicelist')
> diff --git a/tests/unittests/test_net.py b/tests/unittests/test_net.py
> index 1840ade..4f7e420 100644
> --- a/tests/unittests/test_net.py
> +++ b/tests/unittests/test_net.py
> @@ -2156,7 +2156,7 @@ DEFAULT_DEV_ATTRS = {
>  "carrier": False,
>  "dormant": False,
>  "operstate": "down",
> -"address": "07-1C-C6-75-A4-BE",
> +"address": "07-1c-c6-75-a4-be",

only because out netplan we generate in other cases was lowercase. I don't have 
to, just wanted it to the the same case for !fallback

>  "device/driver": None,
>  "device/device": None,
>  "name_assign_type": "4",
> @@ -3342,13 +3375,13 @@ class TestNetplanNetRendering(CiTestCase):
>  
>  expected = """
>  network:
> -version: 2
>  ethernets:
>  eth1000:
>  dhcp4: true
>  match:
>  macaddress: 07-1c-c6-75-a4-be
>  set-name: eth1000
> +version: 2

Because we are rendering directly from network v2 using yaml dump without 
ordering rules instead of converting from v1 to v2 with a helper function which 
intentionally ordered the output with version key first.

>  """
>  self.assertEqual(expected.lstrip(), contents.lstrip())
>  self.assertEqual(1, mock_clean_default.call_count)


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

2019-08-06 Thread Chad Smith
The proposal to merge ~chad.smith/cloud-init:feature/azure-to-network-v2 into 
cloud-init:master has been updated.

Commit message changed to:

azure/net: generate_fallback_config emits network config v2

To enable Azure to send network v2, net.generate_fallback_config now
generates network config v2 instead of v1.

To support this shift, network_state also needed a small addition
to account for setting driver params if present in the match section
for a specific interface.

For more details, see:
https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/370970
-- 
Your team cloud-init commiters is requested to review the proposed merge of 
~chad.smith/cloud-init:feature/azure-to-network-v2 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/azure-to-network-v2 into cloud-init:master

2019-08-06 Thread Chad Smith



Diff comments:

> diff --git a/cloudinit/net/__init__.py b/cloudinit/net/__init__.py
> index f3cec79..fa15b96 100644
> --- a/cloudinit/net/__init__.py
> +++ b/cloudinit/net/__init__.py
> @@ -272,25 +273,30 @@ def generate_fallback_config(blacklist_drivers=None, 
> config_driver=None):
>  config_driver = False
>  
>  target_name = find_fallback_nic(blacklist_drivers=blacklist_drivers)
> -if target_name:
> -target_mac = read_sys_net_safe(target_name, 'address')
> +if not target_name:
> +# can't read any interfaces addresses (or there are none); give up
> +return None
> +target_mac = read_sys_net_safe(target_name, 'address')
> +driver_params = {}
> +if config_driver:
> +driver = device_driver(target_name)
> +if driver:
> +driver_params = {'driver': driver,
> + 'device_id': device_devid(target_name)}
> +if network_version == 1:
> +# TODO(Drop network v1 once NetworkState parses v2)

You are correct here, I misinterpreted a test failure I ran into with 
network_state not handling v2 match:driver declarations when emitting udev 
rules. Got that fixed in the followup.

>  nconf = {'config': [], 'version': 1}
>  cfg = {'type': 'physical', 'name': target_name,
> 'mac_address': target_mac, 'subnets': [{'type': 'dhcp'}]}
> -# inject the device driver name, dev_id into config if enabled and
> -# device has a valid device driver value
> -if config_driver:
> -driver = device_driver(target_name)
> -if driver:
> -cfg['params'] = {
> -'driver': driver,
> -'device_id': device_devid(target_name),
> -}
> +if driver_params:
> +cfg['params'] = driver_params
>  nconf['config'].append(cfg)
>  return nconf
> -else:
> -# can't read any interfaces addresses (or there are none); give up
> -return None
> +cfg = {'dhcp4': True, 'set-name': target_name,
> +   'match': {'macaddress': target_mac.lower()}}
> +cfg['match'].update(driver_params)
> +nconf = {'ethernets': {target_name: cfg}, 'version': 2}
> +return nconf
>  
>  
>  def extract_physdevs(netcfg):


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

2019-08-06 Thread Chad Smith
The proposal to merge ~chad.smith/cloud-init:feature/azure-to-network-v2 into 
cloud-init:master has been updated.

Commit message changed to:

azure/net: generate_fallback_nic emits network v2 config instead of v1

To enable Azure to send network v2, net.generate_fallback_config now
generates network config v2 instead of v1.

To support this shift, network_state also needed a small addition
to account for setting driver params if present in the match section
for a specific interface.

For more details, see:
https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/370970
-- 
Your team cloud-init commiters is requested to review the proposed merge of 
~chad.smith/cloud-init:feature/azure-to-network-v2 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] ~chad.smith/cloud-init:feature/azure-to-network-v2 into cloud-init:master

2019-08-06 Thread Chad Smith
The proposal to merge ~chad.smith/cloud-init:feature/azure-to-network-v2 into 
cloud-init:master has been updated.

Commit message changed to:

azure/net: generate_fallback_nic emits network v2 config instead of v1

The function generate_fallback_config is used by Azure by default when
not consuming IMDS configuration data. This function is also used by any
datasource which does not implement it's own network config. This simple
fallback configuration sets up dhcp on the most likely NIC. It will now
emit network v2 instead of network v1.

This is a step toward moving all components talking in v2 and allows us
to avoid costly conversions between v1 and v2 for newer distributions
which rely on netplan.

For more details, see:
https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/370970
-- 
Your team cloud-init commiters is requested to review the proposed merge of 
~chad.smith/cloud-init:feature/azure-to-network-v2 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] ~chad.smith/cloud-init:feature/azure-to-network-v2 into cloud-init:master

2019-08-05 Thread Chad Smith
Chad Smith has proposed merging 
~chad.smith/cloud-init:feature/azure-to-network-v2 into cloud-init:master.

Commit message:
azure: provide fallback network config v2 for fallback nic

To enable Azure to send network v2, net.generate_fallback_config now
accepts a network_version param to specify whether version 1 or version
2 network configuration is desired. DataSourceAzure.network_config now
requests network_version=2 when generating fallback configuration.


This branch avoids moving generate_fallback_config to v2 exclusively because we 
first need NetworkState to be able to parse v2 as fallback config is passed 
directly into NetworkState.

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

For more details, see:
https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/370970
-- 
Your team cloud-init commiters is requested to review the proposed merge of 
~chad.smith/cloud-init:feature/azure-to-network-v2 into cloud-init:master.
diff --git a/cloudinit/net/__init__.py b/cloudinit/net/__init__.py
index f3cec79..fa15b96 100644
--- a/cloudinit/net/__init__.py
+++ b/cloudinit/net/__init__.py
@@ -264,7 +264,8 @@ def find_fallback_nic(blacklist_drivers=None):
 return None
 
 
-def generate_fallback_config(blacklist_drivers=None, config_driver=None):
+def generate_fallback_config(
+blacklist_drivers=None, config_driver=None, network_version=1):
 """Determine which attached net dev is most likely to have a connection and
generate network state to run dhcp on that interface"""
 
@@ -272,25 +273,30 @@ def generate_fallback_config(blacklist_drivers=None, config_driver=None):
 config_driver = False
 
 target_name = find_fallback_nic(blacklist_drivers=blacklist_drivers)
-if target_name:
-target_mac = read_sys_net_safe(target_name, 'address')
+if not target_name:
+# can't read any interfaces addresses (or there are none); give up
+return None
+target_mac = read_sys_net_safe(target_name, 'address')
+driver_params = {}
+if config_driver:
+driver = device_driver(target_name)
+if driver:
+driver_params = {'driver': driver,
+ 'device_id': device_devid(target_name)}
+if network_version == 1:
+# TODO(Drop network v1 once NetworkState parses v2)
 nconf = {'config': [], 'version': 1}
 cfg = {'type': 'physical', 'name': target_name,
'mac_address': target_mac, 'subnets': [{'type': 'dhcp'}]}
-# inject the device driver name, dev_id into config if enabled and
-# device has a valid device driver value
-if config_driver:
-driver = device_driver(target_name)
-if driver:
-cfg['params'] = {
-'driver': driver,
-'device_id': device_devid(target_name),
-}
+if driver_params:
+cfg['params'] = driver_params
 nconf['config'].append(cfg)
 return nconf
-else:
-# can't read any interfaces addresses (or there are none); give up
-return None
+cfg = {'dhcp4': True, 'set-name': target_name,
+   'match': {'macaddress': target_mac.lower()}}
+cfg['match'].update(driver_params)
+nconf = {'ethernets': {target_name: cfg}, 'version': 2}
+return nconf
 
 
 def extract_physdevs(netcfg):
diff --git a/cloudinit/net/network_state.py b/cloudinit/net/network_state.py
index 0ca576b..1e6ead2 100644
--- a/cloudinit/net/network_state.py
+++ b/cloudinit/net/network_state.py
@@ -343,7 +343,6 @@ class NetworkStateInterpreter(object):
  ]
 }
 '''
-
 interfaces = self._network_state.get('interfaces', {})
 iface = interfaces.get(command['name'], {})
 for param, val in command.get('params', {}).items():
diff --git a/cloudinit/sources/DataSourceAzure.py b/cloudinit/sources/DataSourceAzure.py
index d2fad9b..ab47507 100755
--- a/cloudinit/sources/DataSourceAzure.py
+++ b/cloudinit/sources/DataSourceAzure.py
@@ -1268,7 +1268,8 @@ def parse_network_config(imds_metadata):
 LOG.debug('Azure: generating fallback configuration')
 # generate a network config, blacklist picking mlx4_core devs
 netconfig = net.generate_fallback_config(
-blacklist_drivers=blacklist, config_driver=True)
+blacklist_drivers=blacklist, config_driver=True,
+network_version=2)
 evt.description = "network config from fallback"
 return netconfig
 
diff --git a/tests/unittests/test_datasource/test_azure.py b/tests/unittests/test_datasource/test_azure.py
index 2de2aea..3ed9e4e 100644
--- a/tests/unittests/test_datasource/test_azure.py
+++ b/tests/unittests/test_datasource/test_azure.py
@@ -997,7 +997,7 @@ scbus-1 on xpt0 bus 0
 netconfig = dsrc.network_config
 self.assertEqual(netconfig, fallback_config)
 

[Cloud-init-dev] [Merge] ~chad.smith/cloud-init:feature/ec2-secondary-nics into cloud-init:master

2019-08-05 Thread Chad Smith
Chad Smith has proposed merging 
~chad.smith/cloud-init:feature/ec2-secondary-nics into cloud-init:master.

Commit message:
ec2: render secondary IPs on primary nic when present in metadata

Parse local-ipv4s and subnet-ipv4-cidr-block on EC2 metadata version
2018-09-24 to obtain secondary nic private IPs and network mask for
the primary nic.

In adding this feature, convert DataSourceEc2.network_config to
emit network version 2 instead of version 1.

To allow for retaining original network config behavior on earlier
distribution series, surface a datasource config option
configure_secondary_ips which defaults to True on tip.

Older/stable distribution series will set configure_secondary_ips
default to False.

Requested reviews:
  Server Team CI bot (server-team-bot): continuous-integration
  cloud-init commiters (cloud-init-dev)

For more details, see:
https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/369792
-- 
Your team cloud-init commiters is requested to review the proposed merge of 
~chad.smith/cloud-init:feature/ec2-secondary-nics into cloud-init:master.
diff --git a/cloudinit/sources/DataSourceEc2.py b/cloudinit/sources/DataSourceEc2.py
index 5c017bf..f39b73f 100644
--- a/cloudinit/sources/DataSourceEc2.py
+++ b/cloudinit/sources/DataSourceEc2.py
@@ -54,7 +54,7 @@ class DataSourceEc2(sources.DataSource):
 
 # Priority ordered list of additional metadata versions which will be tried
 # for extended metadata content. IPv6 support comes in 2016-09-02
-extended_metadata_versions = ['2016-09-02']
+extended_metadata_versions = ['2018-09-24', '2016-09-02']
 
 # Setup read_url parameters per get_url_params.
 url_max_wait = 120
@@ -332,8 +332,13 @@ class DataSourceEc2(sources.DataSource):
 macs_to_nics = {net.get_interface_mac(iface): iface}
 net_md = self.metadata.get('network')
 if isinstance(net_md, dict):
+# SRU_BLOCKER: xenial, bionic and disco should default
+# configure_secondary_ips to False to retain original behavior on
+# those releases.
 result = convert_ec2_metadata_network_config(
-net_md, macs_to_nics=macs_to_nics, fallback_nic=iface)
+net_md, macs_to_nics=macs_to_nics, fallback_nic=iface,
+config_secondary_ips=util.is_true(
+self.ds_cfg.get('configure_secondary_ips', True)))
 
 # RELEASE_BLOCKER: xenial should drop the below if statement,
 # because the issue being addressed doesn't exist pre-netplan.
@@ -373,7 +378,7 @@ class DataSourceEc2(sources.DataSource):
 if not self.wait_for_metadata_service():
 return {}
 api_version = self.get_metadata_api_version()
-crawled_metadata = {}
+crawled_metadata = {'_metadata_api_version': api_version}
 try:
 crawled_metadata['user-data'] = ec2.get_instance_userdata(
 api_version, self.metadata_address)
@@ -388,7 +393,6 @@ class DataSourceEc2(sources.DataSource):
 LOG, "Failed reading from metadata address %s",
 self.metadata_address)
 return {}
-crawled_metadata['_metadata_api_version'] = api_version
 return crawled_metadata
 
 
@@ -523,8 +527,9 @@ def _collect_platform_data():
 return data
 
 
-def convert_ec2_metadata_network_config(network_md, macs_to_nics=None,
-fallback_nic=None):
+def convert_ec2_metadata_network_config(
+network_md, macs_to_nics=None, fallback_nic=None,
+config_secondary_ips=True):
 """Convert ec2 metadata to network config version 1 data dict.
 
 @param: network_md: 'network' portion of EC2 metadata.
@@ -535,25 +540,52 @@ def convert_ec2_metadata_network_config(network_md, macs_to_nics=None,
not provided, get_interfaces_by_mac is called to get it from the OS.
 @param: fallback_nic: Optionally provide the primary nic interface name.
This nic will be guaranteed to minimally have a dhcp4 configuration.
+@param: config_secondary_ips: Boolean set True to configure any
+   secondary IPs described by the metadata service.
 
-@return A dict of network config version 1 based on the metadata and macs.
+@return A dict of network config version 2 based on the metadata and macs.
 """
-netcfg = {'version': 1, 'config': []}
+netcfg = {'version': 2, 'ethernets': {}}
 if not macs_to_nics:
 macs_to_nics = net.get_interfaces_by_mac()
 macs_metadata = network_md['interfaces']['macs']
 for mac, nic_name in macs_to_nics.items():
+dev_config = {}
 nic_metadata = macs_metadata.get(mac)
 if not nic_metadata:
 continue  # Not a physical nic represented in metadata
-nic_cfg = {'type': 'physical', 'name': nic_name, 'subnets': []}
-nic_cfg['mac_address'] = mac
-if (nic_name == 

Re: [Cloud-init-dev] [Merge] ~jasonzio/cloud-init:disableIMDSnetcfg into cloud-init:master

2019-08-05 Thread Chad Smith
This content will not be merged because there is an active fix for systemd that 
has been pushed upstream and will be landing imminently in Ubuntu Bionic, Disco 
and Eoan.


https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1835581

it requires no changes to cloud-init to support this. I have already verified 
the fix for cloud-init, expectation is that the fix will be published this week 
for Bionic/Disco and likely next week for Eoan.
-- 
https://code.launchpad.net/~jasonzio/cloud-init/+git/cloud-init/+merge/364012
Your team cloud-init commiters is requested to review the proposed merge of 
~jasonzio/cloud-init:disableIMDSnetcfg 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] ~jasonzio/cloud-init:disableIMDSnetcfg into cloud-init:master

2019-08-05 Thread Chad Smith
The proposal to merge ~jasonzio/cloud-init:disableIMDSnetcfg into 
cloud-init:master has been updated.

Status: Needs review => Rejected

For more details, see:
https://code.launchpad.net/~jasonzio/cloud-init/+git/cloud-init/+merge/364012
-- 
Your team cloud-init commiters is requested to review the proposed merge of 
~jasonzio/cloud-init:disableIMDSnetcfg 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/ec2-secondary-nics into cloud-init:master

2019-07-16 Thread Chad Smith
Waiting on this change of behavior until after 19.2 upstream release
-- 
https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/369792
Your team cloud-init commiters is requested to review the proposed merge of 
~chad.smith/cloud-init:feature/ec2-secondary-nics 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] ~chad.smith/cloud-init:feature/ec2-secondary-nics into cloud-init:master

2019-07-16 Thread Chad Smith
The proposal to merge ~chad.smith/cloud-init:feature/ec2-secondary-nics into 
cloud-init:master has been updated.

Status: Needs review => Work in progress

For more details, see:
https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/369792
-- 
Your team cloud-init commiters is requested to review the proposed merge of 
~chad.smith/cloud-init:feature/ec2-secondary-nics 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/ec2-secondary-nics into cloud-init:master

2019-07-09 Thread Chad Smith



Diff comments:

> diff --git a/cloudinit/sources/DataSourceEc2.py 
> b/cloudinit/sources/DataSourceEc2.py
> index 5c017bf..9a5ed43 100644
> --- a/cloudinit/sources/DataSourceEc2.py
> +++ b/cloudinit/sources/DataSourceEc2.py
> @@ -536,24 +536,43 @@ def convert_ec2_metadata_network_config(network_md, 
> macs_to_nics=None,
>  @param: fallback_nic: Optionally provide the primary nic interface name.
> This nic will be guaranteed to minimally have a dhcp4 configuration.
>  
> -@return A dict of network config version 1 based on the metadata and 
> macs.
> +@return A dict of network config version 2 based on the metadata and 
> macs.
>  """
> -netcfg = {'version': 1, 'config': []}
> +netcfg = {'version': 2, 'ethernets': {}}
>  if not macs_to_nics:
>  macs_to_nics = net.get_interfaces_by_mac()
>  macs_metadata = network_md['interfaces']['macs']
>  for mac, nic_name in macs_to_nics.items():
> +dev_config = {}
>  nic_metadata = macs_metadata.get(mac)
>  if not nic_metadata:
>  continue  # Not a physical nic represented in metadata
> -nic_cfg = {'type': 'physical', 'name': nic_name, 'subnets': []}
> -nic_cfg['mac_address'] = mac
> +local_ipv4s = nic_metadata.get('local-ipv4s')
>  if (nic_name == fallback_nic or nic_metadata.get('public-ipv4s') or
> -nic_metadata.get('local-ipv4s')):
> -nic_cfg['subnets'].append({'type': 'dhcp4'})
> +local_ipv4s):
> +dev_config['dhcp4'] = True
> +# In version < 2018-09-24 local_ipvs is a str with a single IP
> +if isinstance(local_ipv4s, list) and len(local_ipv4s) > 1:
> +if dev_config.get('addresses') is None:

right again. dropped conditional

> +dev_config['addresses'] = []
> +subnet_cidr = nic_metadata.get('subnet-ipv4-cidr-block')
> +if not subnet_cidr or '/' not in subnet_cidr:
> +LOG.warning(
> +'Could not parse subnet-ipv4-cidr-block %s.'
> +' Network config for Secondary IPs default to /32',
> +subnet_cidr)
> +prefix = '32'
> +else:
> +_ip, prefix = subnet_cidr.split('/')

Instead checking len(subnet_cidr.split('/')) != 2 in the warning conditional 
above.

> +for secondary_ip in local_ipv4s[1:]:
> +dev_config['addresses'].append(
> +'{ip}/{prefix}'.format(ip=secondary_ip, 
> prefix=prefix))
>  if nic_metadata.get('ipv6s'):
> -nic_cfg['subnets'].append({'type': 'dhcp6'})
> -netcfg['config'].append(nic_cfg)
> +dev_config['dhcp6'] = True
> +dev_config.update({
> +'match': {'macaddress': mac.lower()},
> +'set-name': nic_name})
> +netcfg['ethernets'][nic_name] = dev_config
>  return netcfg
>  
>  
> diff --git a/tests/unittests/test_datasource/test_ec2.py 
> b/tests/unittests/test_datasource/test_ec2.py
> index 20d59bf..e031fe9 100644
> --- a/tests/unittests/test_datasource/test_ec2.py
> +++ b/tests/unittests/test_datasource/test_ec2.py
> @@ -309,10 +396,40 @@ class TestEc2(test_helpers.HttprettyTestCase):
>  ds.get_data()
>  
>  mac1 = '06:17:04:d7:26:0A'  # IPv4 only in DEFAULT_METADATA
> -expected = {'version': 1, 'config': [
> -{'mac_address': '06:17:04:d7:26:0A', 'name': 'eth9',
> - 'subnets': [{'type': 'dhcp4'}],
> - 'type': 'physical'}]}
> +expected = {'version': 2, 'ethernets': {'eth9': {
> +'match': {'macaddress': '06:17:04:d7:26:0a'}, 'set-name': 'eth9',
> +'dhcp4': True}}}
> +patch_path = (
> +'cloudinit.sources.DataSourceEc2.net.get_interfaces_by_mac')

done

> +get_interface_mac_path = (
> +'cloudinit.sources.DataSourceEc2.net.get_interface_mac')
> +with mock.patch(patch_path) as m_get_interfaces_by_mac:
> +with mock.patch(find_fallback_path) as m_find_fallback:
> +with mock.patch(get_interface_mac_path) as m_get_mac:
> +m_get_interfaces_by_mac.return_value = {mac1: 'eth9'}
> +m_find_fallback.return_value = 'eth9'
> +m_get_mac.return_value = mac1
> +self.assertEqual(expected, ds.network_config)
> +
> +def test_network_config_property_secondary_private_ips(self):
> +"""network_config property configures any secondary ipv4 addresses.
> +
> +Only one device is configured even when multiple exist in metadata.

copy-paste error, dropping that from the docstring.

> +"""
> +ds = self._setup_ds(
> +platform_data=self.valid_platform_data,
> +sys_cfg={'datasource': {'Ec2': {'strict_id': True}}},
> +

[Cloud-init-dev] [Merge] ~chad.smith/cloud-init:feature/ec2-secondary-nics into cloud-init:master

2019-07-08 Thread Chad Smith
The proposal to merge ~chad.smith/cloud-init:feature/ec2-secondary-nics into 
cloud-init:master has been updated.

Commit message changed to:

ec2: render secondary IPs on primary nic when present in metadata

Parse local-ipv4s and subnet-ipv4-cidr-block on EC2 metadata version
2018-09-24 to obtain secondary nic private IPs and network mask for
the primary nic.

In adding this feature, convert DataSourceEc2.network_config to
emit network version 2 instead of version 1.

To allow for retaining original network config behavior on earlier
distribution series, surface a datasource config option
configure_secondary_ips which defaults to True on tip.

Older/stable distribution series will set configure_secondary_ips
default to False.

For more details, see:
https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/369792
-- 
Your team cloud-init commiters is requested to review the proposed merge of 
~chad.smith/cloud-init:feature/ec2-secondary-nics 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] ~chad.smith/cloud-init:feature/ec2-secondary-nics into cloud-init:master

2019-07-08 Thread Chad Smith
The proposal to merge ~chad.smith/cloud-init:feature/ec2-secondary-nics into 
cloud-init:master has been updated.

Commit message changed to:

ec2: render secondary IPs on primary nic when present in metadata

Parse local-ipv4s and subnet-ipv4-cidr-block on EC2 metadata version
2018-09-24 to obtain secondary nic private IPs and network mask for
the primary nic.

In adding this feature, convert DataSourceEc2.network_config to
emit network version 2 instead of version 1.

To allow for retaining original network config behavior on earlier
distribution series, surface a datasource config option
configure_secondary_ips which defaults to True on tip.

Older distribution series will set configure_secondary_ips default
to False.

For more details, see:
https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/369792
-- 
Your team cloud-init commiters is requested to review the proposed merge of 
~chad.smith/cloud-init:feature/ec2-secondary-nics 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/ec2-secondary-nics into cloud-init:master

2019-07-08 Thread Chad Smith



Diff comments:

> diff --git a/cloudinit/sources/DataSourceEc2.py 
> b/cloudinit/sources/DataSourceEc2.py
> index 5c017bf..aef5d80 100644
> --- a/cloudinit/sources/DataSourceEc2.py
> +++ b/cloudinit/sources/DataSourceEc2.py
> @@ -536,24 +536,35 @@ def convert_ec2_metadata_network_config(network_md, 
> macs_to_nics=None,
>  @param: fallback_nic: Optionally provide the primary nic interface name.
> This nic will be guaranteed to minimally have a dhcp4 configuration.
>  
> -@return A dict of network config version 1 based on the metadata and 
> macs.
> +@return A dict of network config version 2 based on the metadata and 
> macs.
>  """
> -netcfg = {'version': 1, 'config': []}
> +netcfg = {'version': 2, 'ethernets': {}}
>  if not macs_to_nics:
>  macs_to_nics = net.get_interfaces_by_mac()
>  macs_metadata = network_md['interfaces']['macs']
>  for mac, nic_name in macs_to_nics.items():
> +dev_config = {}
>  nic_metadata = macs_metadata.get(mac)
>  if not nic_metadata:
>  continue  # Not a physical nic represented in metadata
> -nic_cfg = {'type': 'physical', 'name': nic_name, 'subnets': []}
> -nic_cfg['mac_address'] = mac
> +local_ipv4s = nic_metadata.get('local-ipv4s')
>  if (nic_name == fallback_nic or nic_metadata.get('public-ipv4s') or
> -nic_metadata.get('local-ipv4s')):
> -nic_cfg['subnets'].append({'type': 'dhcp4'})
> +local_ipv4s):
> +dev_config['dhcp4'] = True
> +if isinstance(local_ipv4s, list) and len(local_ipv4s) > 1:

Added the comment # In version < 2018-09-24 local_ipvs is a str 
with a single IP

> +subnet_cidr = nic_metadata.get('subnet-ipv4-cidr-block')
> +_ip, prefix = subnet_cidr.split('/')

checking now and wawrning if we see it + default to /32 secondary IP setting 
which will at least preserve a strict route and the desired secondary IP. 
default routes should still have proper connectivity on preferred primary IP.

> +for secondary_ip in local_ipv4s[1:]:
> +if dev_config.get('addresses') is None:

yes and done.

> +dev_config['addresses'] = []
> +dev_config['addresses'].append(
> +'{ip}/{prefix}'.format(ip=secondary_ip, 
> prefix=prefix))
>  if nic_metadata.get('ipv6s'):
> -nic_cfg['subnets'].append({'type': 'dhcp6'})
> -netcfg['config'].append(nic_cfg)
> +dev_config['dhcp6'] = True
> +dev_config.update({
> +'match': {'macaddress': nic_metadata.get('mac').lower()},

oops, don't really even need that as we already have mac local variable from 
our outer macs_to_nics for loop.

> +'set-name': nic_name})
> +netcfg['ethernets'][nic_name] = dev_config
>  return netcfg
>  
>  
> diff --git a/tests/unittests/test_datasource/test_ec2.py 
> b/tests/unittests/test_datasource/test_ec2.py
> index 20d59bf..c99f58f 100644
> --- a/tests/unittests/test_datasource/test_ec2.py
> +++ b/tests/unittests/test_datasource/test_ec2.py
> @@ -112,6 +112,94 @@ DEFAULT_METADATA = {
>  "services": {"domain": "amazonaws.com", "partition": "aws"},
>  }
>  
> +# collected from api version 2016-09-02/ with

Correct, fixed to 2018-09-24.

> +# python3 -c 'import json
> +# from cloudinit.ec2_utils import get_instance_metadata as gm
> +# print(json.dumps(gm("2018-09-24"), indent=1, sort_keys=True))'
> +DEFAULT_METADATA_2018_09_24 = {

Good point, changed it to SECONDARY_IP_METADATA_2018_09_24

> +"ami-id": "ami-0986c2ac728528ac2",
> +"ami-launch-index": "0",
> +"ami-manifest-path": "(unknown)",
> +"block-device-mapping": {
> +"ami": "/dev/sda1",
> +"root": "/dev/sda1"
> +},
> +"events": {
> +"maintenance": {
> +"history": "[]",
> +"scheduled": "[]"
> +}
> +},
> +"hostname": "ip-172-31-44-13.us-east-2.compute.internal",
> +"identity-credentials": {
> +"ec2": {
> +"info": {
> +"AccountId": "329910648901",
> +"Code": "Success",
> +"LastUpdated": "2019-07-06T14:22:56Z"
> +}
> +}
> +},
> +"instance-action": "none",
> +"instance-id": "i-069e01e8cc43732f8",
> +"instance-type": "t2.micro",
> +"local-hostname": "ip-172-31-44-13.us-east-2.compute.internal",
> +"local-ipv4": "172.31.44.13",
> +"mac": "0a:07:84:3d:6e:38",
> +"metrics": {
> +"vhostmd": ""
> +},
> +"network": {
> +"interfaces": {
> +"macs": {
> +"0a:07:84:3d:6e:38": {
> +"device-number": "0",
> +"interface-id": "eni-0d6335689899ce9cc",
> +"ipv4-associations": {
> +"18.218.219.181": "172.31.44.13"
> +  

[Cloud-init-dev] [Merge] ~chad.smith/cloud-init:feature/ec2-secondary-nics into cloud-init:master

2019-07-06 Thread Chad Smith
The proposal to merge ~chad.smith/cloud-init:feature/ec2-secondary-nics into 
cloud-init:master has been updated.

Commit message changed to:

ec2: render secondary IPs on primary nic when present in metadata

Parse local-ipv4s and subnet-ipv4-cidr-block on EC2 metadata version
2018-09-24 to obtain secondary nic private IPs and network mask for
the primary nic.

In adding this feature, convert DataSourceEc2.network_configu to
emit network version 2 instead of version 1.

For more details, see:
https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/369792
-- 
Your team cloud-init commiters is requested to review the proposed merge of 
~chad.smith/cloud-init:feature/ec2-secondary-nics 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] ~chad.smith/cloud-init:feature/ec2-secondary-nics into cloud-init:master

2019-07-06 Thread Chad Smith
Chad Smith has proposed merging 
~chad.smith/cloud-init:feature/ec2-secondary-nics into cloud-init:master.

Commit message:
ec2: render secondary IPs on primary nic when present in metadata

Parse local-ipv4s and subnet-ipv4-cidr-block on EC2 metadata version
2018-09-24 to obtain secondary nic private IPs and network mask for
the primary nic.


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

For more details, see:
https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/369792
-- 
Your team cloud-init commiters is requested to review the proposed merge of 
~chad.smith/cloud-init:feature/ec2-secondary-nics into cloud-init:master.
diff --git a/cloudinit/sources/DataSourceEc2.py b/cloudinit/sources/DataSourceEc2.py
index 5c017bf..aef5d80 100644
--- a/cloudinit/sources/DataSourceEc2.py
+++ b/cloudinit/sources/DataSourceEc2.py
@@ -54,7 +54,7 @@ class DataSourceEc2(sources.DataSource):
 
 # Priority ordered list of additional metadata versions which will be tried
 # for extended metadata content. IPv6 support comes in 2016-09-02
-extended_metadata_versions = ['2016-09-02']
+extended_metadata_versions = ['2018-09-24', '2016-09-02']
 
 # Setup read_url parameters per get_url_params.
 url_max_wait = 120
@@ -536,24 +536,35 @@ def convert_ec2_metadata_network_config(network_md, macs_to_nics=None,
 @param: fallback_nic: Optionally provide the primary nic interface name.
This nic will be guaranteed to minimally have a dhcp4 configuration.
 
-@return A dict of network config version 1 based on the metadata and macs.
+@return A dict of network config version 2 based on the metadata and macs.
 """
-netcfg = {'version': 1, 'config': []}
+netcfg = {'version': 2, 'ethernets': {}}
 if not macs_to_nics:
 macs_to_nics = net.get_interfaces_by_mac()
 macs_metadata = network_md['interfaces']['macs']
 for mac, nic_name in macs_to_nics.items():
+dev_config = {}
 nic_metadata = macs_metadata.get(mac)
 if not nic_metadata:
 continue  # Not a physical nic represented in metadata
-nic_cfg = {'type': 'physical', 'name': nic_name, 'subnets': []}
-nic_cfg['mac_address'] = mac
+local_ipv4s = nic_metadata.get('local-ipv4s')
 if (nic_name == fallback_nic or nic_metadata.get('public-ipv4s') or
-nic_metadata.get('local-ipv4s')):
-nic_cfg['subnets'].append({'type': 'dhcp4'})
+local_ipv4s):
+dev_config['dhcp4'] = True
+if isinstance(local_ipv4s, list) and len(local_ipv4s) > 1:
+subnet_cidr = nic_metadata.get('subnet-ipv4-cidr-block')
+_ip, prefix = subnet_cidr.split('/')
+for secondary_ip in local_ipv4s[1:]:
+if dev_config.get('addresses') is None:
+dev_config['addresses'] = []
+dev_config['addresses'].append(
+'{ip}/{prefix}'.format(ip=secondary_ip, prefix=prefix))
 if nic_metadata.get('ipv6s'):
-nic_cfg['subnets'].append({'type': 'dhcp6'})
-netcfg['config'].append(nic_cfg)
+dev_config['dhcp6'] = True
+dev_config.update({
+'match': {'macaddress': nic_metadata.get('mac').lower()},
+'set-name': nic_name})
+netcfg['ethernets'][nic_name] = dev_config
 return netcfg
 
 
diff --git a/tests/unittests/test_datasource/test_ec2.py b/tests/unittests/test_datasource/test_ec2.py
index 20d59bf..c99f58f 100644
--- a/tests/unittests/test_datasource/test_ec2.py
+++ b/tests/unittests/test_datasource/test_ec2.py
@@ -112,6 +112,94 @@ DEFAULT_METADATA = {
 "services": {"domain": "amazonaws.com", "partition": "aws"},
 }
 
+# collected from api version 2016-09-02/ with
+# python3 -c 'import json
+# from cloudinit.ec2_utils import get_instance_metadata as gm
+# print(json.dumps(gm("2018-09-24"), indent=1, sort_keys=True))'
+DEFAULT_METADATA_2018_09_24 = {
+"ami-id": "ami-0986c2ac728528ac2",
+"ami-launch-index": "0",
+"ami-manifest-path": "(unknown)",
+"block-device-mapping": {
+"ami": "/dev/sda1",
+"root": "/dev/sda1"
+},
+"events": {
+"maintenance": {
+"history": "[]",
+"scheduled": "[]"
+}
+},
+"hostname": "ip-172-31-44-13.us-east-2.compute.internal",
+"identity-credentials": {
+"ec2": {
+"info": {
+"AccountId": "329910648901",
+"Code": "Success",
+"LastUpdated": "2019-07-06T14:22:56Z"
+

[Cloud-init-dev] [Merge] ~chad.smith/cloud-init:feature/azure-region-instance-data into cloud-init:master

2019-06-21 Thread Chad Smith
Chad Smith has proposed merging 
~chad.smith/cloud-init:feature/azure-region-instance-data into 
cloud-init:master.

Commit message:
azure: add region property lookup from imds compute location metadata

This allows cloud-init query region to show valid region data for Azure


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

For more details, see:
https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/369199

to test:
make deb;
deploy an azumre vm and install cloud-init deb
cloud-init clean --logs --reboot
cloud-init query --all
cloud-init query region

-- 
Your team cloud-init commiters is requested to review the proposed merge of 
~chad.smith/cloud-init:feature/azure-region-instance-data into 
cloud-init:master.
diff --git a/cloudinit/sources/DataSourceAzure.py b/cloudinit/sources/DataSourceAzure.py
index b7440c1..7a5c81b 100755
--- a/cloudinit/sources/DataSourceAzure.py
+++ b/cloudinit/sources/DataSourceAzure.py
@@ -701,6 +701,10 @@ class DataSourceAzure(sources.DataSource):
 self._network_config = parse_network_config(nc_src)
 return self._network_config
 
+@property
+def region(self):
+return self.metadata.get('imds', {}).get('compute', {}).get('location')
+
 
 def _partitions_on_device(devpath, maxnum=16):
 # return a list of tuples (ptnum, path) for each part on devpath
diff --git a/tests/unittests/test_datasource/test_azure.py b/tests/unittests/test_datasource/test_azure.py
index afb614e..92783cb 100644
--- a/tests/unittests/test_datasource/test_azure.py
+++ b/tests/unittests/test_datasource/test_azure.py
@@ -84,6 +84,25 @@ def construct_valid_ovf_env(data=None, pubkeys=None,
 
 
 NETWORK_METADATA = {
+"compute": {
+"location": "eastus2",
+"name": "my-hostname",
+"offer": "UbuntuServer",
+"osType": "Linux",
+"placementGroupId": "",
+"platformFaultDomain": "0",
+"platformUpdateDomain": "0",
+"publisher": "Canonical",
+"resourceGroupName": "srugroup1",
+"sku": "19.04-DAILY",
+"subscriptionId": "12aad61c-6de4-4e53-a6c6-5aff52a83777",
+"tags": "",
+"version": "19.04.201906190",
+"vmId": "ff702a6b-cb6a-4fcd-ad68-b4ce38227642",
+"vmScaleSetName": "",
+"vmSize": "Standard_DS1_v2",
+"zone": ""
+},
 "network": {
 "interface": [
 {
@@ -478,13 +497,7 @@ scbus-1 on xpt0 bus 0
 expected_metadata = {
 'azure_data': {
 'configurationsettype': 'LinuxProvisioningConfiguration'},
-'imds': {'network': {'interface': [{
-'ipv4': {'ipAddress': [
- {'privateIpAddress': '10.0.0.4',
-  'publicIpAddress': '104.46.124.81'}],
-  'subnet': [{'address': '10.0.0.0', 'prefix': '24'}]},
-'ipv6': {'ipAddress': []},
-'macAddress': '000D3A047598'}]}},
+'imds': NETWORK_METADATA,
 'instance-id': 'test-instance-id',
 'local-hostname': u'myhost',
 'random_seed': 'wild'}
@@ -612,6 +625,16 @@ scbus-1 on xpt0 bus 0
 dsrc.get_data()
 self.assertEqual(expected_network_config, dsrc.network_config)
 
+def test_region_set_from_imds(self):
+"""Datasource.region returns IMDS region location."""
+sys_cfg = {'datasource': {'Azure': {'apply_network_config': True}}}
+odata = {}
+data = {'ovfcontent': construct_valid_ovf_env(data=odata),
+'sys_cfg': sys_cfg}
+dsrc = self._get_ds(data)
+dsrc.get_data()
+self.assertEqual('eastus2', dsrc.region)
+
 def test_user_cfg_set_agent_command(self):
 # set dscfg in via base64 encoded yaml
 cfg = {'agent_command': "my_command"}
___
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] ~chad.smith/cloud-init:ubuntu/xenial into cloud-init:ubuntu/xenial

2019-06-04 Thread Chad Smith
The proposal to merge ~chad.smith/cloud-init:ubuntu/xenial into 
cloud-init:ubuntu/xenial has been updated.

Commit message changed to:

Refresh patches due to drift in cc_ubuntu_advantage.py
new-upstream-snapshot -v --update-patches-only

For more details, see:
https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/368355
-- 
Your team cloud-init commiters is requested to review the proposed merge of 
~chad.smith/cloud-init:ubuntu/xenial into cloud-init:ubuntu/xenial.

___
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] ~chad.smith/cloud-init:ubuntu/xenial into cloud-init:ubuntu/xenial

2019-06-04 Thread Chad Smith
Chad Smith has proposed merging ~chad.smith/cloud-init:ubuntu/xenial into 
cloud-init:ubuntu/xenial.

Requested reviews:
  cloud-init commiters (cloud-init-dev)
Related bugs:
  Bug #1645824 in cloud-init: "NoCloud source doesn't work on FreeBSD"
  https://bugs.launchpad.net/cloud-init/+bug/1645824
  Bug #1669875 in cloud-init: "identify openstack vmware platform"
  https://bugs.launchpad.net/cloud-init/+bug/1669875
  Bug #1827238 in cloud-init: "Machines fail to deploy because cloud-init needs 
to accept both netplan spellings for grat arp"
  https://bugs.launchpad.net/cloud-init/+bug/1827238

For more details, see:
https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/368355
-- 
Your team cloud-init commiters is requested to review the proposed merge of 
~chad.smith/cloud-init:ubuntu/xenial into cloud-init:ubuntu/xenial.
diff --git a/cloudinit/config/cc_growpart.py b/cloudinit/config/cc_growpart.py
index bafca9d..564f376 100644
--- a/cloudinit/config/cc_growpart.py
+++ b/cloudinit/config/cc_growpart.py
@@ -215,7 +215,8 @@ def device_part_info(devpath):
 # FreeBSD doesn't know of sysfs so just get everything we need from
 # the device, like /dev/vtbd0p2.
 if util.is_FreeBSD():
-m = re.search('^(/dev/.+)p([0-9])$', devpath)
+freebsd_part = "/dev/" + util.find_freebsd_part(devpath)
+m = re.search('^(/dev/.+)p([0-9])$', freebsd_part)
 return (m.group(1), m.group(2))
 
 if not os.path.exists(syspath):
diff --git a/cloudinit/config/cc_resizefs.py b/cloudinit/config/cc_resizefs.py
index 076b9d5..afd2e06 100644
--- a/cloudinit/config/cc_resizefs.py
+++ b/cloudinit/config/cc_resizefs.py
@@ -81,7 +81,7 @@ def _resize_xfs(mount_point, devpth):
 
 
 def _resize_ufs(mount_point, devpth):
-return ('growfs', '-y', devpth)
+return ('growfs', '-y', mount_point)
 
 
 def _resize_zfs(mount_point, devpth):
@@ -101,7 +101,7 @@ def _can_skip_resize_ufs(mount_point, devpth):
 """
 # dumpfs -m /
 # newfs command for / (/dev/label/rootfs)
-  newfs -O 2 -U -a 4 -b 32768 -d 32768 -e 4096 -f 4096 -g 16384
+  newfs -L rootf -O 2 -U -a 4 -b 32768 -d 32768 -e 4096 -f 4096 -g 16384
 -h 64 -i 8192 -j -k 6408 -m 8 -o time -s 58719232 /dev/label/rootf
 """
 cur_fs_sz = None
@@ -110,7 +110,7 @@ def _can_skip_resize_ufs(mount_point, devpth):
 for line in dumpfs_res.splitlines():
 if not line.startswith('#'):
 newfs_cmd = shlex.split(line)
-opt_value = 'O:Ua:s:b:d:e:f:g:h:i:jk:m:o:'
+opt_value = 'O:Ua:s:b:d:e:f:g:h:i:jk:m:o:L:'
 optlist, _args = getopt.getopt(newfs_cmd[1:], opt_value)
 for o, a in optlist:
 if o == "-s":
diff --git a/cloudinit/config/cc_ubuntu_advantage.py b/cloudinit/config/cc_ubuntu_advantage.py
index f488123..f846e9a 100644
--- a/cloudinit/config/cc_ubuntu_advantage.py
+++ b/cloudinit/config/cc_ubuntu_advantage.py
@@ -36,7 +36,7 @@ schema = {
 """),
 'distros': distros,
 'examples': [dedent("""\
-# Attach the machine to a Ubuntu Advantage support contract with a
+# Attach the machine to an Ubuntu Advantage support contract with a
 # UA contract token obtained from %s.
 ubuntu_advantage:
   token: 
diff --git a/cloudinit/net/network_state.py b/cloudinit/net/network_state.py
index 4d19f56..3702130 100644
--- a/cloudinit/net/network_state.py
+++ b/cloudinit/net/network_state.py
@@ -707,6 +707,14 @@ class NetworkStateInterpreter(object):
 item_params = dict((key, value) for (key, value) in
item_cfg.items() if key not in
NETWORK_V2_KEY_FILTER)
+# we accept the fixed spelling, but write the old for compatability
+# Xenial does not have an updated netplan which supports the
+# correct spelling.  LP: #1756701
+params = item_params['parameters']
+grat_value = params.pop('gratuitous-arp', None)
+if grat_value:
+params['gratuitious-arp'] = grat_value
+
 v1_cmd = {
 'type': cmd_type,
 'name': item_name,
diff --git a/cloudinit/sources/DataSourceNoCloud.py b/cloudinit/sources/DataSourceNoCloud.py
index fcf5d58..8a9e5dd 100644
--- a/cloudinit/sources/DataSourceNoCloud.py
+++ b/cloudinit/sources/DataSourceNoCloud.py
@@ -35,6 +35,26 @@ class DataSourceNoCloud(sources.DataSource):
 root = sources.DataSource.__str__(self)
 return "%s [seed=%s][dsmode=%s]" % (root, self.seed, self.dsmode)
 
+def _get_devices(self, label):
+if util.is_FreeBSD():
+devlist = [
+p for p in ['/dev/msdosfs/' + label, '/dev/iso9660/' + label]
+if os.path.exists(p)]
+else:
+# Query optical drive to 

[Cloud-init-dev] [Merge] ~goneri/cloud-init:freebsd_nocloud into cloud-init:master

2019-05-24 Thread Chad Smith
The proposal to merge ~goneri/cloud-init:freebsd_nocloud into cloud-init:master 
has been updated.

Status: Needs review => Work in progress

For more details, see:
https://code.launchpad.net/~goneri/cloud-init/+git/cloud-init/+merge/365630
-- 
Your team cloud-init commiters is requested to review the proposed merge of 
~goneri/cloud-init:freebsd_nocloud 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] ~goneri/cloud-init:freebsd_nocloud into cloud-init:master

2019-05-24 Thread Chad Smith
Thanks for this branch Gonéri. Minor nits from me, but otherwise looks good.

Please reset 'Needs review' status when you get a chance to address or resolve 
comments.


Diff comments:

> diff --git a/cloudinit/sources/DataSourceNoCloud.py 
> b/cloudinit/sources/DataSourceNoCloud.py
> index fcf5d58..9912c87 100644
> --- a/cloudinit/sources/DataSourceNoCloud.py
> +++ b/cloudinit/sources/DataSourceNoCloud.py
> @@ -35,6 +35,27 @@ class DataSourceNoCloud(sources.DataSource):
>  root = sources.DataSource.__str__(self)
>  return "%s [seed=%s][dsmode=%s]" % (root, self.seed, self.dsmode)
>  
> +def _get_devices(self, label):
> +devlist = []
> +if util.is_FreeBSD():
> +for p in ['/dev/msdosfs/' + label, '/dev/iso9660/' + label]:

Since you are setting devlist in the else clause, you could drop the devlist = 
[] above and
if util.is_FreeBSD():
devlist = [
p for p in ['/dev/msdosfs/' + label, '/dev/iso9660/' + label]
if os.path.exists(p)]

> +if os.path.exists(p):
> +devlist.append(p)
> +else:
> +# Query optical drive to get it in blkid cache for 2.6 kernels
> +util.find_devs_with(path="/dev/sr0")
> +util.find_devs_with(path="/dev/sr1")
> +
> +fslist = util.find_devs_with("TYPE=vfat")
> +fslist.extend(util.find_devs_with("TYPE=iso9660"))
> +
> +label_list = util.find_devs_with("LABEL=%s" % label.upper())
> +label_list.extend(util.find_devs_with("LABEL=%s" % 
> label.lower()))
> +
> +devlist = list(set(fslist) & set(label_list))
> +devlist.sort(reverse=True)
> +return devlist
> +
>  def _get_data(self):
>  defaults = {
>  "instance-id": "nocloud",
> diff --git a/config/cloud.cfg.tmpl b/config/cloud.cfg.tmpl
> index 25db43e..d3c50dd 100644
> --- a/config/cloud.cfg.tmpl
> +++ b/config/cloud.cfg.tmpl
> @@ -33,7 +33,7 @@ preserve_hostname: false
>  {% if variant in ["freebsd"] %}
>  # This should not be required, but leave it in place until the real cause of
>  # not beeing able to find -any- datasources is resolved.
> -datasource_list: ['ConfigDrive', 'Azure', 'OpenStack', 'Ec2']
> +datasource_list: ['ConfigDrive', 'Azure', 'OpenStack', 'Ec2', 'NoCloud']

I don't think this should be required, because of util.get_builtin_config 
returning a full list of datasources. But if it is required on some system you 
have seen, then I think you should order NoCloud first, before ConfigDrive. 
Then FreeBSD would align with our default settings in cloudinit/settings.py.

Also since you are touching this file anyway, can you replace "beeing able to 
find -any-' with "finding -any-".

>  {% endif %}
>  # Example datasource config
>  # datasource:


-- 
https://code.launchpad.net/~goneri/cloud-init/+git/cloud-init/+merge/365630
Your team cloud-init commiters is requested to review the proposed merge of 
~goneri/cloud-init:freebsd_nocloud 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] ~goneri/cloud-init:freebsd_nocloud into cloud-init:master

2019-05-24 Thread Chad Smith
The proposal to merge ~goneri/cloud-init:freebsd_nocloud into cloud-init:master 
has been updated.

Commit message changed to:

freebsd: NoCloud data source support

blkid is a Linux-only command. With this patch, cloud-init uses another
approach to find the data source on FreeBSD.

For more details, see:
https://code.launchpad.net/~goneri/cloud-init/+git/cloud-init/+merge/365630
-- 
Your team cloud-init commiters is requested to review the proposed merge of 
~goneri/cloud-init:freebsd_nocloud 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] ~chad.smith/cloud-init:ubuntu/bionic into cloud-init:ubuntu/bionic

2019-05-10 Thread Chad Smith
The proposal to merge ~chad.smith/cloud-init:ubuntu/bionic into 
cloud-init:ubuntu/bionic has been updated.

Commit message changed to:

New upstream snapshot for SRU into bionic

only operation out of the norm here is adding a quilt patch to revert changes 
to ubuntu-advantage cloud-config module because ubuntu-advantage-tools 19.1 
hasn't yet been SRUd to bionic
LP: #1828641

For more details, see:
https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/367302
-- 
Your team cloud-init commiters is requested to review the proposed merge of 
~chad.smith/cloud-init:ubuntu/bionic into cloud-init:ubuntu/bionic.

___
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] ~chad.smith/cloud-init:ubuntu/disco into cloud-init:ubuntu/disco

2019-05-10 Thread Chad Smith
Chad Smith has proposed merging ~chad.smith/cloud-init:ubuntu/disco into 
cloud-init:ubuntu/disco.

Commit message:
new upstream snapshot for release into disco

nothing special here for ubuntu advantage config module as 
ubuntu-advantage-tools is the new CLI

Requested reviews:
  cloud-init commiters (cloud-init-dev)
Related bugs:
  Bug #1825596 in cloud-init: "Azure reboot with unformatted ephemeral drive 
won't mount reformatted volume"
  https://bugs.launchpad.net/cloud-init/+bug/1825596
  Bug #1828479 in cloud-init: "Release 19.1"
  https://bugs.launchpad.net/cloud-init/+bug/1828479

For more details, see:
https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/367300
-- 
Your team cloud-init commiters is requested to review the proposed merge of 
~chad.smith/cloud-init:ubuntu/disco into cloud-init:ubuntu/disco.
diff --git a/ChangeLog b/ChangeLog
index 8fa6fdd..bf48fd4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,120 @@
+19.1:
+  - freebsd: add chpasswd pkg in the image [Gonéri Le Bouder]
+  - tests: add Eoan release [Paride Legovini]
+  - cc_mounts: check if mount -a on no-change fstab path
+[Jason Zions (MSFT)] (LP: #1825596)
+  - replace remaining occurrences of LOG.warn [Daniel Watkins]
+  - DataSourceAzure: Adjust timeout for polling IMDS [Anh Vo]
+  - Azure: Changes to the Hyper-V KVP Reporter [Anh Vo]
+  - git tests: no longer show warning about safe yaml.
+  - tools/read-version: handle errors [Chad Miller]
+  - net/sysconfig: only indicate available on known sysconfig distros
+(LP: #1819994)
+  - packages: update rpm specs for new bash completion path
+[Daniel Watkins] (LP: #1825444)
+  - test_azure: mock util.SeLinuxGuard where needed
+[Jason Zions (MSFT)] (LP: #1825253)
+  - setup.py: install bash completion script in new location [Daniel Watkins]
+  - mount_cb: do not pass sync and rw options to mount
+[Gonéri Le Bouder] (LP: #1645824)
+  - cc_apt_configure: fix typo in apt documentation [Dominic Schlegel]
+  - Revert "DataSource: move update_events from a class to an instance..."
+[Daniel Watkins]
+  - Change DataSourceNoCloud to ignore file system label's case.
+[Risto Oikarinen]
+  - cmd:main.py: Fix missing 'modules-init' key in modes dict
+[Antonio Romito] (LP: #1815109)
+  - ubuntu_advantage: rewrite cloud-config module
+  - Azure: Treat _unset network configuration as if it were absent
+[Jason Zions (MSFT)] (LP: #1823084)
+  - DatasourceAzure: add additional logging for azure datasource [Anh Vo]
+  - cloud_tests: fix apt_pipelining test-cases
+  - Azure: Ensure platform random_seed is always serializable as JSON.
+[Jason Zions (MSFT)]
+  - net/sysconfig: write out SUSE-compatible IPv6 config [Robert Schweikert]
+  - tox: Update testenv for openSUSE Leap to 15.0 [Thomas Bechtold]
+  - net: Fix ipv6 static routes when using eni renderer
+[Raphael Glon] (LP: #1818669)
+  - Add ubuntu_drivers config module [Daniel Watkins]
+  - doc: Refresh Azure walinuxagent docs [Daniel Watkins]
+  - tox: bump pylint version to latest (2.3.1) [Daniel Watkins]
+  - DataSource: move update_events from a class to an instance attribute
+[Daniel Watkins] (LP: #1819913)
+  - net/sysconfig: Handle default route setup for dhcp configured NICs
+[Robert Schweikert] (LP: #1812117)
+  - DataSourceEc2: update RELEASE_BLOCKER to be more accurate
+[Daniel Watkins]
+  - cloud-init-per: POSIX sh does not support string subst, use sed
+(LP: #1819222)
+  - Support locking user with usermod if passwd is not available.
+  - Example for Microsoft Azure data disk added. [Anton Olifir]
+  - clean: correctly determine the path for excluding seed directory
+[Daniel Watkins] (LP: #1818571)
+  - helpers/openstack: Treat unknown link types as physical
+[Daniel Watkins] (LP: #1639263)
+  - drop Python 2.6 support and our NIH version detection [Daniel Watkins]
+  - tip-pylint: Fix assignment-from-return-none errors
+  - net: append type:dhcp[46] only if dhcp[46] is True in v2 netconfig
+[Kurt Stieger] (LP: #1818032)
+  - cc_apt_pipelining: stop disabling pipelining by default
+[Daniel Watkins] (LP: #1794982)
+  - tests: fix some slow tests and some leaking state [Daniel Watkins]
+  - util: don't determine string_types ourselves [Daniel Watkins]
+  - cc_rsyslog: Escape possible nested set [Daniel Watkins] (LP: #1816967)
+  - Enable encrypted_data_bag_secret support for Chef
+[Eric Williams] (LP: #1817082)
+  - azure: Filter list of ssh keys pulled from fabric [Jason Zions (MSFT)]
+  - doc: update merging doc with fixes and some additional details/examples
+  - tests: integration test failure summary to use traceback if empty error
+  - This is to fix https://bugs.launchpad.net/cloud-init/+bug/1812676
+[Vitaly Kuznetsov]
+  - EC2: Rewrite network config on AWS Classic instances every boot
+[Guilherme G. Piccoli] (LP: #1802073)
+  - netinfo: Adjust ifconfig output parsing for FreeBSD i

[Cloud-init-dev] [Merge] ~chad.smith/cloud-init:ubuntu/xenial into cloud-init:ubuntu/xenial

2019-05-10 Thread Chad Smith
The proposal to merge ~chad.smith/cloud-init:ubuntu/xenial into 
cloud-init:ubuntu/xenial has been updated.

Commit message changed to:

new upstream snapshot for SRU into xenial..

QUESTION: we changed ubuntu-advantage cloud config module in an incompatible 
way on expectation that new ubuntu-advantage-tools would be released before 
cloud-init SRU completes. How do we want to resolve this, I've suggested 
reverting all upstream ubuntu advantage changes with a reverse patch (just 
cc_ubuntu_advantage.py and it's test file)


That is contained in this branch with
debian/patches/ubuntu-advantage-revert-tip.patch

For more details, see:
https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/367297
-- 
Your team cloud-init commiters is requested to review the proposed merge of 
~chad.smith/cloud-init:ubuntu/xenial into cloud-init:ubuntu/xenial.

___
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] ~chad.smith/cloud-init:ubuntu/xenial into cloud-init:ubuntu/xenial

2019-05-10 Thread Chad Smith
Chad Smith has proposed merging ~chad.smith/cloud-init:ubuntu/xenial into 
cloud-init:ubuntu/xenial.

Commit message:
new upstream snapshot for SRU into xenial..

QUESTION: we changed ubuntu-advantage cloud config module in an incompatible 
way on expectation that new ubuntu-advantage-tools would be released before 
cloud-init SRU completes. How do we want to resolve this? Don't pull in those 
changes yet?

Requested reviews:
  cloud-init commiters (cloud-init-dev)
Related bugs:
  Bug #1825596 in cloud-init: "Azure reboot with unformatted ephemeral drive 
won't mount reformatted volume"
  https://bugs.launchpad.net/cloud-init/+bug/1825596
  Bug #1828479 in cloud-init: "Release 19.1"
  https://bugs.launchpad.net/cloud-init/+bug/1828479

For more details, see:
https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/367297
-- 
Your team cloud-init commiters is requested to review the proposed merge of 
~chad.smith/cloud-init:ubuntu/xenial into cloud-init:ubuntu/xenial.
diff --git a/ChangeLog b/ChangeLog
index 8fa6fdd..bf48fd4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,120 @@
+19.1:
+  - freebsd: add chpasswd pkg in the image [Gonéri Le Bouder]
+  - tests: add Eoan release [Paride Legovini]
+  - cc_mounts: check if mount -a on no-change fstab path
+[Jason Zions (MSFT)] (LP: #1825596)
+  - replace remaining occurrences of LOG.warn [Daniel Watkins]
+  - DataSourceAzure: Adjust timeout for polling IMDS [Anh Vo]
+  - Azure: Changes to the Hyper-V KVP Reporter [Anh Vo]
+  - git tests: no longer show warning about safe yaml.
+  - tools/read-version: handle errors [Chad Miller]
+  - net/sysconfig: only indicate available on known sysconfig distros
+(LP: #1819994)
+  - packages: update rpm specs for new bash completion path
+[Daniel Watkins] (LP: #1825444)
+  - test_azure: mock util.SeLinuxGuard where needed
+[Jason Zions (MSFT)] (LP: #1825253)
+  - setup.py: install bash completion script in new location [Daniel Watkins]
+  - mount_cb: do not pass sync and rw options to mount
+[Gonéri Le Bouder] (LP: #1645824)
+  - cc_apt_configure: fix typo in apt documentation [Dominic Schlegel]
+  - Revert "DataSource: move update_events from a class to an instance..."
+[Daniel Watkins]
+  - Change DataSourceNoCloud to ignore file system label's case.
+[Risto Oikarinen]
+  - cmd:main.py: Fix missing 'modules-init' key in modes dict
+[Antonio Romito] (LP: #1815109)
+  - ubuntu_advantage: rewrite cloud-config module
+  - Azure: Treat _unset network configuration as if it were absent
+[Jason Zions (MSFT)] (LP: #1823084)
+  - DatasourceAzure: add additional logging for azure datasource [Anh Vo]
+  - cloud_tests: fix apt_pipelining test-cases
+  - Azure: Ensure platform random_seed is always serializable as JSON.
+[Jason Zions (MSFT)]
+  - net/sysconfig: write out SUSE-compatible IPv6 config [Robert Schweikert]
+  - tox: Update testenv for openSUSE Leap to 15.0 [Thomas Bechtold]
+  - net: Fix ipv6 static routes when using eni renderer
+[Raphael Glon] (LP: #1818669)
+  - Add ubuntu_drivers config module [Daniel Watkins]
+  - doc: Refresh Azure walinuxagent docs [Daniel Watkins]
+  - tox: bump pylint version to latest (2.3.1) [Daniel Watkins]
+  - DataSource: move update_events from a class to an instance attribute
+[Daniel Watkins] (LP: #1819913)
+  - net/sysconfig: Handle default route setup for dhcp configured NICs
+[Robert Schweikert] (LP: #1812117)
+  - DataSourceEc2: update RELEASE_BLOCKER to be more accurate
+[Daniel Watkins]
+  - cloud-init-per: POSIX sh does not support string subst, use sed
+(LP: #1819222)
+  - Support locking user with usermod if passwd is not available.
+  - Example for Microsoft Azure data disk added. [Anton Olifir]
+  - clean: correctly determine the path for excluding seed directory
+[Daniel Watkins] (LP: #1818571)
+  - helpers/openstack: Treat unknown link types as physical
+[Daniel Watkins] (LP: #1639263)
+  - drop Python 2.6 support and our NIH version detection [Daniel Watkins]
+  - tip-pylint: Fix assignment-from-return-none errors
+  - net: append type:dhcp[46] only if dhcp[46] is True in v2 netconfig
+[Kurt Stieger] (LP: #1818032)
+  - cc_apt_pipelining: stop disabling pipelining by default
+[Daniel Watkins] (LP: #1794982)
+  - tests: fix some slow tests and some leaking state [Daniel Watkins]
+  - util: don't determine string_types ourselves [Daniel Watkins]
+  - cc_rsyslog: Escape possible nested set [Daniel Watkins] (LP: #1816967)
+  - Enable encrypted_data_bag_secret support for Chef
+[Eric Williams] (LP: #1817082)
+  - azure: Filter list of ssh keys pulled from fabric [Jason Zions (MSFT)]
+  - doc: update merging doc with fixes and some additional details/examples
+  - tests: integration test failure summary to use traceback if empty error
+  - This is to fix https://bugs.launchpad.net/cloud-init/+bug/1812676
+[Vitaly Kuznetsov]
+  - EC2: Rewrite network c

[Cloud-init-dev] [Merge] ~chad.smith/cloud-init:release/19.1 into cloud-init:master

2019-05-09 Thread Chad Smith
Chad Smith has proposed merging ~chad.smith/cloud-init:release/19.1 into 
cloud-init:master.

Commit message:
Release 19.1

Bump the version on cloudinit/version.py to be 19.1 and update ChangeLog

LP: #1828479

Requested reviews:
  cloud-init commiters (cloud-init-dev)
Related bugs:
  Bug #1828479 in cloud-init: "Release 19.1"
  https://bugs.launchpad.net/cloud-init/+bug/1828479

For more details, see:
https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/367228
-- 
Your team cloud-init commiters is requested to review the proposed merge of 
~chad.smith/cloud-init:release/19.1 into cloud-init:master.
diff --git a/ChangeLog b/ChangeLog
index 8fa6fdd..bf48fd4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,120 @@
+19.1:
+  - freebsd: add chpasswd pkg in the image [Gonéri Le Bouder]
+  - tests: add Eoan release [Paride Legovini]
+  - cc_mounts: check if mount -a on no-change fstab path
+[Jason Zions (MSFT)] (LP: #1825596)
+  - replace remaining occurrences of LOG.warn [Daniel Watkins]
+  - DataSourceAzure: Adjust timeout for polling IMDS [Anh Vo]
+  - Azure: Changes to the Hyper-V KVP Reporter [Anh Vo]
+  - git tests: no longer show warning about safe yaml.
+  - tools/read-version: handle errors [Chad Miller]
+  - net/sysconfig: only indicate available on known sysconfig distros
+(LP: #1819994)
+  - packages: update rpm specs for new bash completion path
+[Daniel Watkins] (LP: #1825444)
+  - test_azure: mock util.SeLinuxGuard where needed
+[Jason Zions (MSFT)] (LP: #1825253)
+  - setup.py: install bash completion script in new location [Daniel Watkins]
+  - mount_cb: do not pass sync and rw options to mount
+[Gonéri Le Bouder] (LP: #1645824)
+  - cc_apt_configure: fix typo in apt documentation [Dominic Schlegel]
+  - Revert "DataSource: move update_events from a class to an instance..."
+[Daniel Watkins]
+  - Change DataSourceNoCloud to ignore file system label's case.
+[Risto Oikarinen]
+  - cmd:main.py: Fix missing 'modules-init' key in modes dict
+[Antonio Romito] (LP: #1815109)
+  - ubuntu_advantage: rewrite cloud-config module
+  - Azure: Treat _unset network configuration as if it were absent
+[Jason Zions (MSFT)] (LP: #1823084)
+  - DatasourceAzure: add additional logging for azure datasource [Anh Vo]
+  - cloud_tests: fix apt_pipelining test-cases
+  - Azure: Ensure platform random_seed is always serializable as JSON.
+[Jason Zions (MSFT)]
+  - net/sysconfig: write out SUSE-compatible IPv6 config [Robert Schweikert]
+  - tox: Update testenv for openSUSE Leap to 15.0 [Thomas Bechtold]
+  - net: Fix ipv6 static routes when using eni renderer
+[Raphael Glon] (LP: #1818669)
+  - Add ubuntu_drivers config module [Daniel Watkins]
+  - doc: Refresh Azure walinuxagent docs [Daniel Watkins]
+  - tox: bump pylint version to latest (2.3.1) [Daniel Watkins]
+  - DataSource: move update_events from a class to an instance attribute
+[Daniel Watkins] (LP: #1819913)
+  - net/sysconfig: Handle default route setup for dhcp configured NICs
+[Robert Schweikert] (LP: #1812117)
+  - DataSourceEc2: update RELEASE_BLOCKER to be more accurate
+[Daniel Watkins]
+  - cloud-init-per: POSIX sh does not support string subst, use sed
+(LP: #1819222)
+  - Support locking user with usermod if passwd is not available.
+  - Example for Microsoft Azure data disk added. [Anton Olifir]
+  - clean: correctly determine the path for excluding seed directory
+[Daniel Watkins] (LP: #1818571)
+  - helpers/openstack: Treat unknown link types as physical
+[Daniel Watkins] (LP: #1639263)
+  - drop Python 2.6 support and our NIH version detection [Daniel Watkins]
+  - tip-pylint: Fix assignment-from-return-none errors
+  - net: append type:dhcp[46] only if dhcp[46] is True in v2 netconfig
+[Kurt Stieger] (LP: #1818032)
+  - cc_apt_pipelining: stop disabling pipelining by default
+[Daniel Watkins] (LP: #1794982)
+  - tests: fix some slow tests and some leaking state [Daniel Watkins]
+  - util: don't determine string_types ourselves [Daniel Watkins]
+  - cc_rsyslog: Escape possible nested set [Daniel Watkins] (LP: #1816967)
+  - Enable encrypted_data_bag_secret support for Chef
+[Eric Williams] (LP: #1817082)
+  - azure: Filter list of ssh keys pulled from fabric [Jason Zions (MSFT)]
+  - doc: update merging doc with fixes and some additional details/examples
+  - tests: integration test failure summary to use traceback if empty error
+  - This is to fix https://bugs.launchpad.net/cloud-init/+bug/1812676
+[Vitaly Kuznetsov]
+  - EC2: Rewrite network config on AWS Classic instances every boot
+[Guilherme G. Piccoli] (LP: #1802073)
+  - netinfo: Adjust ifconfig output parsing for FreeBSD ipv6 entries
+(LP: #1779672)
+  - netplan: Don't render yaml aliases when dumping netplan (LP: #1815051)
+  - add PyCharm IDE .idea/ path to .gitignore [Dominic Schlegel]
+  - correct grammar issue in instance metadata documen

Re: [Cloud-init-dev] [Merge] ~powersj/cloud-init:feature/cc-uaclient into cloud-init:master

2019-04-04 Thread Chad Smith
Validated error and success behaviors on both containers and kvm with

#cloud-config
ubuntu_advantage:
  token: 
  enable: [livepatch]
write_files:
- encoding: b64
  content: |
IyBVYnVudHUtQWR2YW50YWdlIGNsaWVudCBjb25maWcgZmlsZS4Kc3NvX2F1dGhfdXJsOiAnaHR0
cHM6Ly9sb2dpbi51YnVudHUuY29tJwpjb250cmFjdF91cmw6ICdodHRwczovL2NvbnRyYWN0cy5z
dGFnaW5nLmNhbm9uaWNhbC5jb20nCmRhdGFfZGlyOiAvdmFyL2xpYi91YnVudHUtYWR2YW50YWdl
CmxvZ19sZXZlbDogaW5mbwpsb2dfZmlsZTogL3Zhci9sb2cvdWJ1bnR1LWFkdmFudGFnZS5sb2cK
  path: /etc/ubuntu-advantage/uaclient.conf

-- 
https://code.launchpad.net/~powersj/cloud-init/+git/cloud-init/+merge/365549
Your team cloud-init commiters is requested to review the proposed merge of 
~powersj/cloud-init:feature/cc-uaclient 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] ~powersj/cloud-init:feature/cc-uaclient into cloud-init:master

2019-04-04 Thread Chad Smith
The proposal to merge ~powersj/cloud-init:feature/cc-uaclient into 
cloud-init:master has been updated.

Commit message changed to:

ubuntu_advantage: rewrite cloud-config module

ubuntu-advantage-tools version 19 has a different command line
interface. Update cloud-init's config module to accept new
ubuntu_advantage configuration settings.

* Underscores better than hyphens: deprecate 'ubuntu-advantage'
  cloud-config key in favor of 'ubuntu_advantage'
* Attach machines with either sso credentials of UA user_token
* Services are enabled by name though an 'enable' list
* Raise warnings if deprecated ubuntu-advantage config keys are
  present, or errors if its config we cannott adapt to

Ubuntu Advantage support can now be configured via #cloud-config
with the following yaml:

ubuntu_advantage:
  token: 'thisismyubuntuadvantagetoken'
  enable: [esm, fips, livepatch]

Author: Chad Smith 
Co-Authored-By: Daniel Watkins 

For more details, see:
https://code.launchpad.net/~powersj/cloud-init/+git/cloud-init/+merge/365549
-- 
Your team cloud-init commiters is requested to review the proposed merge of 
~powersj/cloud-init:feature/cc-uaclient 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] ~powersj/cloud-init:feature/cc-uaclient into cloud-init:master

2019-04-04 Thread Chad Smith
The proposal to merge ~powersj/cloud-init:feature/cc-uaclient into 
cloud-init:master has been updated.

Commit message changed to:

ubuntu_advantage: rewrite cloud-config module

ubuntu-advantage-tools version 19 has a different command line
interface. Update cloud-init's config module to accept new
ubuntu_advantage configuration settings.

* Underscores better than hyphens: deprecate 'ubuntu-advantage'
  cloud-config key in favor of 'ubuntu_advantage'
* Attach machines with either sso credentials of UA user_token
* Services are enabled by name though an 'enable' list
* Raise warnings if deprecated ubuntu-advantage config keys are
  present, or errors if its config we cannott adapt to

Ubuntu Advantage support can now be configured via #cloud-config
with the following yaml:

ubuntu_advantage:
  token: 'thisismyubuntuadvantagetoken'
  enable: [esm, fips, livepatch]

Co-Authored-By: Daniel Watkins 
Author: Chad Smith 

For more details, see:
https://code.launchpad.net/~powersj/cloud-init/+git/cloud-init/+merge/365549
-- 
Your team cloud-init commiters is requested to review the proposed merge of 
~powersj/cloud-init:feature/cc-uaclient 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] ~powersj/cloud-init:feature/cc-uaclient into cloud-init:master

2019-04-04 Thread Chad Smith
The proposal to merge ~powersj/cloud-init:feature/cc-uaclient into 
cloud-init:master has been updated.

Commit message changed to:

ubuntu_advantage: rewrite cloud-config module

ubuntu-advantage-tools version 19 has a different command line
interface. Update cloud-init's config module to accept new
ubuntu_advantage configuration settings.

* Underscores better than hyphens: deprecate 'ubuntu-advantage'
  cloud-config key in favor of 'ubuntu_advantage'
* Attach machines with either sso credentials of UA user_token
* Services are enabled by name though an 'enable' list
* Raise warnings if deprecated ubuntu-advantage config keys are
  present, or errors if its config we cannot adapt to

Ubuntu Advantage support can now be configured via #cloud-config
with the following yaml:

ubuntu_advantage:
  token: 'thisismyubuntuadvantagetoken'
  enable: [esm, fips, livepatch]

Author: Chad Smith 

For more details, see:
https://code.launchpad.net/~powersj/cloud-init/+git/cloud-init/+merge/365549
-- 
Your team cloud-init commiters is requested to review the proposed merge of 
~powersj/cloud-init:feature/cc-uaclient 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] ~daniel-thewatkins/cloud-init/+git/cloud-init:feature/cc-uaclient into cloud-init:master

2019-04-01 Thread Chad Smith
This looks good Dan, I have a couple of comments inline.

lOne thing I think this lacks for our ability to test is the ability to adapt 
ua client configuration to point to contracts.staging.canonical.com

This could be resolved by making sure we provide a #cloud-config like the 
following, though I expect we'll need to base64 encode the "content" value.


write_files:
-   content: |
# ua-contracts staging config
sso_auth_url: 'https://login.ubuntu.com'
contract_url: 'https://contracts.staging.canonical.com'
data_dir: /var/lib/ubuntu-advantage
log_level: info
log_file: /var/log/ubuntu-advantage.log
path: /etc/ubuntu-advantage/uaclient.conf

Diff comments:

> diff --git a/cloudinit/config/cc_ubuntu_advantage.py 
> b/cloudinit/config/cc_ubuntu_advantage.py
> index 5e082bd..9732ffa 100644
> --- a/cloudinit/config/cc_ubuntu_advantage.py
> +++ b/cloudinit/config/cc_ubuntu_advantage.py
> @@ -1,150 +1,125 @@
> -# Copyright (C) 2018 Canonical Ltd.
> -#
>  # This file is part of cloud-init. See LICENSE file for license information.
>  
> -"""Ubuntu advantage: manage ubuntu-advantage offerings from Canonical."""
> +"""ubuntu_advantage: Configure Ubuntu Advantage support entitlements"""
>  
> -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 import log as logging
>  from cloudinit.settings import PER_INSTANCE
> -from cloudinit.subp import prepend_base_command
>  from cloudinit import util
>  
>  
> -distros = ['ubuntu']
> -frequency = PER_INSTANCE
> +UA_URL = 'https://ubuntu.com/advantage'
>  
> -LOG = logging.getLogger(__name__)
> +distros = ['ubuntu']
>  
>  schema = {
>  'id': 'cc_ubuntu_advantage',
>  'name': 'Ubuntu Advantage',
> -'title': 'Install, configure and manage ubuntu-advantage offerings',
> +'title': 'Configure Ubuntu Advantage support entitlements',
>  'description': dedent("""\
> -This module provides configuration options to setup ubuntu-advantage
> -subscriptions.
> -
> -.. note::
> -Both ``commands`` value can be either a dictionary or a list. If
> -the configuration provided is a dictionary, the keys are only 
> used
> -to order the execution of the commands and the dictionary is
> -merged with any vendor-data ubuntu-advantage configuration
> -provided. If a ``commands`` is provided as a list, any 
> vendor-data
> -ubuntu-advantage ``commands`` are ignored.
> -
> -Ubuntu-advantage ``commands`` is a dictionary or list of
> -ubuntu-advantage commands to run on the deployed machine.
> -These commands can be used to enable or disable subscriptions to
> -various ubuntu-advantage products. See 'man ubuntu-advantage' for 
> more
> -information on supported subcommands.
> -
> -.. note::
> -   Each command item can be a string or list. If the item is a list,
> -   'ubuntu-advantage' can be omitted and it will automatically be
> -   inserted as part of the command.
> +Attach machine to an existing Ubuntu Advantage support contract and
> +enable or disable support entitlements such as livepatch, ESM,

Livepatch is capitalized. I think we probably should mention Common Criteria 
(doc reference https://docs.ubuntu.com/security-certs/en/cc-16). As far as I 
know cis-audit may not make it in this release so might want to omit that.

> +FIPS, FIPS Updates and CIS Audit tools. When attaching a machine to
> +Ubuntu Advantage, one can also specify entitlements to
> +enable.  When the 'entitlements' list is present, any named 
> entitlement
> +will be enabled and all absent entitlements will remain disabled.
> +
> +Note that when enabling FIPS or FIPS updates you will need to 
> schedule
> +a reboot to ensure the machine is running the FIPS-compliant kernel.
> +See :ref:`Power State Change` for information on how to configure
> +cloud-init to perform this reboot.
>  """),
>  'distros': distros,
>  'examples': [dedent("""\
> -# Enable Extended Security Maintenance using your service auth token
> +# Attach the machine to a Ubuntu Advantage support contract with a
> +# UA user token obtained from %s.
> +ubuntu_advantage:
> +  token: 

It is officially called a UA contact token, and currently should be obtained 
from UA_URL = auth.contracts.canonical.com but I *think* ubuntu.com/advantage 
should redirect or reference that once the service is public. Anyway it's the 
text we point uaclient users at as well so it's probably good as is

> +""" % UA_URL), dedent("""\
> +# Attach the machine to an Ubuntu Advantage support contract enabling
> +# only fips and esm entitlements. Entitlements 

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

2019-03-29 Thread Chad Smith
Dan will be taking over this branch as I am working exclusively on UA client 
for the near term.

Items to fix/consider:
 -  drop sso_* keys as timing of install won't pass 2FA since the 2fa code will 
likely change before the machine is configured
 -  add a 'config' key under ubuntu-advantage to allow setting configuration 
options in /etc/ubuntu-advantage/uaclient.conf per 
https://github.com/CanonicalLtd/ubuntu-advantage-client/issues/226

Diff comments:

> diff --git a/cloudinit/config/cc_ubuntu_advantage.py 
> b/cloudinit/config/cc_ubuntu_advantage.py
> index 5e082bd..1a95766 100644
> --- a/cloudinit/config/cc_ubuntu_advantage.py
> +++ b/cloudinit/config/cc_ubuntu_advantage.py
> @@ -1,145 +1,170 @@
> -# Copyright (C) 2018 Canonical Ltd.
> -#
>  # This file is part of cloud-init. See LICENSE file for license information.
>  
> -"""Ubuntu advantage: manage ubuntu-advantage offerings from Canonical."""
> +"""ubuntu_advantage: Configure Ubuntu Advantage support entitlements"""
>  
> -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 import log as logging
>  from cloudinit.settings import PER_INSTANCE
> -from cloudinit.subp import prepend_base_command
>  from cloudinit import util
>  
>  
> -distros = ['ubuntu']
> -frequency = PER_INSTANCE
> +UA_URL = 'https://ubuntu.com/advantage'
>  
> -LOG = logging.getLogger(__name__)
> +distros = ['ubuntu']
>  
>  schema = {
>  'id': 'cc_ubuntu_advantage',
> -'name': 'Ubuntu Advantage',
> -'title': 'Install, configure and manage ubuntu-advantage offerings',
> +'name': 'UbuntuAdvantage',
> +'title': 'Configure Ubuntu Advantage support entitlements',
>  'description': dedent("""\
> -This module provides configuration options to setup ubuntu-advantage
> -subscriptions.
> -
> -.. note::
> -Both ``commands`` value can be either a dictionary or a list. If
> -the configuration provided is a dictionary, the keys are only 
> used
> -to order the execution of the commands and the dictionary is
> -merged with any vendor-data ubuntu-advantage configuration
> -provided. If a ``commands`` is provided as a list, any 
> vendor-data
> -ubuntu-advantage ``commands`` are ignored.
> -
> -Ubuntu-advantage ``commands`` is a dictionary or list of
> -ubuntu-advantage commands to run on the deployed machine.
> -These commands can be used to enable or disable subscriptions to
> -various ubuntu-advantage products. See 'man ubuntu-advantage' for 
> more
> -information on supported subcommands.
> -
> -.. note::
> -   Each command item can be a string or list. If the item is a list,
> -   'ubuntu-advantage' can be omitted and it will automatically be
> -   inserted as part of the command.
> +Attach machine to an existing Ubuntu Advantage support contract and
> +enable or disable support entitlements such as livepatch, ESM,
> +FIPS, FIPS Updates and CIS Audit tools. When attaching a machine to
> +Advantage, one can either specify explicit entitlements to enable or
> +rely on the entitlement default behavior. When no 'entitlements' list
> +is provided, the default behavior enables both livepatch and esm on
> +supported Ubuntu environments.
> +When 'entitlements' list is present, any named entitlement will be
> +enabled and all absent entitlements will remain disabled.
> +Note when enabling FIPS or FIPS updates a reboot will occur after
> +installation completes to ensure the machine is running the
> +FIPS-compliant kernel.
>  """),
>  'distros': distros,
>  'examples': [dedent("""\
> -# Enable Extended Security Maintenance using your service auth token
> -ubuntu-advantage:
> -commands:
> -  00: ubuntu-advantage enable-esm 
> +# Attach the machine to a Ubuntu Advantage support contract with a
> +# UA user token obtained from %s.
> +# Default entitlemtents such as livepatch and esm will automatically
> +# be enabled after detachment because no entitlements were specified.
> +ubuntu_advantage:
> +  token: 
> +""" % UA_URL), dedent("""\
> +# Attach the machine to an Ubuntu Advantage support contract using
> +# Ubuntu SSO with optional two-factor authentication. Default
> +# entitlements such as livepatch and esm will be enabled if 
> applicable.
> +ubuntu_advantage:
> +  sso_email: 
> +  sso_password: 
> +  sso_twofactor: <2fa_code>  # if the sso account requires 2fa

Agreed. we should drop all 2FA because of that timeout/rollover with 2fa likely 
not being met by the time the machine is installed and up.

>  

[Cloud-init-dev] [Merge] ~chad.smith/cloud-init:bug/drop-deprecated-snap-modules into cloud-init:master

2019-02-04 Thread Chad Smith
Chad Smith has proposed merging 
~chad.smith/cloud-init:bug/drop-deprecated-snap-modules into cloud-init:master.

Commit message:
snap_config/snappy: Drop deprecated cloud-config modules

Both snap_config and snappy modules have been deprecated in 18.3.
We should have dropped deprecated modules in that timeframe as the
functionality is replaced by the snap module and a commands element.

Cloud-config that used to provided snappy assertions and configuration
can now instead use the top-level snap: and assertions or commands.

Detailed docs here:
   https://cloudinit.readthedocs.io/en/latest/topics/modules.html#snap

LP: #1814296


Requested reviews:
  cloud-init commiters (cloud-init-dev)
Related bugs:
  Bug #1814296 in cloud-init: "ubuntu-core: snappy supported or not?"
  https://bugs.launchpad.net/cloud-init/+bug/1814296

For more details, see:
https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/362691
-- 
Your team cloud-init commiters is requested to review the proposed merge of 
~chad.smith/cloud-init:bug/drop-deprecated-snap-modules into cloud-init:master.
diff --git a/cloudinit/config/cc_snap_config.py b/cloudinit/config/cc_snap_config.py
deleted file mode 100644
index afe297e..000
--- a/cloudinit/config/cc_snap_config.py
+++ /dev/null
@@ -1,184 +0,0 @@
-# Copyright (C) 2016 Canonical Ltd.
-#
-# Author: Ryan Harper 
-#
-# This file is part of cloud-init. See LICENSE file for license information.
-
-# RELEASE_BLOCKER: Remove this deprecated module in 18.3
-"""
-Snap Config

-**Summary:** snap_config modules allows configuration of snapd.
-
-**Deprecated**: Use :ref:`snap` module instead. This module will not exist
-in cloud-init 18.3.
-
-This module uses the same ``snappy`` namespace for configuration but
-acts only only a subset of the configuration.
-
-If ``assertions`` is set and the user has included a list of assertions
-then cloud-init will collect the assertions into a single assertion file
-and invoke ``snap ack `` which will attempt
-to load the provided assertions into the snapd assertion database.
-
-If ``email`` is set, this value is used to create an authorized user for
-contacting and installing snaps from the Ubuntu Store.  This is done by
-calling ``snap create-user`` command.
-
-If ``known`` is set to True, then it is expected the user also included
-an assertion of type ``system-user``.  When ``snap create-user`` is called
-cloud-init will append '--known' flag which instructs snapd to look for
-a system-user assertion with the details.  If ``known`` is not set, then
-``snap create-user`` will contact the Ubuntu SSO for validating and importing
-a system-user for the instance.
-
-.. note::
-If the system is already managed, then cloud-init will not attempt to
-create a system-user.
-
-**Internal name:** ``cc_snap_config``
-
-**Module frequency:** per instance
-
-**Supported distros:** any with 'snapd' available
-
-**Config keys**::
-
-#cloud-config
-snappy:
-assertions:
-- |
-
-- |
-
-email: u...@user.org
-known: true
-
-"""
-
-from cloudinit import log as logging
-from cloudinit.settings import PER_INSTANCE
-from cloudinit import util
-
-LOG = logging.getLogger(__name__)
-
-frequency = PER_INSTANCE
-SNAPPY_CMD = "snap"
-ASSERTIONS_FILE = "/var/lib/cloud/instance/snapd.assertions"
-
-
-"""
-snappy:
-  assertions:
-  - |
-  
-  - |
-  
-  email: f...@foo.io
-  known: true
-"""
-
-
-def add_assertions(assertions=None):
-"""Import list of assertions.
-
-Import assertions by concatenating each assertion into a
-string separated by a '\n'.  Write this string to a instance file and
-then invoke `snap ack /path/to/file` and check for errors.
-If snap exits 0, then all assertions are imported.
-"""
-if not assertions:
-assertions = []
-
-if not isinstance(assertions, list):
-raise ValueError(
-'assertion parameter was not a list: {assertions}'.format(
-assertions=assertions))
-
-snap_cmd = [SNAPPY_CMD, 'ack']
-combined = "\n".join(assertions)
-if len(combined) == 0:
-raise ValueError("Assertion list is empty")
-
-for asrt in assertions:
-LOG.debug('Acking: %s', asrt.split('\n')[0:2])
-
-util.write_file(ASSERTIONS_FILE, combined.encode('utf-8'))
-util.subp(snap_cmd + [ASSERTIONS_FILE], capture=True)
-
-
-def add_snap_user(cfg=None):
-"""Add a snap system-user if provided with email under snappy config.
-
-  - Check that system is not already managed.
-  - Check that if using a system-user assertion, that it's
-imported into snapd.
-
-Returns a dictionary to be passed to Distro.create_user
-"""
-
-if not cfg:
-cfg = {}
-
-if not isinstance(cfg, dic

[Cloud-init-dev] [Merge] ~chad.smith/cloud-init:ubuntu/xenial into cloud-init:ubuntu/xenial

2019-01-28 Thread Chad Smith
Chad Smith has proposed merging ~chad.smith/cloud-init:ubuntu/xenial into 
cloud-init:ubuntu/xenial.

Commit message:
new upstream snapshot fixing intermittent unittest failure on opennebula. SRU 
into xenial


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

For more details, see:
https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/362367
-- 
Your team cloud-init commiters is requested to review the proposed merge of 
~chad.smith/cloud-init:ubuntu/xenial into cloud-init:ubuntu/xenial.
___
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] ~chad.smith/cloud-init:ubuntu/cosmic into cloud-init:ubuntu/cosmic

2019-01-28 Thread Chad Smith
Chad Smith has proposed merging ~chad.smith/cloud-init:ubuntu/cosmic into 
cloud-init:ubuntu/cosmic.

Commit message:
new upstream snapshot to fix intermittent unittest failure on opennebule. SRU 
into cosmic

Requested reviews:
  cloud-init commiters (cloud-init-dev)
Related bugs:
  Bug #1799540 in cloud-init: "ONBOOT not supported in SUSE distros"
  https://bugs.launchpad.net/cloud-init/+bug/1799540
  Bug #1813641 in cloud-init: "cloud-init on Disco, opennebula will 
intermittently fail unittests "
  https://bugs.launchpad.net/cloud-init/+bug/1813641

For more details, see:
https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/362366
-- 
Your team cloud-init commiters is requested to review the proposed merge of 
~chad.smith/cloud-init:ubuntu/cosmic into cloud-init:ubuntu/cosmic.
diff --git a/cloudinit/config/cc_rh_subscription.py b/cloudinit/config/cc_rh_subscription.py
index edee01e..28c79b8 100644
--- a/cloudinit/config/cc_rh_subscription.py
+++ b/cloudinit/config/cc_rh_subscription.py
@@ -249,14 +249,14 @@ class SubscriptionManager(object):
 except util.ProcessExecutionError as e:
 if e.stdout.rstrip() != '':
 for line in e.stdout.split("\n"):
-if line is not '':
+if line != '':
 self.log_warn(line)
 else:
 self.log_warn("Setting the service level failed with: "
   "{0}".format(e.stderr.strip()))
 return False
 for line in return_out.split("\n"):
-if line is not "":
+if line != "":
 self.log.debug(line)
 return True
 
@@ -268,7 +268,7 @@ class SubscriptionManager(object):
 self.log_warn("Auto-attach failed with: {0}".format(e))
 return False
 for line in return_out.split("\n"):
-if line is not "":
+if line != "":
 self.log.debug(line)
 return True
 
diff --git a/cloudinit/net/sysconfig.py b/cloudinit/net/sysconfig.py
index fd8e501..19b3e60 100644
--- a/cloudinit/net/sysconfig.py
+++ b/cloudinit/net/sysconfig.py
@@ -273,6 +273,7 @@ class Renderer(renderer.Renderer):
 ('USERCTL', False),
 ('NM_CONTROLLED', False),
 ('BOOTPROTO', 'none'),
+('STARTMODE', 'auto'),
 ])
 
 # If these keys exist, then their values will be used to form
@@ -367,6 +368,7 @@ class Renderer(renderer.Renderer):
   iface_cfg.name))
 if subnet.get('control') == 'manual':
 iface_cfg['ONBOOT'] = False
+iface_cfg['STARTMODE'] = 'manual'
 
 # set IPv4 and IPv6 static addresses
 ipv4_index = -1
diff --git a/cloudinit/sources/DataSourceOpenNebula.py b/cloudinit/sources/DataSourceOpenNebula.py
index 6e1d04b..02c9a7b 100644
--- a/cloudinit/sources/DataSourceOpenNebula.py
+++ b/cloudinit/sources/DataSourceOpenNebula.py
@@ -337,7 +337,9 @@ def parse_shell_config(content, keylist=None, bash=None, asuser=None,
 (output, _error) = util.subp(cmd, data=bcmd)
 
 # exclude vars in bash that change on their own or that we used
-excluded = ("EPOCHREALTIME", "RANDOM", "LINENO", "SECONDS", "_", "__v")
+excluded = (
+"EPOCHREALTIME", "EPOCHSECONDS", "RANDOM", "LINENO", "SECONDS", "_",
+"__v")
 preset = {}
 ret = {}
 target = None
diff --git a/debian/changelog b/debian/changelog
index f5bb1fa..4ba478b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,6 +1,18 @@
-cloud-init (18.5-17-gd1a2fe73-0ubuntu1~18.10.1) cosmic; urgency=medium
+cloud-init (18.5-21-g8ee294d5-0ubuntu1~18.10.1) cosmic; urgency=medium
 
   * New upstream snapshot. (LP: #1813346)
+- opennebula: also exclude epochseconds from changed environment vars
+- systemd: Render generator from template to account for system
+  differences. [Robert Schweikert]
+- sysconfig: On SUSE, use STARTMODE instead of ONBOOT [Robert Schweikert]
+- flake8: use ==/!= to compare str, bytes, and int literals
+  [Paride Legovini]
+
+ -- Chad Smith   Mon, 28 Jan 2019 20:19:18 -0700
+
+cloud-init (18.5-17-gd1a2fe73-0ubuntu1~18.10.1) cosmic; urgency=medium
+
+  * New upstream snapshot.
 - opennebula: exclude EPOCHREALTIME as known bash env variable with a
   delta
 - tox: fix disco httpretty dependencies for py37
diff --git a/setup.py b/setup.py
index ea37efc..186e215 100755
--- a/setup.py
+++ b/setup.py
@@ -30,6 +30,8 @@ VARIANT = None
 def is_f(p):
 return os.path.isfile(p)
 
+def is_generator(p):
+return '-generator' in p
 
 def tiny_p(cmd, capture=True):
 # Darn python 2.6 doesn't have check

[Cloud-init-dev] [Merge] ~chad.smith/cloud-init:ubuntu/bionic into cloud-init:ubuntu/bionic

2019-01-28 Thread Chad Smith
Chad Smith has proposed merging ~chad.smith/cloud-init:ubuntu/bionic into 
cloud-init:ubuntu/bionic.

Commit message:
new upstream snapshot to pull in intermittent unittest fix for OpenNebula for 
SRU into bionic.

Requested reviews:
  cloud-init commiters (cloud-init-dev)
Related bugs:
  Bug #1799540 in cloud-init: "ONBOOT not supported in SUSE distros"
  https://bugs.launchpad.net/cloud-init/+bug/1799540
  Bug #1813641 in cloud-init: "cloud-init on Disco, opennebula will 
intermittently fail unittests "
  https://bugs.launchpad.net/cloud-init/+bug/1813641

For more details, see:
https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/362365
-- 
Your team cloud-init commiters is requested to review the proposed merge of 
~chad.smith/cloud-init:ubuntu/bionic into cloud-init:ubuntu/bionic.
diff --git a/cloudinit/config/cc_rh_subscription.py b/cloudinit/config/cc_rh_subscription.py
index edee01e..28c79b8 100644
--- a/cloudinit/config/cc_rh_subscription.py
+++ b/cloudinit/config/cc_rh_subscription.py
@@ -249,14 +249,14 @@ class SubscriptionManager(object):
 except util.ProcessExecutionError as e:
 if e.stdout.rstrip() != '':
 for line in e.stdout.split("\n"):
-if line is not '':
+if line != '':
 self.log_warn(line)
 else:
 self.log_warn("Setting the service level failed with: "
   "{0}".format(e.stderr.strip()))
 return False
 for line in return_out.split("\n"):
-if line is not "":
+if line != "":
 self.log.debug(line)
 return True
 
@@ -268,7 +268,7 @@ class SubscriptionManager(object):
 self.log_warn("Auto-attach failed with: {0}".format(e))
 return False
 for line in return_out.split("\n"):
-if line is not "":
+if line != "":
 self.log.debug(line)
 return True
 
diff --git a/cloudinit/net/sysconfig.py b/cloudinit/net/sysconfig.py
index fd8e501..19b3e60 100644
--- a/cloudinit/net/sysconfig.py
+++ b/cloudinit/net/sysconfig.py
@@ -273,6 +273,7 @@ class Renderer(renderer.Renderer):
 ('USERCTL', False),
 ('NM_CONTROLLED', False),
 ('BOOTPROTO', 'none'),
+('STARTMODE', 'auto'),
 ])
 
 # If these keys exist, then their values will be used to form
@@ -367,6 +368,7 @@ class Renderer(renderer.Renderer):
   iface_cfg.name))
 if subnet.get('control') == 'manual':
 iface_cfg['ONBOOT'] = False
+iface_cfg['STARTMODE'] = 'manual'
 
 # set IPv4 and IPv6 static addresses
 ipv4_index = -1
diff --git a/cloudinit/sources/DataSourceOpenNebula.py b/cloudinit/sources/DataSourceOpenNebula.py
index 6e1d04b..02c9a7b 100644
--- a/cloudinit/sources/DataSourceOpenNebula.py
+++ b/cloudinit/sources/DataSourceOpenNebula.py
@@ -337,7 +337,9 @@ def parse_shell_config(content, keylist=None, bash=None, asuser=None,
 (output, _error) = util.subp(cmd, data=bcmd)
 
 # exclude vars in bash that change on their own or that we used
-excluded = ("EPOCHREALTIME", "RANDOM", "LINENO", "SECONDS", "_", "__v")
+excluded = (
+"EPOCHREALTIME", "EPOCHSECONDS", "RANDOM", "LINENO", "SECONDS", "_",
+"__v")
 preset = {}
 ret = {}
 target = None
diff --git a/debian/changelog b/debian/changelog
index e611ee7..efc0567 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,6 +1,18 @@
-cloud-init (18.5-17-gd1a2fe73-0ubuntu1~18.04.1) bionic; urgency=medium
+cloud-init (18.5-21-g8ee294d5-0ubuntu1~18.04.1) bionic; urgency=medium
 
   * New upstream snapshot. (LP: #1813346)
+- opennebula: also exclude epochseconds from changed environment vars
+- systemd: Render generator from template to account for system
+  differences. [Robert Schweikert]
+- sysconfig: On SUSE, use STARTMODE instead of ONBOOT [Robert Schweikert]
+- flake8: use ==/!= to compare str, bytes, and int literals
+  [Paride Legovini]
+
+ -- Chad Smith   Mon, 28 Jan 2019 20:25:39 -0700
+
+cloud-init (18.5-17-gd1a2fe73-0ubuntu1~18.04.1) bionic; urgency=medium
+
+  * New upstream snapshot.
 - opennebula: exclude EPOCHREALTIME as known bash env variable with a delta
 - tox: fix disco httpretty dependencies for py37
 - run-container: uncomment baseurl in yum.repos.d/*.repo when using a
diff --git a/setup.py b/setup.py
index ea37efc..186e215 100755
--- a/setup.py
+++ b/setup.py
@@ -30,6 +30,8 @@ VARIANT = None
 def is_f(p):
 return os.path.isfile(p)
 
+def is_generator(p):
+return '-generator' in p
 
 def tin

[Cloud-init-dev] [Merge] ~chad.smith/cloud-init:ubuntu/devel into cloud-init:ubuntu/devel

2019-01-28 Thread Chad Smith
Chad Smith has proposed merging ~chad.smith/cloud-init:ubuntu/devel into 
cloud-init:ubuntu/devel.

Commit message:
New upstream snapshot to fix intermittent unittest failures on opennebula due 
to bash 5.0

LP: #1813641

Requested reviews:
  cloud-init commiters (cloud-init-dev)
Related bugs:
  Bug #1799540 in cloud-init: "ONBOOT not supported in SUSE distros"
  https://bugs.launchpad.net/cloud-init/+bug/1799540
  Bug #1813641 in cloud-init: "cloud-init on Disco, opennebula will 
intermittently fail unittests "
  https://bugs.launchpad.net/cloud-init/+bug/1813641

For more details, see:
https://code.launchpad.net/~chad.smith/cloud-init/+git/cloud-init/+merge/362363
-- 
Your team cloud-init commiters is requested to review the proposed merge of 
~chad.smith/cloud-init:ubuntu/devel into cloud-init:ubuntu/devel.
diff --git a/cloudinit/config/cc_rh_subscription.py b/cloudinit/config/cc_rh_subscription.py
index edee01e..28c79b8 100644
--- a/cloudinit/config/cc_rh_subscription.py
+++ b/cloudinit/config/cc_rh_subscription.py
@@ -249,14 +249,14 @@ class SubscriptionManager(object):
 except util.ProcessExecutionError as e:
 if e.stdout.rstrip() != '':
 for line in e.stdout.split("\n"):
-if line is not '':
+if line != '':
 self.log_warn(line)
 else:
 self.log_warn("Setting the service level failed with: "
   "{0}".format(e.stderr.strip()))
 return False
 for line in return_out.split("\n"):
-if line is not "":
+if line != "":
 self.log.debug(line)
 return True
 
@@ -268,7 +268,7 @@ class SubscriptionManager(object):
 self.log_warn("Auto-attach failed with: {0}".format(e))
 return False
 for line in return_out.split("\n"):
-if line is not "":
+if line != "":
 self.log.debug(line)
 return True
 
diff --git a/cloudinit/net/sysconfig.py b/cloudinit/net/sysconfig.py
index fd8e501..19b3e60 100644
--- a/cloudinit/net/sysconfig.py
+++ b/cloudinit/net/sysconfig.py
@@ -273,6 +273,7 @@ class Renderer(renderer.Renderer):
 ('USERCTL', False),
 ('NM_CONTROLLED', False),
 ('BOOTPROTO', 'none'),
+('STARTMODE', 'auto'),
 ])
 
 # If these keys exist, then their values will be used to form
@@ -367,6 +368,7 @@ class Renderer(renderer.Renderer):
   iface_cfg.name))
 if subnet.get('control') == 'manual':
 iface_cfg['ONBOOT'] = False
+iface_cfg['STARTMODE'] = 'manual'
 
 # set IPv4 and IPv6 static addresses
 ipv4_index = -1
diff --git a/cloudinit/sources/DataSourceOpenNebula.py b/cloudinit/sources/DataSourceOpenNebula.py
index 6e1d04b..02c9a7b 100644
--- a/cloudinit/sources/DataSourceOpenNebula.py
+++ b/cloudinit/sources/DataSourceOpenNebula.py
@@ -337,7 +337,9 @@ def parse_shell_config(content, keylist=None, bash=None, asuser=None,
 (output, _error) = util.subp(cmd, data=bcmd)
 
 # exclude vars in bash that change on their own or that we used
-excluded = ("EPOCHREALTIME", "RANDOM", "LINENO", "SECONDS", "_", "__v")
+excluded = (
+"EPOCHREALTIME", "EPOCHSECONDS", "RANDOM", "LINENO", "SECONDS", "_",
+"__v")
 preset = {}
 ret = {}
 target = None
diff --git a/debian/changelog b/debian/changelog
index 26655fc..70f1879 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,17 @@
+cloud-init (18.5-21-g8ee294d5-0ubuntu1) disco; urgency=medium
+
+  * New upstream snapshot.
+- opennebula: also exclude epochseconds from changed environment vars
+  (LP: #1813641)
+- systemd: Render generator from template to account for system
+  differences. [Robert Schweikert]
+- sysconfig: On SUSE, use STARTMODE instead of ONBOOT
+  [Robert Schweikert] (LP: #1799540)
+- flake8: use ==/!= to compare str, bytes, and int literals
+  [Paride Legovini]
+
+ -- Chad Smith   Mon, 28 Jan 2019 17:01:53 -0700
+
 cloud-init (18.5-17-gd1a2fe73-0ubuntu1) disco; urgency=medium
 
   * New upstream snapshot.
diff --git a/setup.py b/setup.py
index ea37efc..186e215 100755
--- a/setup.py
+++ b/setup.py
@@ -30,6 +30,8 @@ VARIANT = None
 def is_f(p):
 return os.path.isfile(p)
 
+def is_generator(p):
+return '-generator' in p
 
 def tiny_p(cmd, capture=True):
 # Darn python 2.6 doesn't have check_output (ar)
@@ -90,7 +92,7 @@ def read_requires():
 return str(deps).splitlines()
 
 
-def render_tmpl(template):
+def render_tmpl(template, mode=None):
 """render template 

  1   2   3   4   5   6   7   >