Skip to content

Commit

Permalink
add ability to specify path to ansible-playbook binary file in runner
Browse files Browse the repository at this point in the history
  • Loading branch information
TheFieryLynx committed Mar 13, 2024
1 parent bb44893 commit 5831207
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/cotea/runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@


class runner:
def __init__(self, pb_path, arg_maker, debug_mod=None, show_progress_bar=False):
def __init__(self, pb_path, arg_maker, debug_mod=None, show_progress_bar=False,
ansible_pb_bin="/usr/local/bin/ansible-playbook"):
logging_lvl = logging.INFO
if debug_mod:
logging_lvl= logging.DEBUG
Expand Down Expand Up @@ -64,6 +65,8 @@ def __init__(self, pb_path, arg_maker, debug_mod=None, show_progress_bar=False):
self.progress_bar = ansible_progress_bar()
self.execution_tree = AnsibleExecTree()

self.ansible_pb_bin = ansible_pb_bin

self._set_wrappers()
start_ok = self._start_ansible()
self.logger.debug("Ansible start ok: %s", start_ok)
Expand Down Expand Up @@ -133,7 +136,7 @@ def _except_hook(self, args, /):

def _start_ansible(self):
args = self.arg_maker.args
args.insert(0, "/usr/local/bin/ansible-playbook")
args.insert(0, self.ansible_pb_bin)
args.insert(1, self.pb_path)

self.pbCLI = PlaybookCLI(args)
Expand Down Expand Up @@ -363,7 +366,7 @@ def get_all_error_msgs(self):
return self.update_conn_wrapper.error_msgs


# returns last error msg that wasn't ignored
# returns last error msg that wasn't ignored
def get_error_msg(self):
res = ""

Expand Down

0 comments on commit 5831207

Please sign in to comment.