Skip to content

Commit

Permalink
Sandbox Process Creation
Browse files Browse the repository at this point in the history
  • Loading branch information
pixeebot[bot] authored Jul 9, 2024
1 parent b4b0c7e commit d05508d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import yaml
import subprocess
import os
from security import safe_command

port = "22"
timeout = "60"
Expand All @@ -21,8 +22,8 @@
bitops_hosts = bitops_hosts[0]
print("Waiting for host:", bitops_hosts)
wait_for_command = "{}/_scripts/ansible/wait-for-it.sh -h {} -p {} -t {}".format(TEMPDIR,bitops_hosts,port,timeout)
result = subprocess.call(wait_for_command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
result = safe_command.run(subprocess.call, wait_for_command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
except yaml.YAMLError as exception:
print(exception)
except IOError:
print("Terraform inventory file not found. Skipping wait for hosts.")
print("Terraform inventory file not found. Skipping wait for hosts.")
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ munch
GitPython
pyfiglet
boto3
security==1.3.0
4 changes: 2 additions & 2 deletions scripts/plugins/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

from .settings import BITOPS_FAST_FAIL_MODE
from .logging import logger, mask_message
from security import safe_command

Check failure on line 9 in scripts/plugins/utilities.py

View workflow job for this annotation

GitHub Actions / lint-pylint

C0411: third party import "security.safe_command" should be placed before local imports "settings.BITOPS_FAST_FAIL_MODE", "logging.logger" (wrong-import-order)


def add_value_to_env(export_env, value):
Expand Down Expand Up @@ -60,8 +61,7 @@ def load_yaml(filename: str) -> Union[dict, None]:

def run_cmd(command: Union[list, str]) -> subprocess.Popen:
"""Run a linux command and return Popen instance as a result"""
with subprocess.Popen(
command,
with safe_command.run(subprocess.Popen, command,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
universal_newlines=True,
Expand Down

0 comments on commit d05508d

Please sign in to comment.