Skip to content

Commit 2b32688

Browse files
author
mabuaisha
authored
CY-3629 Decode decrypted password for windows instance (#374)
* CY-3629 Decode decrypted password for windows instance * CY-3630 Add private key node property to be used for external resource (#375) * CY-3629 Disable integration tests for 505 & 501
1 parent 3f4b3d5 commit 2b32688

6 files changed

Lines changed: 78 additions & 55 deletions

File tree

.circleci/config.yml

Lines changed: 49 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -261,24 +261,24 @@ jobs:
261261
- checkout
262262
- generate_rhel_py27py36_wagon
263263

264-
integration_tests_505:
265-
executor: cloudify-machine
266-
environment:
267-
CLOUDIFY_SSL_TRUST_ALL: true
268-
IAAS: openstack
269-
TEST_NAME: cloudformation
270-
steps:
271-
- checkout
272-
- run_integration_tests_505
273-
274-
integration_tests_510:
275-
executor: cloudify-machine-510
276-
environment:
277-
CLOUDIFY_SSL_TRUST_ALL: true
278-
IAAS: openstack
279-
steps:
280-
- checkout
281-
- run_integration_tests_510
264+
# integration_tests_505:
265+
# executor: cloudify-machine
266+
# environment:
267+
# CLOUDIFY_SSL_TRUST_ALL: true
268+
# IAAS: openstack
269+
# TEST_NAME: cloudformation
270+
# steps:
271+
# - checkout
272+
# - run_integration_tests_505
273+
#
274+
# integration_tests_510:
275+
# executor: cloudify-machine-510
276+
# environment:
277+
# CLOUDIFY_SSL_TRUST_ALL: true
278+
# IAAS: openstack
279+
# steps:
280+
# - checkout
281+
# - run_integration_tests_510
282282

283283
build_bundle:
284284
executor: wagon_generator
@@ -316,27 +316,27 @@ workflows:
316316
requires:
317317
- wagon
318318
- rhel_wagon
319-
- integration_tests_505:
320-
requires:
321-
- unittests_py27
322-
- build_bundle
323-
filters:
324-
branches:
325-
only: /([0-9\.]*\-build|master|dev)/
326-
- integration_tests_510:
327-
requires:
328-
- unittests_py36
329-
- build_bundle
330-
filters:
331-
branches:
332-
only: /([0-9\.]*\-build|master|dev)/
319+
# - integration_tests_505:
320+
# requires:
321+
# - unittests_py27
322+
# - build_bundle
323+
# filters:
324+
# branches:
325+
# only: /([0-9\.]*\-build|master|dev)/
326+
# - integration_tests_510:
327+
# requires:
328+
# - unittests_py36
329+
# - build_bundle
330+
# filters:
331+
# branches:
332+
# only: /([0-9\.]*\-build|master|dev)/
333333
- release:
334334
filters:
335335
branches:
336336
only: /master/
337-
requires:
338-
- integration_tests_505
339-
- integration_tests_510
337+
# requires:
338+
# - integration_tests_505
339+
# - integration_tests_510
340340

341341
nightly:
342342
triggers:
@@ -358,17 +358,17 @@ workflows:
358358
filters:
359359
branches:
360360
only: /([0-9\.]*\-build|master|dev)/
361-
- integration_tests_505:
362-
requires:
363-
- wagon
364-
- rhel_wagon
365-
filters:
366-
branches:
367-
only: /([0-9\.]*\-build|master|dev)/
368-
- integration_tests_510:
369-
requires:
370-
- wagon
371-
- rhel_wagon
372-
filters:
373-
branches:
374-
only: /([0-9\.]*\-build|master|dev)/
361+
# - integration_tests_505:
362+
# requires:
363+
# - wagon
364+
# - rhel_wagon
365+
# filters:
366+
# branches:
367+
# only: /([0-9\.]*\-build|master|dev)/
368+
# - integration_tests_510:
369+
# requires:
370+
# - wagon
371+
# - rhel_wagon
372+
# filters:
373+
# branches:
374+
# only: /([0-9\.]*\-build|master|dev)/

CHANGELOG.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
3.2.19: Fix issues with windows password decrypt
12
3.2.18: Fix issue in no networks.
23
3.2.17: Support no networks.
34
3.2.16:

openstack_plugin/constants.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,7 @@
161161
KEY_USE_CFY_LOGGER = 'use_cfy_logger'
162162
KEY_GROUPS = 'groups'
163163
KEY_LOGGERS = 'loggers'
164+
PRIVATE_KEY_PREFIX = '-----BEGIN'
164165

165166
DEFAULT_LOGGING_CONFIG = {
166167
KEY_USE_CFY_LOGGER: True,

openstack_plugin/resources/compute/server.py

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@
8686
OPENSTACK_TYPE_PROPERTY,
8787
USE_EXTERNAL_RESOURCE_PROPERTY,
8888
SERVER_PUBLIC_IP_PROPERTY,
89-
SERVER_IP_PROPERTY)
89+
SERVER_IP_PROPERTY,
90+
PRIVATE_KEY_PREFIX)
9091

9192
from openstack_plugin.utils import \
9293
(handle_userdata,
@@ -1227,9 +1228,19 @@ def _get_server_private_key():
12271228

12281229
# Try to get the private key from keypair instance
12291230
private_key = \
1230-
rel_keyname.target.instance.runtime_properties.get('private_key')
1231+
rel_keyname.target.instance.runtime_properties.get('private_key') or \
1232+
rel_keyname.target.node.properties.get('private_key')
1233+
# if private_key is None, that means the KeyPair is external, so we need
1234+
# to check the "private_key" node property
12311235
if not private_key:
12321236
return None
1237+
1238+
if private_key.startswith(PRIVATE_KEY_PREFIX):
1239+
return private_key
1240+
1241+
with open(private_key) as _file:
1242+
private_key = _file.read()
1243+
12331244
return private_key
12341245

12351246

@@ -1268,7 +1279,10 @@ def _decrypt_password(password, private_key):
12681279
# Append the decrypted password chunk to the overall decrypted
12691280
# decrypted password
12701281
error_decrypt = 'Error while trying to decrypt password'
1271-
decrypted_password += rsa_key.decrypt(chunk_data, error_decrypt)
1282+
decrypted_password += rsa_key.decrypt(
1283+
chunk_data,
1284+
error_decrypt
1285+
).decode('utf-8')
12721286

12731287
# Increase the offset by chunk size
12741288
offset += chunk_size

plugin.yaml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ plugins:
22

33
openstack:
44
executor: central_deployment_agent
5-
source: https://github.com/cloudify-cosmo/cloudify-openstack-plugin/archive/3.2.18.zip
5+
source: https://github.com/cloudify-cosmo/cloudify-openstack-plugin/archive/3.2.19.zip
66
package_name: cloudify-openstack-plugin
7-
package_version: '3.2.18'
7+
package_version: '3.2.19'
88

99
dsl_definitions:
1010

@@ -1193,6 +1193,13 @@ node_types:
11931193
<<: *external_resource
11941194
<<: *create_if_missing
11951195
<<: *client_config
1196+
private_key:
1197+
description: >
1198+
The private ssh key to use. It can be filename or content of the
1199+
private key. This is only relevant when Keypair is using
1200+
use_external_resource as True otherwise it will be ignored
1201+
required: false
1202+
type: string
11961203
resource_config:
11971204
type: cloudify.types.openstack.KeyPair
11981205
description: https://developer.openstack.org/api-ref/compute/?expanded=create-or-import-keypair-detail

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
setup(
2222
name='cloudify-openstack-plugin',
23-
version='3.2.18',
23+
version='3.2.19',
2424
author='Cloudify',
2525
author_email='info@cloudify.co',
2626
license='LICENSE',

0 commit comments

Comments
 (0)