Module: Shiv

Defined in:
lib/shiv.rb

Class Method Summary collapse

Class Method Details

.configureObject



23
24
25
# File 'lib/shiv.rb', line 23

def self.configure
  Chef::Knife.new.configure_chef
end

.edit(command) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/shiv.rb', line 6

def self.edit(command)
  configure
  nodes.each do |node|
    command.gsub!(node, hostname_from(node)) if command.include? node
  end
  command
end

.hostname_from(node) ⇒ Object



18
19
20
21
# File 'lib/shiv.rb', line 18

def self.hostname_from(node)
  node = Chef::Node.load(node)
  node['cloud']['public_hostname']
end

.nodesObject



14
15
16
# File 'lib/shiv.rb', line 14

def self.nodes
  Chef::Node.list.keys.sort.reverse
end