26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
# File 'lib/chef/knife/cloud/server/create_options.rb', line 26
def self.included(includer)
includer.class_eval do
include ServerOptions
include BootstrapOptions
option :image,
:short => "-I IMAGE",
:long => "--image IMAGE",
:description => "A regexp matching an image name or an image ID for the server",
:proc => Proc.new { |i| Chef::Config[:knife][:image] = i }
option :image_os_type,
:short => "-T IMAGE_OS_TYPE",
:long => "--image-os-type IMAGE_OS_TYPE",
:description => "The image os type. options [windows/linux]. Only required when cloud does not provide a way to identify image os",
:default => "linux",
:proc => Proc.new { |i| Chef::Config[:knife][:image_os_type] = i }
option :flavor,
:short => "-f FLAVOR_ID",
:long => "--flavor FLAVOR_ID",
:description => "The flavor name or ID of server",
:proc => Proc.new { |f| Chef::Config[:knife][:flavor] = f }
option :bootstrap_protocol,
:long => "--bootstrap-protocol protocol",
:description => "Protocol to bootstrap servers. options: winrm/ssh. For linux servers always use ssh.",
:default => 'ssh',
:proc => Proc.new { |b| Chef::Config[:knife][:bootstrap_protocol] = b}
option :server_create_timeout,
:long => "--server-create-timeout timeout",
:description => "How long to wait until the server is ready; default is 600 seconds",
:default => 600,
:proc => Proc.new { |v| Chef::Config[:knife][:server_create_timeout] = v}
option :delete_server_on_failure,
:long => "--delete-server-on-failure",
:boolean => true,
:default => false,
:description => "Destroy corresponding server in case of failure"
option :chef_node_name_prefix,
:long => "--chef-node-name-prefix PREFIX_FOR_NODE_NAME",
:description => "The prefix for chef node name",
:default => includer.snake_case_name.split('_').first,
:proc => Proc.new { |key| Chef::Config[:knife][:chef_node_name_prefix] = key }
end
end
|