Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for agent forwarding #206

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions littlechef/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
whyrun = False
concurrency = False
include_guests = False
forward_agent = False

node_work_path = "/tmp/chef-solo"
cookbook_paths = ['site-cookbooks', 'cookbooks']
Expand Down
4 changes: 2 additions & 2 deletions littlechef/chef.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
from fabric.utils import abort
from fabric.contrib.project import rsync_project

from littlechef import cookbook_paths, whyrun, lib, solo
from littlechef import cookbook_paths, whyrun, lib, solo, forward_agent
from littlechef import LOGFILE, enable_logs as ENABLE_LOGS

# Path to local patch
Expand Down Expand Up @@ -376,7 +376,7 @@ def _configure_node():
if env.loglevel == "debug":
print("Executing Chef Solo with the following command:\n"
"{0}".format(cmd))
with settings(hide('warnings', 'running'), warn_only=True):
with settings(hide('warnings', 'running'), warn_only=True, forward_agent=forward_agent):
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess if you want to forward the ssh agent you will want that to happen for all ssh operations, not just when calling chef-solo.
Therefore, we need to set it globally in runner.py.

The other missing piece is in adding the actual command line option to fix

output = sudo(cmd)
if (output.failed or "FATAL: Stacktrace dumped" in output or
("Chef Run complete" not in output and
Expand Down