ec2imgutils 10.0.2__tar.gz → 10.0.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. {ec2imgutils-10.0.2/lib/ec2imgutils.egg-info → ec2imgutils-10.0.3}/PKG-INFO +9 -2
  2. {ec2imgutils-10.0.2 → ec2imgutils-10.0.3}/ec2uploadimg +13 -2
  3. ec2imgutils-10.0.3/lib/ec2imgutils/VERSION +1 -0
  4. {ec2imgutils-10.0.2 → ec2imgutils-10.0.3}/lib/ec2imgutils/ec2uploadimg.py +16 -2
  5. {ec2imgutils-10.0.2 → ec2imgutils-10.0.3/lib/ec2imgutils.egg-info}/PKG-INFO +9 -2
  6. {ec2imgutils-10.0.2 → ec2imgutils-10.0.3}/lib/ec2imgutils.egg-info/requires.txt +1 -1
  7. {ec2imgutils-10.0.2 → ec2imgutils-10.0.3}/man/man1/ec2uploadimg.1 +12 -2
  8. {ec2imgutils-10.0.2 → ec2imgutils-10.0.3}/requirements.txt +1 -1
  9. {ec2imgutils-10.0.2 → ec2imgutils-10.0.3}/setup.cfg +1 -1
  10. {ec2imgutils-10.0.2 → ec2imgutils-10.0.3}/tests/test_ec2uploadimg.py +8 -2
  11. {ec2imgutils-10.0.2 → ec2imgutils-10.0.3}/tests/test_libec2uploadimg.py +40 -3
  12. ec2imgutils-10.0.2/lib/ec2imgutils/VERSION +0 -1
  13. {ec2imgutils-10.0.2 → ec2imgutils-10.0.3}/LICENSE +0 -0
  14. {ec2imgutils-10.0.2 → ec2imgutils-10.0.3}/MANIFEST.in +0 -0
  15. {ec2imgutils-10.0.2 → ec2imgutils-10.0.3}/Makefile +0 -0
  16. {ec2imgutils-10.0.2 → ec2imgutils-10.0.3}/README.md +0 -0
  17. {ec2imgutils-10.0.2 → ec2imgutils-10.0.3}/ec2deprecateimg +0 -0
  18. {ec2imgutils-10.0.2 → ec2imgutils-10.0.3}/ec2listimg +0 -0
  19. {ec2imgutils-10.0.2 → ec2imgutils-10.0.3}/ec2publishimg +0 -0
  20. {ec2imgutils-10.0.2 → ec2imgutils-10.0.3}/ec2removeimg +0 -0
  21. {ec2imgutils-10.0.2 → ec2imgutils-10.0.3}/lib/ec2imgutils/__init__.py +0 -0
  22. {ec2imgutils-10.0.2 → ec2imgutils-10.0.3}/lib/ec2imgutils/ec2deprecateimg.py +0 -0
  23. {ec2imgutils-10.0.2 → ec2imgutils-10.0.3}/lib/ec2imgutils/ec2imgutils.py +0 -0
  24. {ec2imgutils-10.0.2 → ec2imgutils-10.0.3}/lib/ec2imgutils/ec2imgutilsExceptions.py +0 -0
  25. {ec2imgutils-10.0.2 → ec2imgutils-10.0.3}/lib/ec2imgutils/ec2listimg.py +0 -0
  26. {ec2imgutils-10.0.2 → ec2imgutils-10.0.3}/lib/ec2imgutils/ec2publishimg.py +0 -0
  27. {ec2imgutils-10.0.2 → ec2imgutils-10.0.3}/lib/ec2imgutils/ec2removeimg.py +0 -0
  28. {ec2imgutils-10.0.2 → ec2imgutils-10.0.3}/lib/ec2imgutils/ec2setup.py +0 -0
  29. {ec2imgutils-10.0.2 → ec2imgutils-10.0.3}/lib/ec2imgutils/ec2utils.py +0 -0
  30. {ec2imgutils-10.0.2 → ec2imgutils-10.0.3}/lib/ec2imgutils.egg-info/SOURCES.txt +0 -0
  31. {ec2imgutils-10.0.2 → ec2imgutils-10.0.3}/lib/ec2imgutils.egg-info/dependency_links.txt +0 -0
  32. {ec2imgutils-10.0.2 → ec2imgutils-10.0.3}/lib/ec2imgutils.egg-info/top_level.txt +0 -0
  33. {ec2imgutils-10.0.2 → ec2imgutils-10.0.3}/man/man1/ec2deprecateimg.1 +0 -0
  34. {ec2imgutils-10.0.2 → ec2imgutils-10.0.3}/man/man1/ec2listimg.1 +0 -0
  35. {ec2imgutils-10.0.2 → ec2imgutils-10.0.3}/man/man1/ec2publishimg.1 +0 -0
  36. {ec2imgutils-10.0.2 → ec2imgutils-10.0.3}/man/man1/ec2removeimg.1 +0 -0
  37. {ec2imgutils-10.0.2 → ec2imgutils-10.0.3}/requirements-dev.txt +0 -0
  38. {ec2imgutils-10.0.2 → ec2imgutils-10.0.3}/setup.py +0 -0
  39. {ec2imgutils-10.0.2 → ec2imgutils-10.0.3}/tests/data/complete.cfg +0 -0
  40. {ec2imgutils-10.0.2 → ec2imgutils-10.0.3}/tests/data/invalid.cfg +0 -0
  41. {ec2imgutils-10.0.2 → ec2imgutils-10.0.3}/tests/test_ec2deprecateimg.py +0 -0
  42. {ec2imgutils-10.0.2 → ec2imgutils-10.0.3}/tests/test_ec2listimg.py +0 -0
  43. {ec2imgutils-10.0.2 → ec2imgutils-10.0.3}/tests/test_ec2publishimg.py +0 -0
  44. {ec2imgutils-10.0.2 → ec2imgutils-10.0.3}/tests/test_ec2removeimg.py +0 -0
  45. {ec2imgutils-10.0.2 → ec2imgutils-10.0.3}/tests/test_ec2utilsutils.py +0 -0
  46. {ec2imgutils-10.0.2 → ec2imgutils-10.0.3}/tests/test_libec2deprecateimg.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ec2imgutils
3
- Version: 10.0.2
3
+ Version: 10.0.3
4
4
  Summary: Command-line tools to manage images in AWS EC2
5
5
  Home-page: https://github.com/SUSE-Enceladus/ec2imgutils
6
6
  Author: SUSE Public Cloud Team
@@ -20,8 +20,15 @@ Classifier: Programming Language :: Python :: 3.8
20
20
  Classifier: Programming Language :: Python :: Implementation :: CPython
21
21
  Classifier: Programming Language :: Python :: Implementation :: PyPy
22
22
  Description-Content-Type: text/markdown
23
- Provides-Extra: dev
24
23
  License-File: LICENSE
24
+ Requires-Dist: boto3>=1.4.1
25
+ Requires-Dist: paramiko>=2.2.0
26
+ Requires-Dist: python-dateutil
27
+ Provides-Extra: dev
28
+ Requires-Dist: pytest; extra == "dev"
29
+ Requires-Dist: flake8; extra == "dev"
30
+ Requires-Dist: pytest-cov; extra == "dev"
31
+ Requires-Dist: bumpversion; extra == "dev"
25
32
 
26
33
  [![Build Status](https://www.travis-ci.com/SUSE-Enceladus/ec2imgutils.svg?branch=master)](https://www.travis-ci.com/SUSE-Enceladus/ec2imgutils)
27
34
 
@@ -150,6 +150,16 @@ def parse_args(args):
150
150
  dest='grub2',
151
151
  help='The image uses the GRUB2 bootloader (Optional)'
152
152
  )
153
+ help_msg = 'Set the protocol version to be used when instances are '
154
+ help_msg += 'launched from the image, supported values 2.0/v2.0. '
155
+ help_msg += '(Optional)'
156
+ parser.add_argument(
157
+ '--imds-support',
158
+ dest='imdsVersion',
159
+ help=help_msg,
160
+ choices=['', '2.0', 'v2.0'],
161
+ metavar='IMDS_VERSION'
162
+ )
153
163
  parser.add_argument(
154
164
  '-i', '--instance-id',
155
165
  dest='runningID',
@@ -244,7 +254,7 @@ def parse_args(args):
244
254
  metavar='SSH_TIME_OUT',
245
255
  type=int
246
256
  )
247
- help_msg = 'The image supports NitroTPM, supported value 2.0/v2.0'
257
+ help_msg = 'The image supports NitroTPM, supported values 2.0/v2.0'
248
258
  help_msg += ' (Optional)'
249
259
  parser.add_argument(
250
260
  '--tpm-support',
@@ -897,7 +907,8 @@ def get_uploader(
897
907
  wait_count=args.waitCount,
898
908
  log_callback=logger,
899
909
  boot_mode=args.bootMode,
900
- tpm_support=args.tpm
910
+ tpm_support=args.tpm,
911
+ imds_support=args.imdsVersion
901
912
  )
902
913
  return uploader
903
914
  except EC2UploadImgException as e:
@@ -0,0 +1 @@
1
+ 10.0.3
@@ -62,7 +62,8 @@ class EC2ImageUploader(EC2ImgUtils):
62
62
  log_level=logging.INFO,
63
63
  log_callback=None,
64
64
  boot_mode=None,
65
- tpm_support=None
65
+ tpm_support=None,
66
+ imds_support=None
66
67
  ):
67
68
  EC2ImgUtils.__init__(
68
69
  self,
@@ -80,6 +81,7 @@ class EC2ImageUploader(EC2ImgUtils):
80
81
  self.image_description = image_description
81
82
  self.image_name = image_name
82
83
  self.image_virt_type = image_virt_type
84
+ self.imds_support = imds_support
83
85
  self.inst_user_name = inst_user_name
84
86
  self.launch_ami_id = launch_ami
85
87
  self.launch_ins_type = launch_inst_type
@@ -121,6 +123,11 @@ class EC2ImageUploader(EC2ImgUtils):
121
123
  raise EC2UploadImgException(
122
124
  'tpm_support must be one of %s' % str(tpm_versions)
123
125
  )
126
+ imds_versions = ['2.0', 'v2.0']
127
+ if imds_support and imds_support not in imds_versions:
128
+ raise EC2UploadImgException(
129
+ 'imds_support must be one of %s' % str(imds_versions)
130
+ )
124
131
 
125
132
  def abort(self):
126
133
  """
@@ -604,7 +611,9 @@ class EC2ImageUploader(EC2ImgUtils):
604
611
  key_filename=self.ssh_key_private_key_file,
605
612
  username=self.inst_user_name,
606
613
  hostname=instance_ip,
607
- timeout=10
614
+ timeout=self.ssh_timeout,
615
+ banner_timeout=self.ssh_timeout,
616
+ auth_timeout=self.ssh_timeout
608
617
  )
609
618
  except (Exception, ConnectionResetError):
610
619
  if self.log_level == logging.DEBUG:
@@ -891,6 +900,11 @@ class EC2ImageUploader(EC2ImgUtils):
891
900
  if not tpm_version.startswith('v'):
892
901
  tpm_version = 'v%s' % tpm_version
893
902
  register_args['TpmSupport'] = tpm_version
903
+ if self.imds_support:
904
+ imds_version = self.imds_support
905
+ if not imds_version.startswith('v'):
906
+ imds_version = 'v%s' % imds_version
907
+ register_args['ImdsSupport'] = imds_version
894
908
 
895
909
  ami = self._connect().register_image(**register_args)
896
910
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ec2imgutils
3
- Version: 10.0.2
3
+ Version: 10.0.3
4
4
  Summary: Command-line tools to manage images in AWS EC2
5
5
  Home-page: https://github.com/SUSE-Enceladus/ec2imgutils
6
6
  Author: SUSE Public Cloud Team
@@ -20,8 +20,15 @@ Classifier: Programming Language :: Python :: 3.8
20
20
  Classifier: Programming Language :: Python :: Implementation :: CPython
21
21
  Classifier: Programming Language :: Python :: Implementation :: PyPy
22
22
  Description-Content-Type: text/markdown
23
- Provides-Extra: dev
24
23
  License-File: LICENSE
24
+ Requires-Dist: boto3>=1.4.1
25
+ Requires-Dist: paramiko>=2.2.0
26
+ Requires-Dist: python-dateutil
27
+ Provides-Extra: dev
28
+ Requires-Dist: pytest; extra == "dev"
29
+ Requires-Dist: flake8; extra == "dev"
30
+ Requires-Dist: pytest-cov; extra == "dev"
31
+ Requires-Dist: bumpversion; extra == "dev"
25
32
 
26
33
  [![Build Status](https://www.travis-ci.com/SUSE-Enceladus/ec2imgutils.svg?branch=master)](https://www.travis-ci.com/SUSE-Enceladus/ec2imgutils)
27
34
 
@@ -1,5 +1,5 @@
1
1
  boto3>=1.4.1
2
- paramiko
2
+ paramiko>=2.2.0
3
3
  python-dateutil
4
4
 
5
5
  [dev]
@@ -85,11 +85,14 @@ or
85
85
  value in the configuration file.
86
86
  .IP "--boot-mode"
87
87
  Optionally specify the boot mode for the image. Accepted values are
88
- .I legacy-bios
88
+ .I legacy-bios,
89
+ .I uefi,
89
90
  or
90
- .I uefi .
91
+ .I uefi-preferred .
91
92
  If no boot mode is specified the default behavior for the instance type
92
93
  applies, uefi for aarch64 instances and bios for x86_64 based instances.
94
+ An image with the uefi-preferred setting will boot using uefi if the instance
95
+ type supports uefi, otherwise it will use bios.
93
96
  .IP "-d --description IMAGE_DESCRIPTION"
94
97
  Specifies a description for the image. The description will also be used for
95
98
  the snapshot.
@@ -115,6 +118,13 @@ Setting this switch will select the
115
118
  value from the configuration file or will use the value given with
116
119
  .I --boot-kernel
117
120
  as the aki ID when a para virtual image is being registered.
121
+ .IP "--imds-support"
122
+ Optionally specify the version for accessing the Instance MetaData Service
123
+ (IMDS). The default is to access the IMDS using the version 1.0 implementation.
124
+ Accepted values are
125
+ .I 2.0
126
+ alternatively prefixed with a
127
+ .I "v".
118
128
  .IP "-m --machine ARCH"
119
129
  Specifies the architecture for the VM to be created. Supported values
120
130
  are
@@ -1,3 +1,3 @@
1
1
  boto3>=1.4.1
2
- paramiko
2
+ paramiko>=2.2.0
3
3
  python-dateutil
@@ -1,5 +1,5 @@
1
1
  [bumpversion]
2
- current_version = 10.0.1
2
+ current_version = 10.0.3
3
3
  commit = True
4
4
  tag = True
5
5
 
@@ -65,6 +65,8 @@ test_cli_args_data = [
65
65
  "--file",
66
66
  "/path/to/configuration/file",
67
67
  "--grub2",
68
+ "--imds-support",
69
+ "2.0",
68
70
  "--instance-id",
69
71
  "testInstanceId",
70
72
  "--machine",
@@ -149,6 +151,7 @@ def test_args(cli_args):
149
151
  assert parsed_args.waitCount == 8
150
152
  assert parsed_args.useSnap is True
151
153
  assert parsed_args.source == "testSource"
154
+ assert parsed_args.imdsVersion == "2.0"
152
155
 
153
156
 
154
157
  # --------------------------------------------------------------------
@@ -174,6 +177,8 @@ test_cli_args_data = [
174
177
  "--file",
175
178
  "/path/to/configuration/file",
176
179
  "--grub2",
180
+ "--imds-support",
181
+ "v2.0",
177
182
  "--machine",
178
183
  "x86_64",
179
184
  "--name",
@@ -196,7 +201,7 @@ test_cli_args_data = [
196
201
  "--ssh-timeout",
197
202
  "257",
198
203
  "--tpm-support",
199
- "2.0",
204
+ "v2.0",
200
205
  "--type",
201
206
  "testType",
202
207
  "--user",
@@ -244,7 +249,7 @@ def test_args_check(cli_args):
244
249
  assert parsed_args.snapOnly is False
245
250
  assert parsed_args.sriov is True
246
251
  assert parsed_args.sshTimeout == 257
247
- assert parsed_args.tpm == "2.0"
252
+ assert parsed_args.tpm == "v2.0"
248
253
  assert parsed_args.instType == "testType"
249
254
  assert parsed_args.sshUser == "testUser"
250
255
  assert parsed_args.usePrivateIP is True
@@ -253,6 +258,7 @@ def test_args_check(cli_args):
253
258
  assert parsed_args.vpcSubnetId == "testVpcSubnetId"
254
259
  assert parsed_args.waitCount == 8
255
260
  assert parsed_args.source == "testSource"
261
+ assert parsed_args.imdsVersion == "v2.0"
256
262
 
257
263
 
258
264
  # --------------------------------------------------------------------
@@ -19,14 +19,23 @@
19
19
  # <http://www.gnu.org/licenses/>.
20
20
  #
21
21
 
22
+ import inspect
22
23
  import logging
24
+ import os
23
25
  import pytest
26
+ import sys
27
+
24
28
 
25
29
  from unittest.mock import patch, MagicMock, call
26
30
 
27
- import ec2imgutils.ec2uploadimg as ec2upimg
31
+ # Load the module from the source tree not the one on the system
32
+ test_path = os.path.abspath(
33
+ os.path.dirname(inspect.getfile(inspect.currentframe())))
34
+ code_path = os.path.abspath('%s/../lib' % test_path)
35
+ sys.path.insert(0, code_path)
28
36
 
29
- from ec2imgutils.ec2imgutilsExceptions import (
37
+ import ec2imgutils.ec2uploadimg as ec2upimg # noqa: E402
38
+ from ec2imgutils.ec2imgutilsExceptions import ( # noqa: E402
30
39
  EC2UploadImgException
31
40
  )
32
41
 
@@ -1486,7 +1495,9 @@ def test_establish_ssh_connection(
1486
1495
  key_filename=None,
1487
1496
  username=None,
1488
1497
  hostname='1.2.3.4',
1489
- timeout=10
1498
+ timeout=300,
1499
+ banner_timeout=300,
1500
+ auth_timeout=300
1490
1501
  ),
1491
1502
  ])
1492
1503
 
@@ -2097,3 +2108,29 @@ def test_create_image_use_root_swap(
2097
2108
  show_progress_mock.assert_has_calls([call(), call()])
2098
2109
  detach_volume_mock.assert_has_calls([call(None)])
2099
2110
  attach_volume_mock.assert_has_calls([call('targetRootVol', None)])
2111
+
2112
+
2113
+ def test_invalid_tpm_value():
2114
+ with pytest.raises(EC2UploadImgException) as e:
2115
+ # Instance creation
2116
+ ec2upimg.EC2ImageUploader(
2117
+ access_key='',
2118
+ wait_count=1,
2119
+ log_callback=logger,
2120
+ tpm_support='1'
2121
+ )
2122
+ msg = "tpm_support must be one of ['2.0', 'v2.0']"
2123
+ assert msg in str(e)
2124
+
2125
+
2126
+ def test_invalid_imds_value():
2127
+ with pytest.raises(EC2UploadImgException) as e:
2128
+ # Instance creation
2129
+ ec2upimg.EC2ImageUploader(
2130
+ access_key='',
2131
+ wait_count=1,
2132
+ log_callback=logger,
2133
+ imds_support='1'
2134
+ )
2135
+ msg = "imds_support must be one of ['2.0', 'v2.0']"
2136
+ assert msg in str(e)
@@ -1 +0,0 @@
1
- 10.0.2
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes