diff options
author | Chirag Jog <chirag.jog@gmail.com> | 2013-03-12 21:18:26 +0530 |
---|---|---|
committer | Chirag Jog <chirag.jog@gmail.com> | 2013-03-12 21:18:26 +0530 |
commit | 745101f34f6b7c0e1c255d1ca9763b12456a5331 (patch) | |
tree | 2f9be93a53ea8e57e45aa97b79bc8c2eff64fc76 | |
parent | 4ff5244fccf0ac8b24902e4166d6df93559252f6 (diff) | |
download | chef-745101f34f6b7c0e1c255d1ca9763b12456a5331.tar.gz |
Enable password to sudo from stdin for knife ssh bootstrap
-rw-r--r-- | lib/chef/knife/bootstrap.rb | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/chef/knife/bootstrap.rb b/lib/chef/knife/bootstrap.rb index 53b31ad676..062e15aafb 100644 --- a/lib/chef/knife/bootstrap.rb +++ b/lib/chef/knife/bootstrap.rb @@ -94,6 +94,11 @@ class Chef :description => "Execute the bootstrap via sudo", :boolean => true + option :use_sudo_password, + :long => "--use-sudo-password", + :description => "Execute the bootstrap via sudo with password", + :boolean => false + option :template_file, :long => "--template-file TEMPLATE", :description => "Full path to location of template to use", @@ -170,7 +175,7 @@ class Chef @node_name = Array(@name_args).first # back compat--templates may use this setting: config[:server_name] = @node_name - + $stdout.sync = true ui.info("Bootstrapping Chef on #{ui.color(@node_name, :bold)}") @@ -222,7 +227,7 @@ class Chef command = render_template(read_template) if config[:use_sudo] - command = "sudo #{command}" + command = config[:use_sudo_password] ? "echo #{config[:ssh_password]} | sudo -S #{command}" : "sudo #{command}" end command |