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

Fix sudo dependency #932

Merged
merged 3 commits into from
Feb 4, 2016
Merged

Fix sudo dependency #932

merged 3 commits into from
Feb 4, 2016

Conversation

alexpop
Copy link
Contributor

@alexpop alexpop commented Feb 4, 2016

Without this change, an instance without sudo installed, throws this converge error:

$ bundle exec kitchen converge default-centos-6
-----> Starting Kitchen (v1.5.0)
-----> Converging <default-centos-6>...
       Preparing files for transfer
       Preparing dna.json
       Resolving cookbook dependencies with Berkshelf 4.0.1...
       Removing non-cookbook files before transfer
       Preparing validation.pem
       Preparing client.rb
-----> Installing Chef Omnibus (12.5.1)
       Downloading https://www.chef.io/chef/install.sh to file /tmp/install.sh
       Trying curl...
       Download complete.
       sh: line 227: sudo: command not found
>>>>>> Converge failed on instance <default-centos-6>.
>>>>>> Please see .kitchen/logs/default-centos-6.log for more details
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: SSH exited (127) for command: [sh -c '

chef_omnibus_root="/opt/chef"
chef_omnibus_url="https://www.chef.io/chef/install.sh"
install_flags="-v 12.5.1"
pretty_version="12.5.1"
sudo_sh="sudo -E sh"
version="12.5.1"

tmp_stderr="/tmp/stderr";
---SNIP---
    do_download "$chef_omnibus_url" /tmp/install.sh;
    $sudo_sh /tmp/install.sh $install_flags;

With this PR, the sudo_sh variable set in the provisioning script respects the sudo and sudo_command driver configs.

# @api private
def sudo(script)
config[:sudo] ? "#{config[:sudo_command]} #{script}" : script
"#{sudo_command} #{script}".lstrip
Copy link
Contributor

Choose a reason for hiding this comment

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

nice idea!

@chris-rock
Copy link
Contributor

👍

@chris-rock
Copy link
Contributor

@alexpop could you please rebase to master?

@afiune
Copy link
Contributor

afiune commented Feb 4, 2016

Long night he @alexpop .. Great job.. 😄

@cheeseplus cheeseplus added this to the Accepted Minor milestone Feb 4, 2016
@cheeseplus
Copy link

I'm happy to merge this as is but could we get a test too?

cheeseplus pushed a commit that referenced this pull request Feb 4, 2016
@cheeseplus cheeseplus merged commit 815caba into test-kitchen:master Feb 4, 2016
@test-kitchen test-kitchen locked and limited conversation to collaborators Nov 16, 2017
This pull request was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants