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

Added backend docker configs #168

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

tk-hamaguchi
Copy link

  • Added tty: true to execute commands with docker.
  • Modified log format with docker results.
require 'docker'
require 'itamae'

@backend = Itamae::Backend.create(:docker, image: 'centos:7')
# => TypeError: no implicit conversion of Array into String
# Because Docker.logger.debug call with Array in  Docker::Connection#log_request.
# And set Itamae.logger to ::Docker.logger at Itamae::Backend::Docker#create_specinfra_backend.

@backend.run_command('yum install -y sudo')
@backend.run_command('sudo -H -u root -- /bin/sh -c cd /tmp/ && ls -l')
# => sudo: sorry, you must have a tty to run sudo
# Because Specinfra::Backend::Docker#run_command was not call with { tty: true}.

@tk-hamaguchi
Copy link
Author

I apologize for my poor English.

@@ -74,7 +74,7 @@ def run_command(commands, options = {})
end

if options[:error] && result.exit_status != 0
raise CommandExecutionError
fail CommandExecutionError, result.stderr
Copy link
Member

Choose a reason for hiding this comment

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

I prefer raise

Copy link
Author

Choose a reason for hiding this comment

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

OK. I'll fix the code later.

* Modified log format with docker results.
@ryotarai
Copy link
Member

@tk-hamaguchi Sorry for very late reply... Would you rebase the branch?

@umisora
Copy link
Contributor

umisora commented Nov 15, 2016

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants