diff --git a/salt/cloud/clouds/ec2.py b/salt/cloud/clouds/ec2.py index 03deb4eedb4..adaaf1f73fd 100644 --- a/salt/cloud/clouds/ec2.py +++ b/salt/cloud/clouds/ec2.py @@ -4887,6 +4887,8 @@ def get_password_data( ret[next(six.iterkeys(item))] = next(six.itervalues(item)) if not HAS_M2 and not HAS_PYCRYPTO: + if 'key' in kwargs or 'key_file' in kwargs: + log.warn("No crypto library is installed, can not decrypt password") return ret if 'key' not in kwargs: diff --git a/tests/unit/cloud/clouds/test_ec2.py b/tests/unit/cloud/clouds/test_ec2.py index 312b3953c3b..d6da5309014 100644 --- a/tests/unit/cloud/clouds/test_ec2.py +++ b/tests/unit/cloud/clouds/test_ec2.py @@ -66,6 +66,7 @@ class EC2TestCase(TestCase, LoaderModuleMockMixin): self.assertRaises( SaltCloudSystemExit, ec2._validate_key_path_and_mode, 'key_file') + @skipIf(not ec2.HAS_M2 and not ec2.HAS_PYCRYPTO, 'Needs crypto library') @patch('salt.cloud.clouds.ec2._get_node') @patch('salt.cloud.clouds.ec2.get_location') @patch('salt.cloud.clouds.ec2.get_provider')