Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
shalomb committed Oct 5, 2024
1 parent c229584 commit 955eb1c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
1 change: 0 additions & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
pytest
setuptools
wheel
shutil
2 changes: 2 additions & 0 deletions src/terrapyne/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,3 +332,5 @@ def cli_log_config(
raise ValueError("A critical message from an exception")
except Exception as exc:
logging.critical(str(exc), exc_info=True)

# https://gist.github.com/eblocha/fba1c0e2b49333607c4a2d7492f7491c
10 changes: 5 additions & 5 deletions src/terrapyne/terrapyne.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
from functools import cached_property
from pathlib import Path
from shutil import which
from subprocess import Popen, PIPE, STDOUT
from typing import Union, Tuple, Any
from subprocess import Popen, PIPE
from typing import Tuple, Any
import logging as log
import os
import re
Expand Down Expand Up @@ -45,7 +45,7 @@ def __init__(self, required_version=None):

@cached_property
def version(self):
stdout, stderr, exit_code = self.exec(
stdout, _, _ = self.exec(
cmd=["version"],
)
result = (
Expand Down Expand Up @@ -85,7 +85,7 @@ def plan(self, args=None) -> Tuple[str, str, int]:

def apply(self, args=None) -> Tuple[str, str, int]:
if not os.path.exists(self.tfplan_name):
self.init(args=[f"-backend=false"])
self.init(args=["-backend=false"])
self.plan(args=[f"-out={self.tfplan_name}"])
return self.exec(
cmd=["apply", *(args or [])],
Expand Down Expand Up @@ -199,7 +199,7 @@ def exec(
log.debug(f"stderr: {stderr}")
log.debug(f"exit_code: {exit_code}")

if ignore_exit_code is not True and exit_code != 0:
if ignore_exit_code is not True and exit_code != expect_exit_code:
raise Exception(f"[Error]: exit_code {exit_code} running '{cmd}': {stderr}")

if expect_stdout is not None:
Expand Down

0 comments on commit 955eb1c

Please sign in to comment.