Class: Chef::Knife::SousInit
Instance Method Summary
collapse
included, #manifest_file_path, #process_config, #root_namespace, #search, #validate_config!
Instance Method Details
#copy_template(location) ⇒ Object
24
25
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/chef/knife/sous_init.rb', line 24
def copy_template(location)
FileUtils.mkdir_p(location)
target_file = File.join(location, 'nodes.example.rb' )
unless File.exists?(target_file)
FileUtils.cp(node_manifest_example_path, target_file)
ui.msg "Example nodes.rb copied to #{target_file}"
else
ui.error "File already exists: #{target_file}"
end
end
|
#node_manifest_example_path ⇒ Object
11
12
13
|
# File 'lib/chef/knife/sous_init.rb', line 11
def node_manifest_example_path
File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'templates', 'nodes.example.rb'))
end
|
#run ⇒ Object
15
16
17
18
19
20
21
22
|
# File 'lib/chef/knife/sous_init.rb', line 15
def run
unless name_args.empty?
target = File.expand_path(name_args.first)
else
target = File.expand_path(Dir.pwd, File.join('nodes'))
end
copy_template(target)
end
|