From 7b096d690fc203baf3047cb23fece50f3b188756 Mon Sep 17 00:00:00 2001 From: acsbendi Date: Sat, 13 Jul 2019 15:04:41 +0200 Subject: [PATCH] Replaced print with log.debug. --- moto/core/authentication.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/moto/core/authentication.py b/moto/core/authentication.py index 324f8db2a..dd9471628 100644 --- a/moto/core/authentication.py +++ b/moto/core/authentication.py @@ -1,6 +1,6 @@ import json +import logging import re -import sys from abc import ABC, abstractmethod from enum import Enum @@ -15,6 +15,8 @@ from moto.core.exceptions import SignatureDoesNotMatchError, AccessDeniedError, from moto.s3.exceptions import BucketAccessDeniedError, S3AccessDeniedError, BucketInvalidTokenError, S3InvalidTokenError, S3InvalidAccessKeyIdError, BucketInvalidAccessKeyIdError from moto.sts import sts_backend +log = logging.getLogger(__name__) + def create_access_key(access_key_id, headers): if access_key_id.startswith("AKIA") or "X-Amz-Security-Token" not in headers: @@ -122,9 +124,8 @@ class CreateAccessKeyFailure(Exception): class IAMRequestBase(ABC): def __init__(self, method, path, data, headers): - print("Creating {class_name} with method={method}, path={path}, data={data}, headers={headers}".format( - class_name=self.__class__.__name__, method=method, path=path, data=data, headers=headers), - file=sys.stderr) + log.debug("Creating {class_name} with method={method}, path={path}, data={data}, headers={headers}".format( + class_name=self.__class__.__name__, method=method, path=path, data=data, headers=headers)) self._method = method self._path = path self._data = data @@ -314,7 +315,7 @@ class IAMPolicyStatement: @staticmethod def _match(pattern, string): pattern = pattern.replace("*", ".*") - pattern = f"^{pattern}$" + pattern = "^{pattern}$".format(pattern=pattern) return re.match(pattern, string)