Hello community,
here is the log from the commit of package aws-cli for openSUSE:Factory checked in at 2019-07-02 10:38:23
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/aws-cli (Old)
and /work/SRC/openSUSE:Factory/.aws-cli.new.4615 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "aws-cli"
Tue Jul 2 10:38:23 2019 rev:26 rq:712413 version:1.16.189
Changes:
--------
--- /work/SRC/openSUSE:Factory/aws-cli/aws-cli.changes 2019-06-27 15:25:22.741388323 +0200
+++ /work/SRC/openSUSE:Factory/.aws-cli.new.4615/aws-cli.changes 2019-07-02 10:38:24.994583707 +0200
@@ -1,0 +2,9 @@
+Fri Jun 28 12:33:49 UTC 2019 - John Paul Adrian Glaubitz
+
+- Update to version 1.16.189
+ + For detailed changes see
+ https://github.com/aws/aws-cli/blob/1.16.189/CHANGELOG.rst
+ + Forward port hide_py_pckgmgmt.patch
+ + Update Requires in spec file from setup.py
+
+-------------------------------------------------------------------
Old:
----
aws-cli-1.16.182.tar.gz
New:
----
aws-cli-1.16.189.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ aws-cli.spec ++++++
--- /var/tmp/diff_new_pack.yG5jSb/_old 2019-07-02 10:38:25.666584730 +0200
+++ /var/tmp/diff_new_pack.yG5jSb/_new 2019-07-02 10:38:25.670584736 +0200
@@ -17,7 +17,7 @@
Name: aws-cli
-Version: 1.16.182
+Version: 1.16.189
Release: 0
Summary: Amazon Web Services Command Line Interface
License: Apache-2.0
@@ -30,7 +30,7 @@
Requires: python3
Requires: python3-PyYAML <= 6.0.0
Requires: python3-PyYAML >= 3.10
-Requires: python3-botocore >= 1.12.172
+Requires: python3-botocore >= 1.12.179
Requires: python3-colorama <= 0.4.1
Requires: python3-colorama >= 0.2.5
Requires: python3-docutils >= 0.10
++++++ aws-cli-1.16.182.tar.gz -> aws-cli-1.16.189.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-cli-1.16.182/.changes/1.16.183.json new/aws-cli-1.16.189/.changes/1.16.183.json
--- old/aws-cli-1.16.182/.changes/1.16.183.json 1970-01-01 01:00:00.000000000 +0100
+++ new/aws-cli-1.16.189/.changes/1.16.183.json 2019-06-27 20:24:53.000000000 +0200
@@ -0,0 +1,32 @@
+[
+ {
+ "category": "``rds``",
+ "description": "Update rds command to latest version",
+ "type": "api-change"
+ },
+ {
+ "category": "``opsworks``",
+ "description": "Update opsworks command to latest version",
+ "type": "api-change"
+ },
+ {
+ "category": "``glue``",
+ "description": "Update glue command to latest version",
+ "type": "api-change"
+ },
+ {
+ "category": "``acm-pca``",
+ "description": "Update acm-pca command to latest version",
+ "type": "api-change"
+ },
+ {
+ "category": "``health``",
+ "description": "Update health command to latest version",
+ "type": "api-change"
+ },
+ {
+ "category": "``iotevents-data``",
+ "description": "Update iotevents-data command to latest version",
+ "type": "api-change"
+ }
+]
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-cli-1.16.182/.changes/1.16.184.json new/aws-cli-1.16.189/.changes/1.16.184.json
--- old/aws-cli-1.16.182/.changes/1.16.184.json 1970-01-01 01:00:00.000000000 +0100
+++ new/aws-cli-1.16.189/.changes/1.16.184.json 2019-06-27 20:24:53.000000000 +0200
@@ -0,0 +1,22 @@
+[
+ {
+ "category": "``mediapackage``",
+ "description": "Update mediapackage command to latest version",
+ "type": "api-change"
+ },
+ {
+ "category": "``devicefarm``",
+ "description": "Update devicefarm command to latest version",
+ "type": "api-change"
+ },
+ {
+ "category": "``kinesis-video-media``",
+ "description": "Update kinesis-video-media command to latest version",
+ "type": "api-change"
+ },
+ {
+ "category": "``iam``",
+ "description": "Update iam command to latest version",
+ "type": "api-change"
+ }
+]
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-cli-1.16.182/.changes/1.16.185.json new/aws-cli-1.16.189/.changes/1.16.185.json
--- old/aws-cli-1.16.182/.changes/1.16.185.json 1970-01-01 01:00:00.000000000 +0100
+++ new/aws-cli-1.16.189/.changes/1.16.185.json 2019-06-27 20:24:53.000000000 +0200
@@ -0,0 +1,47 @@
+[
+ {
+ "category": "``apigateway``",
+ "description": "Update apigateway command to latest version",
+ "type": "api-change"
+ },
+ {
+ "category": "``ssm``",
+ "description": "Update ssm command to latest version",
+ "type": "api-change"
+ },
+ {
+ "category": "``apigatewayv2``",
+ "description": "Update apigatewayv2 command to latest version",
+ "type": "api-change"
+ },
+ {
+ "category": "``elbv2``",
+ "description": "Update elbv2 command to latest version",
+ "type": "api-change"
+ },
+ {
+ "category": "``application-insights``",
+ "description": "Update application-insights command to latest version",
+ "type": "api-change"
+ },
+ {
+ "category": "``fsx``",
+ "description": "Update fsx command to latest version",
+ "type": "api-change"
+ },
+ {
+ "category": "``service-quotas``",
+ "description": "Update service-quotas command to latest version",
+ "type": "api-change"
+ },
+ {
+ "category": "``resourcegroupstaggingapi``",
+ "description": "Update resourcegroupstaggingapi command to latest version",
+ "type": "api-change"
+ },
+ {
+ "category": "``securityhub``",
+ "description": "Update securityhub command to latest version",
+ "type": "api-change"
+ }
+]
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-cli-1.16.182/.changes/1.16.186.json new/aws-cli-1.16.189/.changes/1.16.186.json
--- old/aws-cli-1.16.182/.changes/1.16.186.json 1970-01-01 01:00:00.000000000 +0100
+++ new/aws-cli-1.16.189/.changes/1.16.186.json 2019-06-27 20:24:53.000000000 +0200
@@ -0,0 +1,12 @@
+[
+ {
+ "category": "``ec2``",
+ "description": "Update ec2 command to latest version",
+ "type": "api-change"
+ },
+ {
+ "category": "``eks``",
+ "description": "Update eks command to latest version",
+ "type": "api-change"
+ }
+]
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-cli-1.16.182/.changes/1.16.187.json new/aws-cli-1.16.189/.changes/1.16.187.json
--- old/aws-cli-1.16.182/.changes/1.16.187.json 1970-01-01 01:00:00.000000000 +0100
+++ new/aws-cli-1.16.189/.changes/1.16.187.json 2019-06-27 20:24:53.000000000 +0200
@@ -0,0 +1,12 @@
+[
+ {
+ "category": "``apigatewayv2``",
+ "description": "Update apigatewayv2 command to latest version",
+ "type": "api-change"
+ },
+ {
+ "category": "``codecommit``",
+ "description": "Update codecommit command to latest version",
+ "type": "api-change"
+ }
+]
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-cli-1.16.182/.changes/1.16.188.json new/aws-cli-1.16.189/.changes/1.16.188.json
--- old/aws-cli-1.16.182/.changes/1.16.188.json 1970-01-01 01:00:00.000000000 +0100
+++ new/aws-cli-1.16.189/.changes/1.16.188.json 2019-06-27 20:24:53.000000000 +0200
@@ -0,0 +1,7 @@
+[
+ {
+ "category": "``dynamodb``",
+ "description": "Update dynamodb command to latest version",
+ "type": "api-change"
+ }
+]
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-cli-1.16.182/.changes/1.16.189.json new/aws-cli-1.16.189/.changes/1.16.189.json
--- old/aws-cli-1.16.182/.changes/1.16.189.json 1970-01-01 01:00:00.000000000 +0100
+++ new/aws-cli-1.16.189/.changes/1.16.189.json 2019-06-27 20:24:53.000000000 +0200
@@ -0,0 +1,22 @@
+[
+ {
+ "category": "``pinpoint``",
+ "description": "Update pinpoint command to latest version",
+ "type": "api-change"
+ },
+ {
+ "category": "``workspaces``",
+ "description": "Update workspaces command to latest version",
+ "type": "api-change"
+ },
+ {
+ "category": "``directconnect``",
+ "description": "Update directconnect command to latest version",
+ "type": "api-change"
+ },
+ {
+ "category": "``ec2-instance-connect``",
+ "description": "Update ec2-instance-connect command to latest version",
+ "type": "api-change"
+ }
+]
\ No newline at end of file
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-cli-1.16.182/CHANGELOG.rst new/aws-cli-1.16.189/CHANGELOG.rst
--- old/aws-cli-1.16.182/CHANGELOG.rst 2019-06-19 21:39:25.000000000 +0200
+++ new/aws-cli-1.16.189/CHANGELOG.rst 2019-06-27 20:24:53.000000000 +0200
@@ -2,6 +2,69 @@
CHANGELOG
=========
+1.16.189
+========
+
+* api-change:``pinpoint``: Update pinpoint command to latest version
+* api-change:``workspaces``: Update workspaces command to latest version
+* api-change:``directconnect``: Update directconnect command to latest version
+* api-change:``ec2-instance-connect``: Update ec2-instance-connect command to latest version
+
+
+1.16.188
+========
+
+* api-change:``dynamodb``: Update dynamodb command to latest version
+
+
+1.16.187
+========
+
+* api-change:``apigatewayv2``: Update apigatewayv2 command to latest version
+* api-change:``codecommit``: Update codecommit command to latest version
+
+
+1.16.186
+========
+
+* api-change:``ec2``: Update ec2 command to latest version
+* api-change:``eks``: Update eks command to latest version
+
+
+1.16.185
+========
+
+* api-change:``apigateway``: Update apigateway command to latest version
+* api-change:``ssm``: Update ssm command to latest version
+* api-change:``apigatewayv2``: Update apigatewayv2 command to latest version
+* api-change:``elbv2``: Update elbv2 command to latest version
+* api-change:``application-insights``: Update application-insights command to latest version
+* api-change:``fsx``: Update fsx command to latest version
+* api-change:``service-quotas``: Update service-quotas command to latest version
+* api-change:``resourcegroupstaggingapi``: Update resourcegroupstaggingapi command to latest version
+* api-change:``securityhub``: Update securityhub command to latest version
+
+
+1.16.184
+========
+
+* api-change:``mediapackage``: Update mediapackage command to latest version
+* api-change:``devicefarm``: Update devicefarm command to latest version
+* api-change:``kinesis-video-media``: Update kinesis-video-media command to latest version
+* api-change:``iam``: Update iam command to latest version
+
+
+1.16.183
+========
+
+* api-change:``rds``: Update rds command to latest version
+* api-change:``opsworks``: Update opsworks command to latest version
+* api-change:``glue``: Update glue command to latest version
+* api-change:``acm-pca``: Update acm-pca command to latest version
+* api-change:``health``: Update health command to latest version
+* api-change:``iotevents-data``: Update iotevents-data command to latest version
+
+
1.16.182
========
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-cli-1.16.182/awscli/__init__.py new/aws-cli-1.16.189/awscli/__init__.py
--- old/aws-cli-1.16.182/awscli/__init__.py 2019-06-19 21:39:25.000000000 +0200
+++ new/aws-cli-1.16.189/awscli/__init__.py 2019-06-27 20:24:53.000000000 +0200
@@ -17,7 +17,7 @@
"""
import os
-__version__ = '1.16.182'
+__version__ = '1.16.189'
#
# Get our data path to be added to botocore's search path
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-cli-1.16.182/awscli/customizations/eks/get_token.py new/aws-cli-1.16.189/awscli/customizations/eks/get_token.py
--- old/aws-cli-1.16.182/awscli/customizations/eks/get_token.py 2019-06-19 21:39:25.000000000 +0200
+++ new/aws-cli-1.16.189/awscli/customizations/eks/get_token.py 2019-06-27 20:24:53.000000000 +0200
@@ -14,7 +14,7 @@
import botocore
import json
-from botocore import session
+from datetime import datetime, timedelta
from botocore.signers import RequestSigner
from botocore.model import ServiceId
@@ -29,6 +29,8 @@
# Presigned url timeout in seconds
URL_TIMEOUT = 60
+TOKEN_EXPIRATION_MINS = 14
+
TOKEN_PREFIX = 'k8s-aws-v1.'
CLUSTER_NAME_HEADER = 'x-k8s-aws-id'
@@ -54,18 +56,30 @@
}
]
- def _run_main(self, parsed_args, parsed_globals):
- token_generator = TokenGenerator(parsed_globals.region)
+ def get_expiration_time(self):
+ token_expiration = datetime.utcnow() + timedelta(minutes=TOKEN_EXPIRATION_MINS)
+ return token_expiration.strftime('%Y-%m-%dT%H:%M:%SZ')
+
+ def _run_main(self, parsed_args, parsed_globals, token_generator=None):
+ if token_generator is None:
+ token_generator = TokenGenerator(self._session)
token = token_generator.get_token(
parsed_args.cluster_name,
- parsed_args.role_arn
+ parsed_args.role_arn,
+ parsed_globals.region,
)
+ # By default STS signs the url for 15 minutes so we are creating a
+ # rfc3339 timestamp with expiration in 14 minutes as part of the token, which
+ # is used by some clients (client-go) who will refresh the token after 14 mins
+ token_expiration = self.get_expiration_time()
+
full_object = {
"kind": "ExecCredential",
"apiVersion": "client.authentication.k8s.io/v1alpha1",
"spec": {},
"status": {
+ "expirationTimestamp": token_expiration,
"token": token
}
}
@@ -74,37 +88,34 @@
uni_print('\n')
class TokenGenerator(object):
- def __init__(self, region_name, session_handler=None):
- if session_handler is None:
- session_handler = SessionHandler()
- self._session_handler = session_handler
- self._region_name = region_name
+ def __init__(self, botocore_session):
+ self._session_handler = SessionHandler(botocore_session)
- def get_token(self, cluster_name, role_arn):
+ def get_token(self, cluster_name, role_arn, region_name=None):
""" Generate a presigned url token to pass to kubectl. """
- url = self._get_presigned_url(cluster_name, role_arn)
+ url = self._get_presigned_url(cluster_name, role_arn, region_name)
token = TOKEN_PREFIX + base64.urlsafe_b64encode(url.encode('utf-8')).decode('utf-8').rstrip('=')
return token
- def _get_presigned_url(self, cluster_name, role_arn):
+ def _get_presigned_url(self, cluster_name, role_arn, region_name=None):
session = self._session_handler.get_session(
- self._region_name,
+ region_name,
role_arn
)
- if self._region_name is None:
- self._region_name = session.get_config_variable('region')
+ if region_name is None:
+ region_name = session.get_config_variable('region')
loader = botocore.loaders.create_loader()
data = loader.load_data("endpoints")
endpoint_resolver = botocore.regions.EndpointResolver(data)
endpoint = endpoint_resolver.construct_endpoint(
AUTH_SERVICE,
- self._region_name
+ region_name
)
signer = RequestSigner(
ServiceId(AUTH_SERVICE),
- self._region_name,
+ region_name,
AUTH_SERVICE,
AUTH_SIGNING_VERSION,
session.get_credentials(),
@@ -128,11 +139,14 @@
return url
class SessionHandler(object):
+ def __init__(self, botocore_session):
+ self._session = botocore_session
+
def get_session(self, region_name, role_arn):
"""
Assumes the given role and returns a session object assuming said role.
"""
- session = botocore.session.get_session()
+ session = self._session
if region_name is not None:
session.set_config_variable('region', region_name)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-cli-1.16.182/doc/source/conf.py new/aws-cli-1.16.189/doc/source/conf.py
--- old/aws-cli-1.16.182/doc/source/conf.py 2019-06-19 21:39:25.000000000 +0200
+++ new/aws-cli-1.16.189/doc/source/conf.py 2019-06-27 20:24:53.000000000 +0200
@@ -52,7 +52,7 @@
# The short X.Y version.
version = '1.16.1'
# The full version, including alpha/beta/rc tags.
-release = '1.16.182'
+release = '1.16.189'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-cli-1.16.182/setup.cfg new/aws-cli-1.16.189/setup.cfg
--- old/aws-cli-1.16.182/setup.cfg 2019-06-19 21:39:25.000000000 +0200
+++ new/aws-cli-1.16.189/setup.cfg 2019-06-27 20:24:53.000000000 +0200
@@ -4,7 +4,7 @@
[metadata]
requires-dist =
- botocore==1.12.172
+ botocore==1.12.179
colorama>=0.2.5,<=0.3.9
docutils>=0.10
rsa>=3.1.2,<=3.5.0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-cli-1.16.182/setup.py new/aws-cli-1.16.189/setup.py
--- old/aws-cli-1.16.182/setup.py 2019-06-19 21:39:25.000000000 +0200
+++ new/aws-cli-1.16.189/setup.py 2019-06-27 20:24:53.000000000 +0200
@@ -23,7 +23,7 @@
raise RuntimeError("Unable to find version string.")
-requires = ['botocore==1.12.172',
+requires = ['botocore==1.12.179',
'colorama>=0.2.5,<=0.3.9',
'docutils>=0.10',
'rsa>=3.1.2,<=3.5.0',
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/aws-cli-1.16.182/tests/unit/customizations/eks/test_get_token.py new/aws-cli-1.16.189/tests/unit/customizations/eks/test_get_token.py
--- old/aws-cli-1.16.182/tests/unit/customizations/eks/test_get_token.py 2019-06-19 21:39:25.000000000 +0200
+++ new/aws-cli-1.16.189/tests/unit/customizations/eks/test_get_token.py 2019-06-27 20:24:53.000000000 +0200
@@ -12,10 +12,11 @@
# language governing permissions and limitations under the License.
import mock
-from mock import patch
+from mock import patch, call
import base64
-import datetime
import botocore
+import json
+from datetime import datetime
from awscli.testutils import unittest, capture_output
from awscli.customizations.eks.get_token import (
@@ -27,7 +28,6 @@
REGION = 'us-west-2'
SIGN_REGION = 'us-east-1'
CLUSTER_NAME = 'MyCluster'
-DATE_STRING = datetime.date.today().strftime('%Y%m%d')
TOKEN_PREFIX = "k8s-aws-v1."
CREDENTIALS = 'ABCDEFGHIJKLMNOPQRST'
@@ -40,43 +40,49 @@
if is_session:
self.assertIn("X-Amz-Security-Token=" + SESSION_TOKEN + "&", url_no_signature)
+ else:
+ self.assertNotIn("X-Amz-Security-Token=" + SESSION_TOKEN + "&", url_no_signature)
self.assertIn("X-Amz-Credential=" + CREDENTIALS + "%2F", url_no_signature)
self.assertIn("%3Bx-k8s-aws-id&", url_no_signature)
def setUp(self):
- self._session_handler = mock.Mock()
-
session = botocore.session.get_session()
session.set_credentials(CREDENTIALS, SECRET_KEY)
self._session = session
- self._session_handler.get_session = mock.Mock(return_value=self._session)
-
- self._assuming_handler = mock.Mock()
- # While assuming a role, you have a session token
- assuming_session = botocore.session.get_session()
- assuming_session.set_credentials(CREDENTIALS, SECRET_KEY, SESSION_TOKEN)
- self._assuming_session = assuming_session
-
- self._assuming_handler.get_session = mock.Mock(return_value=self._assuming_session)
+ self.mock_sts_client = mock.Mock()
+ self.mock_sts_client.assume_role.return_value = {
+ "Credentials": {
+ "AccessKeyId": CREDENTIALS,
+ "SecretAccessKey": SECRET_KEY,
+ "SessionToken": SESSION_TOKEN,
+ },
+ }
self.maxDiff = None
def test_url(self):
- generator = TokenGenerator(REGION, self._session_handler)
- url = generator._get_presigned_url(CLUSTER_NAME, None)
+ generator = TokenGenerator(self._session)
+ url = generator._get_presigned_url(CLUSTER_NAME, None, REGION)
self.assert_url_correct(url, False)
- def test_url_sess(self):
- generator = TokenGenerator(REGION, self._assuming_handler)
- url = generator._get_presigned_url(CLUSTER_NAME, "RoleArn")
- print("URL: " + url)
+ def test_url_no_region(self):
+ self._session.set_config_variable('region', 'us-east-1')
+ generator = TokenGenerator(self._session)
+ url = generator._get_presigned_url(CLUSTER_NAME, None, None)
+ self.assert_url_correct(url, False)
+
+ @patch.object(botocore.session.Session, 'create_client')
+ def test_url_with_role(self, mock_create_client):
+ mock_create_client.return_value = self.mock_sts_client
+ generator = TokenGenerator(self._session)
+ url = generator._get_presigned_url(CLUSTER_NAME, "arn:aws:iam::012345678910:role/RoleArn", REGION)
self.assert_url_correct(url, True)
- def test_token(self):
- generator = TokenGenerator(REGION, self._session_handler)
- token = generator.get_token(CLUSTER_NAME, None)
+ def test_token_no_role(self):
+ generator = TokenGenerator(self._session)
+ token = generator.get_token(CLUSTER_NAME, None, REGION)
prefix = token[:len(TOKEN_PREFIX)]
self.assertEqual(prefix, TOKEN_PREFIX)
token_no_prefix = token[len(TOKEN_PREFIX):]
@@ -88,13 +94,16 @@
@patch.object(TokenGenerator, '_get_presigned_url', return_value='aHR0cHM6Ly9zdHMuYW1hem9uYXdzLmNvbS8=')
def test_token_no_padding(self, mock_presigned_url):
- generator = TokenGenerator(REGION, self._session_handler)
- tok = generator.get_token(CLUSTER_NAME, None)
+ generator = TokenGenerator(self._session)
+ tok = generator.get_token(CLUSTER_NAME, None, REGION)
self.assertTrue('=' not in tok)
- def test_token_sess(self):
- generator = TokenGenerator(REGION, self._assuming_handler)
- token = generator.get_token(CLUSTER_NAME, "RoleArn")
+ @patch.object(botocore.session.Session, 'create_client')
+ def test_token_sess(self, mock_create_client):
+ mock_create_client.return_value = self.mock_sts_client
+
+ generator = TokenGenerator(self._session)
+ token = generator.get_token(CLUSTER_NAME, "arn:aws:iam::012345678910:role/RoleArn", REGION)
prefix = token[:len(TOKEN_PREFIX)]
self.assertEqual(prefix, TOKEN_PREFIX)
token_no_prefix = token[len(TOKEN_PREFIX):]
@@ -103,3 +112,45 @@
token_no_prefix.encode()
).decode()
self.assert_url_correct(decrypted_token, True)
+
+class TestGetTokenCommand(unittest.TestCase):
+
+ def setUp(self):
+ session = botocore.session.get_session()
+ session.set_credentials(CREDENTIALS, SECRET_KEY)
+ self._session = session
+ self.maxDiff = None
+
+ def test_get_expiration_time(self):
+ cmd = GetTokenCommand(self._session)
+ timestamp = cmd.get_expiration_time()
+ try:
+ datetime.strptime(timestamp, '%Y-%m-%dT%H:%M:%SZ')
+ except ValueError:
+ raise ValueError("Incorrect data format, should be %Y-%m-%dT%H:%M:%SZ")
+
+ @patch.object(GetTokenCommand, 'get_expiration_time', return_value='2019-06-21T22:07:54Z')
+ def test_run_main(self, mock_expiration_time):
+ mock_token_generator = mock.Mock()
+ fake_token = 'k8s-aws-v1.aHR0cHM6Ly9zdHMuYW1hem9uYXdzLmNvbS8='
+ mock_token_generator.get_token.return_value = fake_token
+
+ mock_args = mock.Mock()
+ mock_args.cluster_name = "my-cluster"
+ mock_args.role_arn = None
+
+ mock_globals = mock.Mock()
+ mock_globals.region = 'us-west-2'
+
+ expected_stdout = json.dumps({
+ "kind": "ExecCredential",
+ "apiVersion": "client.authentication.k8s.io/v1alpha1", "spec": {},
+ "status": {
+ "expirationTimestamp": "2019-06-21T22:07:54Z",
+ "token": fake_token,
+ },
+ }) +'\n'
+ cmd = GetTokenCommand(self._session)
+ with capture_output() as captured:
+ cmd._run_main(mock_args, mock_globals, mock_token_generator)
+ self.assertEqual(expected_stdout, captured.stdout.getvalue())
++++++ hide_py_pckgmgmt.patch ++++++
--- /var/tmp/diff_new_pack.yG5jSb/_old 2019-07-02 10:38:26.310585711 +0200
+++ /var/tmp/diff_new_pack.yG5jSb/_new 2019-07-02 10:38:26.314585716 +0200
@@ -1,10 +1,10 @@
---- setup.py.orig 2019-06-19 21:39:25.000000000 +0200
-+++ setup.py 2019-06-20 14:50:23.155273311 +0200
+--- setup.py.orig 2019-06-27 20:24:53.000000000 +0200
++++ setup.py 2019-06-28 14:32:23.056466861 +0200
@@ -23,23 +23,23 @@
raise RuntimeError("Unable to find version string.")
--requires = ['botocore==1.12.172',
+-requires = ['botocore==1.12.179',
- 'colorama>=0.2.5,<=0.3.9',
- 'docutils>=0.10',
- 'rsa>=3.1.2,<=3.5.0',
@@ -21,7 +21,7 @@
- requires.append('PyYAML>=3.10,<=3.13')
-else:
- requires.append('PyYAML>=3.10,<=5.1')
-+# requires = ['botocore==1.12.172',
++# requires = ['botocore==1.12.179',
+# 'colorama>=0.2.5,<=0.3.9',
+# 'docutils>=0.10',
+# 'rsa>=3.1.2,<=3.5.0',