@@ -65,7 +65,16 @@ diff -ruN a/cloudinit/sources/DataSourceVultr.py b/cloudinit/sources/DataSourceV
65
65
66
66
diff -ruN a/cloudinit/sources/__init__.py b/cloudinit/sources/__init__.py
67
67
--- a/cloudinit/sources/__init__.py 2021-11-02 12:35:08.000000000 -0700
68
- +++ b/cloudinit/sources/__init__.py 2023-06-15 14:29:08.864172606 -0700
68
+ +++ b/cloudinit/sources/__init__.py 2023-06-29 16:07:33.755159240 -0700
69
+ @@ -13,7 +13,7 @@
70
+ import json
71
+ import os
72
+ from collections import namedtuple
73
+ - from typing import Dict, List # noqa: F401
74
+ + from typing import Dict, List, Tuple # noqa: F401
75
+
76
+ from cloudinit import dmi
77
+ from cloudinit import importer
69
78
@@ -103,7 +103,10 @@
70
79
sub_key_path = key_path + '/' + key
71
80
else:
@@ -128,9 +137,23 @@ diff -ruN a/cloudinit/sources/__init__.py b/cloudinit/sources/__init__.py
128
137
129
138
_ci_pkl_version = 1
130
139
140
+ diff -ruN a/cloudinit/stages.py b/cloudinit/stages.py
141
+ --- a/cloudinit/stages.py 2021-11-02 12:35:08.000000000 -0700
142
+ +++ b/cloudinit/stages.py 2023-06-29 16:32:03.259644654 -0700
143
+ @@ -204,7 +204,9 @@
144
+ util.ensure_dirs(self._initial_subdirs())
145
+ log_file = util.get_cfg_option_str(self.cfg, 'def_log_file')
146
+ if log_file:
147
+ - util.ensure_file(log_file, mode=0o640, preserve_mode=True)
148
+ + # At this point the log file should have already been created
149
+ + # in the setupLogging function of log.py
150
+ + util.ensure_file(log_file, mode=0o640, preserve_mode=False)
151
+ perms = self.cfg.get('syslog_fix_perms')
152
+ if not perms:
153
+ perms = {}
131
154
diff -ruN a/cloudinit/sources/tests/test_init.py b/cloudinit/sources/tests/test_init.py
132
155
--- a/cloudinit/sources/tests/test_init.py 2021-11-02 12:35:08.000000000 -0700
133
- +++ b/cloudinit/sources/tests/test_init.py 2023-06-15 14:44:39.886499541 -0700
156
+ +++ b/cloudinit/sources/tests/test_init.py 2023-06-29 17:07:56.129540654 -0700
134
157
@@ -353,10 +353,31 @@
135
158
'availability_zone': 'myaz',
136
159
'local-hostname': 'test-subclass-hostname',
@@ -166,58 +189,55 @@ diff -ruN a/cloudinit/sources/tests/test_init.py b/cloudinit/sources/tests/test_
166
189
datasource.sensitive_metadata_keys)
167
190
sys_info = {
168
191
"python": "3.7",
169
- @@ -372,8 +393,12 @@
170
- expected = {
192
+ @@ -373,7 +394,10 @@
171
193
'base64_encoded_keys': [],
172
194
'merged_cfg': REDACT_SENSITIVE_VALUE,
173
- - 'sensitive_keys': [
195
+ 'sensitive_keys': [
174
196
- 'ds/meta_data/some/security-credentials', 'merged_cfg'],
175
- + "sensitive_keys": [
176
- + "ds/meta_data/VENDOR-DAta",
177
- + "ds/meta_data/some/security-credentials",
178
- + "ds/meta_data/someother/nested/userData",
179
- + "merged_cfg",
180
- + ],
197
+ + 'ds/meta_data/VENDOR-DAta',
198
+ + 'ds/meta_data/some/security-credentials',
199
+ + 'ds/meta_data/someother/nested/userData',
200
+ + 'merged_cfg'],
181
201
'sys_info': sys_info,
182
202
'v1': {
183
203
'_beta_keys': ['subplatform'],
184
- @@ -381,6 +406 ,7 @@
204
+ @@ -381,6 +405 ,7 @@
185
205
'availability_zone': 'myaz',
186
206
'cloud-name': 'subclasscloudname',
187
207
'cloud_name': 'subclasscloudname',
188
- + " cloud_id": " subclasscloudname" ,
208
+ + ' cloud_id': ' subclasscloudname' ,
189
209
'distro': 'ubuntu',
190
210
'distro_release': 'focal',
191
211
'distro_version': '20.04',
192
- @@ -401,12 +427 ,18 @@
212
+ @@ -401,12 +426 ,18 @@
193
213
'ds': {
194
214
'_doc': EXPERIMENTAL_TEXT,
195
215
'meta_data': {
196
- + " VENDOR-DAta" : REDACT_SENSITIVE_VALUE,
216
+ + ' VENDOR-DAta' : REDACT_SENSITIVE_VALUE,
197
217
'availability_zone': 'myaz',
198
218
'local-hostname': 'test-subclass-hostname',
199
219
'region': 'myregion',
200
220
- 'some': {'security-credentials': REDACT_SENSITIVE_VALUE}}}
201
- + " some" : {" security-credentials" : REDACT_SENSITIVE_VALUE},
221
+ + ' some' : {' security-credentials' : REDACT_SENSITIVE_VALUE},
202
222
+ "someother": {
203
223
+ "nested": {"userData": REDACT_SENSITIVE_VALUE}
204
224
+ },
205
- + },
206
- + },
225
+ + }
226
+ + }
207
227
}
208
228
- self.assertCountEqual(expected, redacted)
209
229
+ self.assertEqual(expected, redacted)
210
230
file_stat = os.stat(json_file)
211
231
self.assertEqual(0o644, stat.S_IMODE(file_stat.st_mode))
212
232
213
- @@ -432,7 +464 ,16 @@
233
+ @@ -432,7 +463 ,16 @@
214
234
"variant": "ubuntu", "dist": ["ubuntu", "20.04", "focal"]}
215
235
216
236
self.assertCountEqual(
217
237
- ('merged_cfg', 'security-credentials',),
218
238
+ (
219
- + " merged_cfg",
220
- + " security-credentials",
239
+ + ' merged_cfg',
240
+ + ' security-credentials',
221
241
+ "userdata",
222
242
+ "user-data",
223
243
+ "user_data",
@@ -228,23 +248,9 @@ diff -ruN a/cloudinit/sources/tests/test_init.py b/cloudinit/sources/tests/test_
228
248
datasource.sensitive_metadata_keys)
229
249
with mock.patch("cloudinit.util.system_info", return_value=sys_info):
230
250
datasource.get_data()
231
- diff -ruN a/cloudinit/stages.py b/cloudinit/stages.py
232
- --- a/cloudinit/stages.py 2021-11-02 12:35:08.000000000 -0700
233
- +++ b/cloudinit/stages.py 2023-06-15 14:33:32.175651581 -0700
234
- @@ -204,7 +204,9 @@
235
- util.ensure_dirs(self._initial_subdirs())
236
- log_file = util.get_cfg_option_str(self.cfg, 'def_log_file')
237
- if log_file:
238
- - util.ensure_file(log_file, mode=0o640, preserve_mode=True)
239
- + # At this point the log file should have already been created
240
- + # in the setupLogging function of log.py
241
- + util.ensure_file(log_file, mode=0o640, preserve_mode=False)
242
- perms = self.cfg.get('syslog_fix_perms')
243
- if not perms:
244
- perms = {}
245
251
diff -ruN a/cloudinit/tests/test_stages.py b/cloudinit/tests/test_stages.py
246
252
--- a/cloudinit/tests/test_stages.py 2021-11-02 12:35:08.000000000 -0700
247
- +++ b/cloudinit/tests/test_stages.py 2023-06-15 14:49:05.304858409 -0700
253
+ +++ b/cloudinit/tests/test_stages.py 2023-06-29 17:09:37.046934002 -0700
248
254
@@ -458,21 +458,24 @@
249
255
# Assert we create it 0o640 by default if it doesn't already exist
250
256
assert 0o640 == stat.S_IMODE(log_file.stat().mode)
0 commit comments