Skip to content

Commit 4eae3d0

Browse files
author
EarthmanT
committed
patch up issues
1 parent 8a4e952 commit 4eae3d0

File tree

5 files changed

+71
-71
lines changed

5 files changed

+71
-71
lines changed

examples/blueprint.yaml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,10 @@ node_templates:
1414
hello_functions:
1515
type: cloudify.nodes.serverless.Service
1616
properties:
17-
client_config:
18-
provider: aws
19-
credentials:
20-
key: { get_secret: aws_access_key_id }
21-
secret: { get_secret: aws_secret_access_key }
2217
resource_config:
18+
env:
19+
AWS_ACCESS_KEY_ID: { get_secret: aws_access_key_id }
20+
AWS_SECRET_ACCESS_KEY: { get_secret: aws_secret_access_key }
2321
name: 'aws-service'
2422
template: 'aws-python3'
2523
functions:

serverless_plugin/tests/test_tasks.py

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -191,15 +191,15 @@ def test_create(self,
191191
'baz',
192192
],
193193
ctx.instance.runtime_properties['root_directory'],
194-
{
195-
'TMP': tempenv,
196-
'TEMP': tempenv,
197-
'TMPDIR': tempenv,
198-
},
199194
additional_args={
200195
'env': {},
201196
'log_stdout': True,
202197
},
198+
env={
199+
'TMP': tempenv,
200+
'TEMP': tempenv,
201+
'TMPDIR': tempenv,
202+
},
203203
return_output=True
204204
)
205205

@@ -250,15 +250,15 @@ def test_start(self, run_sub, get_stored_prop, verify, tempenv, *_, **__):
250250
'deploy',
251251
],
252252
ctx.instance.runtime_properties['root_directory'],
253-
{
253+
additional_args={
254+
'env': {},
255+
'log_stdout': True
256+
},
257+
env={
254258
'TMP': tempenv,
255259
'TEMP': tempenv,
256260
'TMPDIR': tempenv,
257261
},
258-
additional_args={
259-
'env': {},
260-
'log_stdout': True,
261-
},
262262
return_output=True
263263
)
264264

@@ -283,15 +283,15 @@ def test_stop(self, run_sub, get_stored_prop, verify, tempenv, *_, **__):
283283
'remove',
284284
],
285285
ctx.instance.runtime_properties['root_directory'],
286-
{
287-
'TMP': tempenv,
288-
'TEMP': tempenv,
289-
'TMPDIR': tempenv,
290-
},
291286
additional_args={
292287
'env': {},
293288
'log_stdout': True
294289
},
290+
env={
291+
'TMP': tempenv,
292+
'TEMP': tempenv,
293+
'TMPDIR': tempenv,
294+
},
295295
return_output=True
296296
)
297297

@@ -334,15 +334,15 @@ def test_invoke(self, run_sub, get_stored_prop, verify, tempenv, *_, **__):
334334
'qux',
335335
],
336336
ctx.instance.runtime_properties['root_directory'],
337-
{
338-
'TMP': tempenv,
339-
'TEMP': tempenv,
340-
'TMPDIR': tempenv,
341-
},
342337
additional_args={
343338
'env': {},
344339
'log_stdout': True,
345340
},
341+
env={
342+
'TMP': tempenv,
343+
'TEMP': tempenv,
344+
'TMPDIR': tempenv,
345+
},
346346
return_output=True
347347
)
348348

@@ -376,15 +376,15 @@ def test_metrics(
376376
'qux',
377377
],
378378
ctx.instance.runtime_properties['root_directory'],
379-
{
379+
additional_args={
380+
'env': {},
381+
'log_stdout': True
382+
},
383+
env={
380384
'TMP': tempenv,
381385
'TEMP': tempenv,
382386
'TMPDIR': tempenv,
383387
},
384-
additional_args={
385-
'env': {},
386-
'log_stdout': True,
387-
},
388388
return_output=True
389389
)
390390

serverless_sdk/__init__.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ def _subcommand(self, subcommand, options=None, cwd=None):
180180
def create_options(self):
181181
options = []
182182
for key, value in self.resource_config.items():
183-
if key == 'functions':
183+
if key in ['functions', 'env']:
184184
continue
185185
if value:
186186
option = SERVICE_CONFIG_MAP.get(key)
@@ -266,9 +266,11 @@ def credentialize_env(self, env=None):
266266
'TEMP': self.tempenv,
267267
'TMPDIR': self.tempenv,
268268
})
269-
if self.client_config.get('aws'):
270-
access_key = self.client_config('credentials', {}).get('key')
271-
secret_key = self.client_config('credentials', {}).get('secret')
269+
if self.client_config.get('provider') == 'aws':
270+
access_key = self.client_config.get(
271+
'credentials', {}).get('key')
272+
secret_key = self.client_config.get(
273+
'credentials', {}).get('secret')
272274
env.update(
273275
{
274276
'AWS_ACCESS_KEY_ID': access_key,
@@ -300,7 +302,7 @@ def execute(self,
300302
result = self._execute(
301303
command,
302304
cwd or self.root_directory,
303-
self.credentialize_env(additional_env),
305+
env=self.credentialize_env(additional_env),
304306
additional_args=self.additional_args,
305307
return_output=return_output)
306308
finally:

serverless_sdk/tests/test_sdk.py

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -209,15 +209,15 @@ def test_subcommand(self,
209209
run_subprocess.assert_called_with(
210210
['foo', 'bar', '--baz'],
211211
'qux',
212-
{
213-
'TMP': sl.tempenv,
214-
'TEMP': sl.tempenv,
215-
'TMPDIR': sl.tempenv,
216-
},
217212
additional_args={
218213
'env': {},
219214
'log_stdout': sl._log_stdout
220215
},
216+
env={
217+
'TMP': sl.tempenv,
218+
'TEMP': sl.tempenv,
219+
'TMPDIR': sl.tempenv,
220+
},
221221
return_output=sl._log_stdout
222222
)
223223

@@ -245,15 +245,15 @@ def test_create(self,
245245
run_subprocess.assert_called_with(
246246
cmd,
247247
sl.root_directory,
248-
{
249-
'TMP': sl.tempenv,
250-
'TEMP': sl.tempenv,
251-
'TMPDIR': sl.tempenv,
252-
},
253248
additional_args={
254249
'env': {},
255250
'log_stdout': sl._log_stdout
256251
},
252+
env={
253+
'TMP': sl.tempenv,
254+
'TEMP': sl.tempenv,
255+
'TMPDIR': sl.tempenv,
256+
},
257257
return_output=sl._log_stdout
258258
)
259259

@@ -281,15 +281,15 @@ def test_deploy(self,
281281
run_subprocess.assert_called_with(
282282
cmd,
283283
sl.root_directory,
284-
{
285-
'TMP': sl.tempenv,
286-
'TEMP': sl.tempenv,
287-
'TMPDIR': sl.tempenv,
288-
},
289284
additional_args={
290285
'env': {},
291286
'log_stdout': sl._log_stdout
292287
},
288+
env={
289+
'TMP': sl.tempenv,
290+
'TEMP': sl.tempenv,
291+
'TMPDIR': sl.tempenv,
292+
},
293293
return_output=sl._log_stdout
294294
)
295295

@@ -317,15 +317,15 @@ def test_destroy(self,
317317
run_subprocess.assert_called_with(
318318
cmd,
319319
sl.root_directory,
320-
{
321-
'TMP': sl.tempenv,
322-
'TEMP': sl.tempenv,
323-
'TMPDIR': sl.tempenv,
324-
},
325320
additional_args={
326321
'env': {},
327322
'log_stdout': sl._log_stdout
328323
},
324+
env={
325+
'TMP': sl.tempenv,
326+
'TEMP': sl.tempenv,
327+
'TMPDIR': sl.tempenv,
328+
},
329329
return_output=sl._log_stdout
330330
)
331331

@@ -386,15 +386,15 @@ def test_invoke(self,
386386
run_subprocess.assert_called_with(
387387
cmd,
388388
sl.root_directory,
389-
{
390-
'TMP': sl.tempenv,
391-
'TEMP': sl.tempenv,
392-
'TMPDIR': sl.tempenv,
393-
},
394389
additional_args={
395390
'env': {},
396391
'log_stdout': sl._log_stdout
397392
},
393+
env={
394+
'TMP': sl.tempenv,
395+
'TEMP': sl.tempenv,
396+
'TMPDIR': sl.tempenv,
397+
},
398398
return_output=sl._log_stdout
399399
)
400400

@@ -422,15 +422,15 @@ def test_metrics(self,
422422
run_subprocess.assert_called_with(
423423
cmd,
424424
sl.root_directory,
425-
{
426-
'TMP': sl.tempenv,
427-
'TEMP': sl.tempenv,
428-
'TMPDIR': sl.tempenv,
429-
},
430425
additional_args={
431426
'env': {},
432427
'log_stdout': sl._log_stdout
433428
},
429+
env={
430+
'TMP': sl.tempenv,
431+
'TEMP': sl.tempenv,
432+
'TMPDIR': sl.tempenv,
433+
},
434434
return_output=sl._log_stdout
435435
)
436436

@@ -458,15 +458,15 @@ def test_info(self,
458458
run_subprocess.assert_called_with(
459459
cmd,
460460
sl.root_directory,
461-
{
462-
'TMP': sl.tempenv,
463-
'TEMP': sl.tempenv,
464-
'TMPDIR': sl.tempenv,
465-
},
466461
additional_args={
467462
'env': {},
468463
'log_stdout': sl._log_stdout
469464
},
465+
env={
466+
'TMP': sl.tempenv,
467+
'TEMP': sl.tempenv,
468+
'TMPDIR': sl.tempenv,
469+
},
470470
return_output=sl._log_stdout
471471
)
472472
self.assertEqual(result, FOO_JSON)

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,6 @@ def get_version(rel_file='plugin.yaml'):
4848
packages=find_packages(exclude=['tests*']),
4949
install_requires=[
5050
"cloudify-common>=6.4",
51-
"cloudify-utilities-plugins-sdk>=0.0.85",
51+
"cloudify-utilities-plugins-sdk>=0.0.89",
5252
]
5353
)

0 commit comments

Comments
 (0)