Merge ~chad.smith/cloud-init:ubuntu/zesty into cloud-init:ubuntu/zesty

Proposed by Chad Smith
Status: Merged
Merged at revision: cb299d620cee55b6a4780a867bbacf40d27140b8
Proposed branch: ~chad.smith/cloud-init:ubuntu/zesty
Merge into: cloud-init:ubuntu/zesty
Diff against target: 209 lines (+189/-0)
3 files modified
debian/changelog (+7/-0)
debian/patches/cpick-41152f1-schema-Log-debug-instead-of-warning-when-jsonschema-is (+181/-0)
debian/patches/series (+1/-0)
Reviewer Review Type Date Requested Status
Server Team CI bot continuous-integration Needs Fixing
Scott Moser Pending
Review via email: mp+332446@code.launchpad.net

Description of the change

Update SRU for ubuntu/zesty cherrypicking json-schema as debug log instead of warning.

To post a comment you must log in.
Revision history for this message
Server Team CI bot (server-team-bot) wrote :

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

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

review: Needs Fixing (continuous-integration)
Revision history for this message
Server Team CI bot (server-team-bot) wrote :

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

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

review: Needs Fixing (continuous-integration)
Revision history for this message
Server Team CI bot (server-team-bot) wrote :

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

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

review: Needs Fixing (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/changelog b/debian/changelog
2index aa71074..e595586 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,10 @@
6+cloud-init (17.1-18-gd4f70470-0ubuntu1~17.04.2) zesty-proposed; urgency=medium
7+
8+ * cherry-pick 41152f1: schema: Log debug instead of warning when
9+ jsonschema is absent (LP: #1724354)
10+
11+ -- Chad Smith <chad.smith@canonical.com> Wed, 18 Oct 2017 15:05:29 -0600
12+
13 cloud-init (17.1-18-gd4f70470-0ubuntu1~17.04.1) zesty-proposed; urgency=medium
14
15 * drop the following cherry picks, now incorporated in snapshot.
16diff --git a/debian/patches/cpick-41152f1-schema-Log-debug-instead-of-warning-when-jsonschema-is b/debian/patches/cpick-41152f1-schema-Log-debug-instead-of-warning-when-jsonschema-is
17new file mode 100644
18index 0000000..6b9e784
19--- /dev/null
20+++ b/debian/patches/cpick-41152f1-schema-Log-debug-instead-of-warning-when-jsonschema-is
21@@ -0,0 +1,181 @@
22+From 41152f10ddbd8681cdac44b408038a4f23ab02df Mon Sep 17 00:00:00 2001
23+From: Scott Moser <smoser@brickies.net>
24+Date: Tue, 17 Oct 2017 16:12:59 -0400
25+Subject: [PATCH] schema: Log debug instead of warning when jsonschema is not
26+ available.
27+
28+When operating in expected path, cloud-init should avoid logging with
29+warning. That causes 'WARNING' messages in /var/log/cloud-init.log.
30+By default, warnings also go to the console.
31+
32+Since jsonschema is a optional dependency, and not present on xenial
33+and zesty, cloud-init should not warn there.
34+
35+Also here:
36+* Add a test to integration tests to assert that there are no
37+ warnings in /var/log/cloud-init.log.
38+* Update one integration test that did show warning and the related
39+ documentation and examples.
40+
41+LP: #1724354
42+---
43+ cloudinit/config/cc_users_groups.py | 3 ++-
44+ cloudinit/config/schema.py | 2 +-
45+ doc/examples/cloud-config-user-groups.txt | 6 +++---
46+ tests/cloud_tests/testcases/base.py | 4 ++++
47+ tests/cloud_tests/testcases/examples/including_user_groups.py | 6 ++++++
48+ tests/cloud_tests/testcases/examples/including_user_groups.yaml | 7 +++++--
49+ tests/cloud_tests/testcases/modules/user_groups.py | 6 ++++++
50+ tests/cloud_tests/testcases/modules/user_groups.yaml | 7 +++++--
51+ 8 files changed, 32 insertions(+), 9 deletions(-)
52+
53+Index: cloud-init/cloudinit/config/cc_users_groups.py
54+===================================================================
55+--- cloud-init.orig/cloudinit/config/cc_users_groups.py
56++++ cloud-init/cloudinit/config/cc_users_groups.py
57+@@ -15,7 +15,8 @@ options, see the ``Including users and g
58+ Groups to add to the system can be specified as a list under the ``groups``
59+ key. Each entry in the list should either contain a the group name as a string,
60+ or a dictionary with the group name as the key and a list of users who should
61+-be members of the group as the value.
62++be members of the group as the value. **Note**: Groups are added before users,
63++so any users in a group list must already exist on the system.
64+
65+ The ``users`` config key takes a list of users to configure. The first entry in
66+ this list is used as the default user for the system. To preserve the standard
67+Index: cloud-init/cloudinit/config/schema.py
68+===================================================================
69+--- cloud-init.orig/cloudinit/config/schema.py
70++++ cloud-init/cloudinit/config/schema.py
71+@@ -74,7 +74,7 @@ def validate_cloudconfig_schema(config,
72+ try:
73+ from jsonschema import Draft4Validator, FormatChecker
74+ except ImportError:
75+- logging.warning(
76++ logging.debug(
77+ 'Ignoring schema validation. python-jsonschema is not present')
78+ return
79+ validator = Draft4Validator(schema, format_checker=FormatChecker())
80+Index: cloud-init/doc/examples/cloud-config-user-groups.txt
81+===================================================================
82+--- cloud-init.orig/doc/examples/cloud-config-user-groups.txt
83++++ cloud-init/doc/examples/cloud-config-user-groups.txt
84+@@ -1,8 +1,8 @@
85+ # Add groups to the system
86+-# The following example adds the ubuntu group with members foo and bar and
87+-# the group cloud-users.
88++# The following example adds the ubuntu group with members 'root' and 'sys'
89++# and the empty group cloud-users.
90+ groups:
91+- - ubuntu: [foo,bar]
92++ - ubuntu: [root,sys]
93+ - cloud-users
94+
95+ # Add users to the system. Users are added after groups are added.
96+Index: cloud-init/tests/cloud_tests/testcases/base.py
97+===================================================================
98+--- cloud-init.orig/tests/cloud_tests/testcases/base.py
99++++ cloud-init/tests/cloud_tests/testcases/base.py
100+@@ -72,6 +72,10 @@ class CloudTestCase(unittest.TestCase):
101+ result = self.get_status_data(self.get_data_file('result.json'))
102+ self.assertEqual(len(result['errors']), 0)
103+
104++ def test_no_warnings_in_log(self):
105++ """Warnings should not be found in the log."""
106++ self.assertNotIn("WARN", self.get_data_file('cloud-init.log'))
107++
108+
109+ class PasswordListTest(CloudTestCase):
110+ """Base password test case class."""
111+Index: cloud-init/tests/cloud_tests/testcases/examples/including_user_groups.py
112+===================================================================
113+--- cloud-init.orig/tests/cloud_tests/testcases/examples/including_user_groups.py
114++++ cloud-init/tests/cloud_tests/testcases/examples/including_user_groups.py
115+@@ -40,4 +40,10 @@ class TestUserGroups(base.CloudTestCase)
116+ out = self.get_data_file('user_cloudy')
117+ self.assertRegex(out, r'cloudy:x:[0-9]{3,4}:')
118+
119++ def test_user_root_in_secret(self):
120++ """Test root user is in 'secret' group."""
121++ user, _, groups = self.get_data_file('root_groups').partition(":")
122++ self.assertIn("secret", groups.split(),
123++ msg="User root is not in group 'secret'")
124++
125+ # vi: ts=4 expandtab
126+Index: cloud-init/tests/cloud_tests/testcases/examples/including_user_groups.yaml
127+===================================================================
128+--- cloud-init.orig/tests/cloud_tests/testcases/examples/including_user_groups.yaml
129++++ cloud-init/tests/cloud_tests/testcases/examples/including_user_groups.yaml
130+@@ -8,7 +8,7 @@ cloud_config: |
131+ #cloud-config
132+ # Add groups to the system
133+ groups:
134+- - secret: [foobar,barfoo]
135++ - secret: [root]
136+ - cloud-users
137+
138+ # Add users to the system. Users are added after groups are added.
139+@@ -24,7 +24,7 @@ cloud_config: |
140+ - name: barfoo
141+ gecos: Bar B. Foo
142+ sudo: ALL=(ALL) NOPASSWD:ALL
143+- groups: cloud-users
144++ groups: [cloud-users, secret]
145+ lock_passwd: true
146+ - name: cloudy
147+ gecos: Magic Cloud App Daemon User
148+@@ -49,5 +49,8 @@ collect_scripts:
149+ user_cloudy: |
150+ #!/bin/bash
151+ getent passwd cloudy
152++ root_groups: |
153++ #!/bin/bash
154++ groups root
155+
156+ # vi: ts=4 expandtab
157+Index: cloud-init/tests/cloud_tests/testcases/modules/user_groups.py
158+===================================================================
159+--- cloud-init.orig/tests/cloud_tests/testcases/modules/user_groups.py
160++++ cloud-init/tests/cloud_tests/testcases/modules/user_groups.py
161+@@ -40,4 +40,10 @@ class TestUserGroups(base.CloudTestCase)
162+ out = self.get_data_file('user_cloudy')
163+ self.assertRegex(out, r'cloudy:x:[0-9]{3,4}:')
164+
165++ def test_user_root_in_secret(self):
166++ """Test root user is in 'secret' group."""
167++ user, _, groups = self.get_data_file('root_groups').partition(":")
168++ self.assertIn("secret", groups.split(),
169++ msg="User root is not in group 'secret'")
170++
171+ # vi: ts=4 expandtab
172+Index: cloud-init/tests/cloud_tests/testcases/modules/user_groups.yaml
173+===================================================================
174+--- cloud-init.orig/tests/cloud_tests/testcases/modules/user_groups.yaml
175++++ cloud-init/tests/cloud_tests/testcases/modules/user_groups.yaml
176+@@ -7,7 +7,7 @@ cloud_config: |
177+ #cloud-config
178+ # Add groups to the system
179+ groups:
180+- - secret: [foobar,barfoo]
181++ - secret: [root]
182+ - cloud-users
183+
184+ # Add users to the system. Users are added after groups are added.
185+@@ -23,7 +23,7 @@ cloud_config: |
186+ - name: barfoo
187+ gecos: Bar B. Foo
188+ sudo: ALL=(ALL) NOPASSWD:ALL
189+- groups: cloud-users
190++ groups: [cloud-users, secret]
191+ lock_passwd: true
192+ - name: cloudy
193+ gecos: Magic Cloud App Daemon User
194+@@ -48,5 +48,8 @@ collect_scripts:
195+ user_cloudy: |
196+ #!/bin/bash
197+ getent passwd cloudy
198++ root_groups: |
199++ #!/bin/bash
200++ groups root
201+
202+ # vi: ts=4 expandtab
203diff --git a/debian/patches/series b/debian/patches/series
204index fe91dbd..4e403ce 100644
205--- a/debian/patches/series
206+++ b/debian/patches/series
207@@ -1 +1,2 @@
208 stable-release-no-jsonschema-dep.patch
209+cpick-41152f1-schema-Log-debug-instead-of-warning-when-jsonschema-is

Subscribers

People subscribed via source and target branches