Fix flake8, black and pylint errors in code
Change-Id: Ic03f4d31e2ba9801be20d3679bd5749948cab39d
Signed-off-by: garciadeblas <gerardo.garciadeblas@telefonica.com>
diff --git a/osm_ee/util/util_ansible.py b/osm_ee/util/util_ansible.py
index 8f27875..37ed18b 100644
--- a/osm_ee/util/util_ansible.py
+++ b/osm_ee/util/util_ansible.py
@@ -29,12 +29,15 @@
logger = logging.getLogger("osm_ee.util_ansible")
-async def execute_playbook(playbook_name: str, inventory: str, extra_vars: dict,
- ) -> (int, str):
+async def execute_playbook(
+ playbook_name: str,
+ inventory: str,
+ extra_vars: dict,
+) -> (int, str):
- command = 'ansible-playbook --inventory={} --extra-vars {} {}'.format(quote(inventory),
- quote(json.dumps(extra_vars)),
- quote(playbook_name))
+ command = "ansible-playbook --inventory={} --extra-vars {} {}".format(
+ quote(inventory), quote(json.dumps(extra_vars)), quote(playbook_name)
+ )
logger.debug("Command to be executed: {}".format(command))
diff --git a/osm_ee/util/util_ee.py b/osm_ee/util/util_ee.py
index 1d0a232..915e97f 100644
--- a/osm_ee/util/util_ee.py
+++ b/osm_ee/util/util_ee.py
@@ -27,19 +27,16 @@
logger = logging.getLogger("osm_ee.util")
-async def local_async_exec(command: str
- ) -> (int, str, str):
+async def local_async_exec(command: str) -> (int, str, str):
"""
- Executed a local command using asyncio.
- TODO - do not know yet if return error code, and stdout and strerr or just one of them
+ Executed a local command using asyncio.
+ TODO - do not know yet if return error code, and stdout and strerr or just one of them
"""
scommand = split(command)
logger.debug("Execute local command: {}".format(command))
process = await asyncio.create_subprocess_exec(
- *scommand,
- stdout=asyncio.subprocess.PIPE,
- stderr=asyncio.subprocess.PIPE
+ *scommand, stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.PIPE
)
# wait for command terminate
diff --git a/osm_ee/util/util_grpc.py b/osm_ee/util/util_grpc.py
index 5fe8fc5..2dc68fa 100644
--- a/osm_ee/util/util_grpc.py
+++ b/osm_ee/util/util_grpc.py
@@ -14,17 +14,19 @@
def create_secure_context() -> ssl.SSLContext:
# retrieve certificates from secrets
if not _retrieve_certs():
- logger.warning("TLS Certificates not found, starting gRPC server in unsecure mode")
+ logger.warning(
+ "TLS Certificates not found, starting gRPC server in unsecure mode"
+ )
return None
# create SSL context
ctx = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
ctx.verify_mode = ssl.CERT_REQUIRED
ctx.load_cert_chain(SERVER_CERT_FILE, SERVER_KEY_FILE)
ctx.load_verify_locations(CLIENT_CA_FILE)
- ctx.set_ciphers('ECDHE+AESGCM:ECDHE+CHACHA20:DHE+AESGCM:DHE+CHACHA20')
- ctx.set_alpn_protocols(['h2'])
+ ctx.set_ciphers("ECDHE+AESGCM:ECDHE+CHACHA20:DHE+AESGCM:DHE+CHACHA20")
+ ctx.set_alpn_protocols(["h2"])
try:
- ctx.set_npn_protocols(['h2'])
+ ctx.set_npn_protocols(["h2"])
except NotImplementedError:
pass
return ctx
diff --git a/osm_ee/util/util_kubernetes.py b/osm_ee/util/util_kubernetes.py
index a02334e..96ad587 100644
--- a/osm_ee/util/util_kubernetes.py
+++ b/osm_ee/util/util_kubernetes.py
@@ -10,7 +10,9 @@
# we are not running in kubernetes
return {}
# Read the namespace from the service account
- current_namespace = open("/var/run/secrets/kubernetes.io/serviceaccount/namespace").read()
+ current_namespace = open(
+ "/var/run/secrets/kubernetes.io/serviceaccount/namespace"
+ ).read()
v1 = client.CoreV1Api()
try: