Class: CapistranoKnifeSolo::Helpers
- Inherits:
-
Object
- Object
- CapistranoKnifeSolo::Helpers
- Defined in:
- lib/capistrano-knife-solo.rb
Class Method Summary collapse
- .chef_config ⇒ Object
- .knife_args(host) ⇒ Object
- .knife_config(host) ⇒ Object
- .roles_to_runlist(host) ⇒ Object
Class Method Details
.chef_config ⇒ Object
12 13 14 15 16 17 |
# File 'lib/capistrano-knife-solo.rb', line 12 def self.chef_config Chef::Config[:knife][:librarian] = fetch(:knife_librarian) Chef::Config[:knife][:berkshelf] = fetch(:knife_berkshelf) Chef::Config[:node_path] = fetch(:knife_node_path) Chef::Config.cookbook_path = fetch(:knife_cookbook_path) end |
.knife_args(host) ⇒ Object
34 35 36 37 38 39 |
# File 'lib/capistrano-knife-solo.rb', line 34 def self.knife_args(host) args = [] args << host.hostname args << "#{fetch(:knife_args)}" if fetch(:knife_args) return args end |
.knife_config(host) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/capistrano-knife-solo.rb', line 19 def self.knife_config(host) = fetch(:ssh_options) = {} [:ssh_user] = [:user] if [:user] [:ssh_password] = [:password] if [:password] [:ssh_port] = [:port] if [:port] [:identity_file] = [:keys][0] if [:keys][0] [:forward_agent] = [:forward_agent] if [:forward_agent] [:startup_script] = fetch(:knife_startup_script) if fetch(:knife_startup_script) [:sudo_command] = fetch(:knife_sudo_command) if fetch(:knife_sudo_command) [:host_key_verify] = fetch(:knife_host_key_verify) if fetch(:knife_host_key_verify) [:run_list] = roles_to_runlist(host) return end |
.roles_to_runlist(host) ⇒ Object
41 42 43 44 45 |
# File 'lib/capistrano-knife-solo.rb', line 41 def self.roles_to_runlist(host) roles = host.properties.roles.reject { |r| r.to_s.start_with?('server-') or r == :all } roles.map! {|r| "role[#{r}]"} return roles end |