diff --git a/boto-2.40.0-instance-attributes.patch b/boto-2.40.0-instance-attributes.patch new file mode 100644 index 0000000..4f9182e --- /dev/null +++ b/boto-2.40.0-instance-attributes.patch @@ -0,0 +1,91 @@ +Index: boto-2.40.0/boto/ec2/instance.py +=================================================================== +--- boto-2.40.0.orig/boto/ec2/instance.py ++++ boto-2.40.0/boto/ec2/instance.py +@@ -631,7 +631,8 @@ class InstanceAttribute(dict): + 'disableApiTermination', + 'instanceInitiatedShutdownBehavior', + 'rootDeviceName', 'blockDeviceMapping', 'sourceDestCheck', +- 'groupSet'] ++ 'groupSet', 'productCodes', 'ebsOptimized', ++ 'sriovNetSupport'] + + def __init__(self, parent=None): + dict.__init__(self) +Index: boto-2.40.0/tests/unit/ec2/test_attribute.py +=================================================================== +--- /dev/null ++++ boto-2.40.0/tests/unit/ec2/test_attribute.py +@@ -0,0 +1,72 @@ ++from tests.unit import unittest ++from tests.compat import mock ++ ++from boto.ec2.connection import EC2Connection, Instance ++ ++ATTRIBUTE_GET_TRUE_EBSOPTIMIZED_RESPONSE = b""" ++ ++ 59dbff89-35bd-4eac-99ed-be587EXAMPLE ++ i-10a64379 ++ ++ true ++ ++ ++""" ++ ++ATTRIBUTE_GET_FALSE_EBSOPTIMIZED_RESPONSE = b""" ++ ++ 59dbff89-35bd-4eac-99ed-be587EXAMPLE ++ i-10a64379 ++ ++ false ++ ++ ++""" ++ ++ATTRIBUTE_GET_EMPTY_PRODUCTCODES_RESPONSE = b""" ++ ++ 59dbff89-35bd-4eac-99ed-be587EXAMPLE ++ i-10a64379 ++ ++ ++""" ++ ++# Tests to be run on an InstanceAttributes ++# Format: ++# (EC2_RESPONSE_STRING, (string_of_attribute_to_test, value) ) ++ATTRIBUTE_TESTS = [ ++ (ATTRIBUTE_GET_TRUE_EBSOPTIMIZED_RESPONSE, ++ ('ebsOptimized', True)), ++ (ATTRIBUTE_GET_FALSE_EBSOPTIMIZED_RESPONSE, ++ ('ebsOptimized', False)), ++ (ATTRIBUTE_GET_EMPTY_PRODUCTCODES_RESPONSE, ++ ('productCodes', None)), ++] ++ ++ ++class TestInstanceAttributes(unittest.TestCase): ++ """Tests Instance Attributes.""" ++ def _setup_mock(self): ++ """Sets up a mock ec2 request. ++ Returns: response, ec2 connection and Instance ++ """ ++ mock_response = mock.Mock() ++ mock_response.status = 200 ++ ec2 = EC2Connection(aws_access_key_id='aws_access_key_id', ++ aws_secret_access_key='aws_secret_access_key') ++ ec2.make_request = mock.Mock(return_value=mock_response) ++ return mock_response, ec2, Instance(ec2) ++ ++ def test_instance_get_attributes(self): ++ """Tests the InstanceAttributes from the EC2 object.""" ++ mock_response, _, instance = self._setup_mock() ++ ++ for response, attr_test in ATTRIBUTE_TESTS: ++ mock_response.read.return_value = response ++ expected_value = dict([attr_test]) ++ actual_value = instance.get_attribute(attr_test[0]) ++ self.assertEqual(expected_value, actual_value) ++ ++ ++if __name__ == '__main__': ++ unittest.main() diff --git a/python-boto.spec b/python-boto.spec index 6f500e5..ba17793 100644 --- a/python-boto.spec +++ b/python-boto.spec @@ -51,6 +51,11 @@ Patch4: boto-2.40.0-retry-float.patch # https://github.com/boto/boto/pull/3332 Patch5: boto-2.40.0-aws-exec-read.patch +# Add new instance attributes +# https://github.com/boto/boto/pull/3077 +# https://github.com/boto/boto/pull/3131 +Patch6: boto-2.40.0-instance-attributes.patch + BuildRequires: python2-devel BuildRequires: python-setuptools BuildRequires: python-six @@ -135,6 +140,7 @@ cloud systems like Eucalyptus, OpenStack and Open Nebula. %patch3 -p1 %patch4 -p1 %patch5 -p1 +%patch6 -p1 rm -r boto/vendored @@ -199,6 +205,7 @@ mv $RPM_BUILD_ROOT/%{_bindir} examples - Fixed sigv4 protocol selection - Fixed max_retry_delay config option - Added aws-exec-read to S3's canned ACL list +- Added new instance attributes * Mon May 23 2016 Jon Ciesla - 2.40.0-1 - 2.40.0.