vop-plugins 0.3.1 → 0.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Rakefile +2 -2
- data/extended/hetzner/commands/add_ssh_key.rb +22 -0
- data/extended/hetzner/commands/disable_linux_install.rb +26 -0
- data/extended/hetzner/commands/enable_linux_install.rb +41 -0
- data/extended/hetzner/commands/hetzner_http.rb +24 -0
- data/extended/hetzner/commands/hetzner_machines.rb +11 -0
- data/extended/hetzner/commands/hetzner_server_list.rb +26 -0
- data/extended/hetzner/commands/linux_install_options.rb +29 -0
- data/extended/hetzner/commands/list_ssh_keys.rb +16 -0
- data/extended/hetzner/entities/hetzner_account.rb +9 -0
- data/extended/hetzner/hetzner.plugin +3 -0
- data/extended/hetzner_vop_0_2_x/commands/list_old_v2_vms.rb +46 -0
- data/extended/hetzner_vop_0_2_x/commands/old_libvirt_machines.rb +16 -0
- data/extended/hetzner_vop_0_2_x/commands/vop_0_2_x_ssh_options.rb +20 -0
- data/extended/hetzner_vop_0_2_x/hetzner_vop_0_2_x.plugin +5 -0
- data/extended/libvirt/commands/delete_vm.rb +32 -0
- data/extended/libvirt/commands/libvirt_config_file.rb +5 -0
- data/extended/libvirt/commands/libvirt_machines.rb +17 -0
- data/extended/libvirt/commands/libvirt_ssh_options.rb +29 -0
- data/extended/libvirt/commands/list_networks.rb +21 -0
- data/extended/libvirt/commands/list_pools.rb +20 -0
- data/extended/libvirt/commands/list_vms.rb +28 -0
- data/extended/libvirt/commands/list_vms_for_scan.rb +12 -0
- data/extended/libvirt/commands/list_vms_with_addresses.rb +20 -0
- data/extended/libvirt/commands/new_vm.rb +110 -0
- data/extended/libvirt/commands/parent.rb +10 -0
- data/extended/libvirt/commands/rename_vm.rb +34 -0
- data/extended/libvirt/commands/start_vm.rb +7 -0
- data/extended/libvirt/commands/stop_vm.rb +8 -0
- data/extended/libvirt/commands/vm_address.rb +7 -0
- data/extended/libvirt/commands/vm_addresses.rb +32 -0
- data/extended/libvirt/commands/vnc_ports.rb +32 -0
- data/extended/libvirt/helpers/helper.rb +3 -0
- data/extended/libvirt/libvirt.plugin +5 -0
- data/extended/libvirt/services/libvirt.rb +19 -0
- data/extended/libvirt_with_proxy/commands/reverse_proxy.rb +13 -0
- data/extended/libvirt_with_proxy/commands/vms_with_domains.rb +18 -0
- data/extended/libvirt_with_proxy/entities/_vms_with_domains.rbx +24 -0
- data/extended/libvirt_with_proxy/libvirt_with_proxy.plugin +1 -0
- data/extended/rails_machines/commands/rails_machines.rb +6 -0
- data/extended/rails_machines/commands/update_status.rb +38 -0
- data/extended/rails_machines/commands/write_found_machines_into_rails_db.rb.not +30 -0
- data/extended/rails_machines/rails_machines.plugin +1 -0
- data/extended/redis_cache/commands/flush_cache.rb +5 -0
- data/extended/redis_cache/commands/invalidate_cache.rb +26 -0
- data/extended/redis_cache/filters/cache_filter.rb +78 -0
- data/extended/redis_cache/helpers/cache_wrapper.rb +35 -0
- data/extended/redis_cache/redis_cache.plugin +8 -0
- data/extended/spares/commands/convert_spare.rb +93 -0
- data/extended/spares/commands/list_spares.rb +9 -0
- data/extended/spares/commands/new_vm_from_spare.rb +24 -0
- data/extended/spares/commands/post_convert_spare.rb +13 -0
- data/extended/spares/commands/prepare_spares.rb +17 -0
- data/extended/spares/commands/wait.rb +29 -0
- data/extended/spares/commands/wtf.rb +9 -0
- data/extended/spares/spares.plugin +1 -0
- data/standard/apt/apt.plugin +0 -0
- data/standard/apt/commands/add_apt_repo.rb +14 -0
- data/standard/git/commands/deploy.rb +19 -0
- data/standard/git/commands/deploy_from_git.rb +34 -0
- data/standard/git/commands/deploy_from_github.rb +12 -0
- data/standard/git/commands/git_clone.rb +7 -0
- data/standard/git/commands/git_clone_web.rb +22 -0
- data/standard/git/git.plugin +0 -0
- data/standard/linux/commands/append_to_file.rb +14 -0
- data/standard/linux/commands/chmod.rb +7 -0
- data/standard/linux/commands/curl.rb +15 -0
- data/standard/linux/commands/current_user.rb +5 -0
- data/standard/linux/commands/distro.rb +2 -1
- data/standard/linux/commands/download_file.rb +6 -6
- data/standard/linux/commands/external_ip.rb +15 -0
- data/standard/linux/commands/file_exists.rb +7 -0
- data/standard/linux/commands/home.rb +7 -0
- data/standard/linux/commands/hostname.rb +5 -0
- data/standard/linux/commands/internal_ip.rb +14 -0
- data/standard/linux/commands/ipaddress.rb +10 -0
- data/standard/linux/commands/list_files.rb +8 -6
- data/standard/linux/commands/list_ip_addresses.rb +22 -0
- data/standard/linux/commands/listen_ports.rb +3 -2
- data/standard/linux/commands/maybe_sudo.rb +8 -0
- data/standard/linux/commands/mkdirs.rb +12 -0
- data/standard/linux/commands/processes.rb +8 -6
- data/standard/linux/commands/processes_like.rb +7 -7
- data/standard/linux/commands/processes_top.rb +23 -0
- data/standard/linux/commands/processes_top_cpu.rb +8 -0
- data/standard/linux/commands/processes_top_mem.rb +8 -0
- data/standard/linux/commands/read_file.rb +7 -2
- data/standard/linux/commands/replace_in_file.rb +22 -0
- data/standard/linux/commands/set_hostname.rb +36 -0
- data/standard/linux/commands/update_hosts_file.rb +27 -0
- data/standard/linux/commands/write_file.rb +8 -21
- data/standard/linux/linux.plugin +1 -2
- data/standard/machines/commands/delete_old_machines.rb +17 -0
- data/standard/machines/commands/localhost.rb +7 -2
- data/standard/machines/commands/localhost_ssh_options.rb +9 -0
- data/standard/machines/commands/new_machine.rb +24 -0
- data/standard/machines/commands/new_vm_from_scratch.rb +25 -0
- data/standard/machines/commands/old_machines.rb +6 -0
- data/standard/machines/commands/select_machine.rb +4 -5
- data/standard/machines/entities/machine.rb +12 -0
- data/standard/machines/machines.plugin +1 -1
- data/standard/redis_machines/commands/installation_status.rb +10 -0
- data/standard/redis_machines/commands/track_installation_status.rb +13 -0
- data/standard/redis_machines/redis_machines.plugin +3 -0
- data/standard/rpm/commands/list_rpm_packages.rb +24 -0
- data/standard/rpm/rpm.plugin +1 -0
- data/standard/scanner/commands/clean_metadata.rb +8 -0
- data/standard/scanner/commands/fresh_ssh_test.rb +6 -0
- data/standard/scanner/commands/inspect_async.rb +6 -0
- data/standard/scanner/commands/inspect_machine.rb +42 -0
- data/standard/scanner/commands/machines_found.rb +35 -0
- data/standard/scanner/commands/metadata.rb +9 -0
- data/standard/scanner/commands/redis_machines.rb +11 -0
- data/standard/scanner/commands/scan.rb +5 -0
- data/standard/scanner/commands/scan_host.rb +7 -0
- data/standard/scanner/commands/scan_machines.rb +11 -0
- data/standard/scanner/commands/trigger_ssh_test.rb +8 -0
- data/standard/scanner/scanner.plugin +5 -0
- data/standard/services/commands/describe_service.rb +7 -0
- data/standard/services/commands/describe_service_installation.rb +13 -0
- data/standard/services/commands/detect_services.rb +34 -0
- data/standard/services/commands/install_service.rb +134 -0
- data/standard/services/commands/list_known_services.rb +14 -0
- data/standard/services/commands/load_plugin_services.rb +17 -0
- data/standard/services/entities/service.rb +3 -0
- data/standard/services/helpers/service.rb +31 -0
- data/standard/services/helpers/service_loader.rb +50 -0
- data/standard/services/helpers/service_syntax.rb +126 -0
- data/standard/services/services.plugin +9 -0
- data/standard/ssh/commands/clean_known_host.rb +11 -0
- data/standard/ssh/commands/clear_ssh_cache.rb +9 -0
- data/standard/ssh/commands/get_ssh_connection.rb +36 -0
- data/standard/ssh/commands/scp_down.rb +9 -0
- data/standard/ssh/commands/scp_up.rb +9 -0
- data/standard/ssh/commands/ssh.rb +20 -0
- data/standard/ssh/commands/ssh_call.rb +98 -0
- data/standard/ssh/commands/ssh_connection.rb +55 -0
- data/standard/ssh/commands/ssh_extended.rb +6 -0
- data/standard/ssh/commands/ssh_options.rb +12 -0
- data/standard/ssh/commands/sudo.rb +12 -0
- data/standard/ssh/commands/test_ssh.rb +43 -0
- data/standard/{linux → ssh}/helpers/regex.rb +0 -0
- data/standard/ssh/ssh.plugin +10 -0
- data/standard/ssh_keys/commands/add_authorized_key.rb +14 -0
- data/standard/ssh_keys/commands/disable_ssh_key_check.rb +11 -0
- data/standard/ssh_keys/commands/generate_keypair.rb +17 -0
- data/standard/ssh_keys/ssh_keys.plugin +0 -0
- data/standard/systemd/commands/disable_systemd_service.rb +8 -0
- data/standard/systemd/commands/enable_systemd_service.rb +8 -0
- data/standard/systemd/commands/list_systemd_services.rb +23 -0
- data/standard/systemd/commands/start_systemd_service.rb +6 -0
- data/standard/systemd/commands/stop_systemd_service.rb +6 -0
- data/standard/systemd/commands/systemd_service_status.rb +6 -0
- data/standard/systemd/commands/write_systemd_config.rb +16 -0
- data/standard/systemd/helpers/param_service.rb +7 -0
- data/standard/systemd/systemd.plugin +0 -0
- data/standard/systemd/templates/systemd_service.erb +11 -0
- data/standard/templates/commands/read_template.rb +8 -0
- data/standard/templates/commands/write_template.rb +37 -0
- data/standard/templates/templates.plugin +3 -0
- data/vop-plugins.gemspec +6 -7
- metadata +156 -55
- data/Gemfile +0 -3
- data/Gemfile.lock +0 -68
- data/standard/debian-iso/commands/fetch_debian_iso.rb +0 -3
- data/standard/debian-iso/commands/fetch_ubuntu_iso.rb +0 -22
- data/standard/debian-iso/commands/list_isos.rb +0 -6
- data/standard/debian-iso/commands/rebuild_debian_iso.rb +0 -40
- data/standard/debian-iso/debian-iso.plugin +0 -2
- data/standard/debian-iso/files/rebuild-debian-iso +0 -74
- data/standard/debian-iso/templates/preseed.cfg +0 -45
- data/standard/libvirt/commands/delete_vm.rb +0 -16
- data/standard/libvirt/commands/list_local_vms.rb +0 -4
- data/standard/libvirt/commands/list_vms.rb +0 -15
- data/standard/libvirt/commands/new_vm.rb +0 -61
- data/standard/libvirt/commands/start_vm.rb +0 -6
- data/standard/libvirt/commands/stop_vm.rb +0 -6
- data/standard/libvirt/libvirt.plugin +0 -2
- data/standard/linux/commands/disk_free.rb +0 -26
- data/standard/linux/commands/disk_used.rb +0 -4
- data/standard/linux/commands/find.rb +0 -15
- data/standard/linux/commands/mkdir.rb +0 -6
- data/standard/linux/todo +0 -2
- data/standard/machines/commands/list_machines_old.rb +0 -7
- data/standard/machines/commands/machine.rb +0 -3
- data/standard/machines/commands/run_command.rb +0 -10
- data/standard/plugin.vop +0 -1
- data/standard/services/loader/service.rb +0 -3
- data/standard/vagrant/commands/vagrant_global_status.rb +0 -32
- data/standard/vagrant/vagrant.plugin +0 -1
- data/standard/working_copies/commands/git_working_copies.rb +0 -11
- data/standard/working_copies/commands/list_project_folders.rb +0 -8
- data/standard/working_copies/commands/working_copy.rb +0 -3
- data/standard/working_copies/working_copies.plugin +0 -1
@@ -0,0 +1,34 @@
|
|
1
|
+
param! :machine
|
2
|
+
|
3
|
+
read_only
|
4
|
+
|
5
|
+
run do |machine, plugin|
|
6
|
+
procs = machine.processes.map { |x| x["command"] }
|
7
|
+
|
8
|
+
result = []
|
9
|
+
plugin.state[:services].each do |service|
|
10
|
+
if service.data.has_key? :process_regex
|
11
|
+
service.data[:process_regex].each do |regex|
|
12
|
+
found = procs.grep regex
|
13
|
+
if found.size > 0
|
14
|
+
result << service.name
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
if service.data.has_key? :binary_name
|
20
|
+
service.data[:binary_name].each do |name|
|
21
|
+
found = false
|
22
|
+
begin
|
23
|
+
found = machine.ssh("which #{name}")
|
24
|
+
rescue => e
|
25
|
+
end
|
26
|
+
if found
|
27
|
+
result << service.name
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
result
|
34
|
+
end
|
@@ -0,0 +1,134 @@
|
|
1
|
+
require "erb"
|
2
|
+
require "tempfile"
|
3
|
+
|
4
|
+
param! :machine
|
5
|
+
param! :service
|
6
|
+
|
7
|
+
allows_extra
|
8
|
+
|
9
|
+
run do |plugin, machine, service, params|
|
10
|
+
processed = Hash.new { |h,k| h[k] = [] }
|
11
|
+
|
12
|
+
description = service.data[:install]
|
13
|
+
if description.include?(:files)
|
14
|
+
if description[:files].include?(:create)
|
15
|
+
creates = description[:files][:create]
|
16
|
+
creates.each do |what|
|
17
|
+
if what.include? :in
|
18
|
+
machine.mkdirs(what[:in])
|
19
|
+
(what[:dirs] || []).each do |dir|
|
20
|
+
machine.mkdirs (File.join(what[:in], dir))
|
21
|
+
end
|
22
|
+
processed[:create] << what
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
if description[:files].include?(:copy)
|
28
|
+
copies = description[:files][:copy]
|
29
|
+
copies.each do |what|
|
30
|
+
unless what.include?(:from) && what.include?(:to)
|
31
|
+
raise "copy needs to include :from and :to"
|
32
|
+
end
|
33
|
+
|
34
|
+
local_path = File.join(service.plugin.plugin_dir(:files), what[:from])
|
35
|
+
unless File.exists? local_path
|
36
|
+
raise "file not found at #{local_path}"
|
37
|
+
end
|
38
|
+
# TODO this does not work if remote_path needs root permissions
|
39
|
+
# (and current user is marvin)
|
40
|
+
machine.scp_up("local_path" => local_path, "remote_path" => what[:to])
|
41
|
+
processed[:copy] << what
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
if description[:files].include?(:template)
|
46
|
+
templates = description[:files][:template]
|
47
|
+
templates.each do |what|
|
48
|
+
unless what.include?(:template) && what.include?(:to)
|
49
|
+
raise "template needs to include :template and :to"
|
50
|
+
end
|
51
|
+
|
52
|
+
template_path = File.join(service.plugin.plugin_dir(:templates), what[:template])
|
53
|
+
unless File.exists? template_path
|
54
|
+
raise "template not found at #{template_path}"
|
55
|
+
end
|
56
|
+
|
57
|
+
tmp = Tempfile.new("vop_service_install_template")
|
58
|
+
begin
|
59
|
+
# TODO could use more bindings?
|
60
|
+
vars = {
|
61
|
+
"service" => service,
|
62
|
+
"machine" => machine
|
63
|
+
}
|
64
|
+
@op.machines["localhost"].write_template(
|
65
|
+
template: template_path,
|
66
|
+
to: tmp.path,
|
67
|
+
bind: OpenStruct.new(vars).instance_eval { binding }
|
68
|
+
)
|
69
|
+
tmp.flush
|
70
|
+
$logger.info "template #{what[:template]} processed into #{what[:to]} (using local temp path #{tmp.path})"
|
71
|
+
machine.scp_up("local_path" => tmp.path, "remote_path" => what[:to])
|
72
|
+
processed[:template] << what
|
73
|
+
ensure
|
74
|
+
tmp.close
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
if description.include?(:repo)
|
81
|
+
description[:repo].each do |repo|
|
82
|
+
p = Hash[ repo.map { |k,v| [k.to_s, v] } ]
|
83
|
+
machine.add_apt_repo(p)
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
87
|
+
if description.include?(:package)
|
88
|
+
machine.install_package(description[:package])
|
89
|
+
end
|
90
|
+
|
91
|
+
if description.include?(:gems)
|
92
|
+
description[:gems].each do |gem|
|
93
|
+
machine.sudo("gem install #{gem}")
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
if description.include?(:url)
|
98
|
+
description[:url].each do |url|
|
99
|
+
file_name = url.split("?").first.split("/").last
|
100
|
+
puts "downloading to #{file_name} from #{url}"
|
101
|
+
machine.download_file("url" => url, "file" => file_name)
|
102
|
+
|
103
|
+
# TODO auto-extract?
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
svc = plugin.state[:services].select { |x| x.name == service["name"] }.first
|
108
|
+
raise "no service found named '#{service["name"]}'" unless svc
|
109
|
+
svc.install_blocks.each_with_index do |install_block, idx|
|
110
|
+
$logger.info "calling install block #{idx}"
|
111
|
+
block_param_names = install_block.parameters.map { |x| x.last }
|
112
|
+
payload = []
|
113
|
+
block_param_names.each do |block_param_name|
|
114
|
+
case block_param_name.to_s
|
115
|
+
when "machine"
|
116
|
+
payload << machine
|
117
|
+
when "params"
|
118
|
+
$logger.debug "params for payload for block #{idx} : #{params.pretty_inspect}"
|
119
|
+
payload << params
|
120
|
+
when "plugin"
|
121
|
+
payload << svc.plugin
|
122
|
+
else
|
123
|
+
raise "unknown block param #{block_param_name} in installation block #{idx} for service #{service["name"]}"
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
install_block.call(*payload)
|
128
|
+
end
|
129
|
+
|
130
|
+
machine.processes!
|
131
|
+
machine.detect_services!
|
132
|
+
|
133
|
+
processed
|
134
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
read_only
|
2
|
+
|
3
|
+
run do |plugin|
|
4
|
+
plugin.state[:services].map do |service|
|
5
|
+
h = {
|
6
|
+
"name" => service.name
|
7
|
+
}
|
8
|
+
if service.data[:icon]
|
9
|
+
h["icon"] = File.join(service.plugin.plugin_dir(:files), service.data[:icon])
|
10
|
+
end
|
11
|
+
h["installable"] = service.data.has_key? :install
|
12
|
+
h
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require_relative "../helpers/service_loader"
|
2
|
+
require_relative "../helpers/service"
|
3
|
+
require_relative "../helpers/service_syntax"
|
4
|
+
|
5
|
+
description "loads services defined in plugins"
|
6
|
+
|
7
|
+
run do |plugin|
|
8
|
+
@op.plugins.each do |one_plugin|
|
9
|
+
one_plugin.load_code_from_dir :services
|
10
|
+
if one_plugin.sources[:services].keys.size > 0
|
11
|
+
$logger.debug " found services in #{one_plugin.name} : #{one_plugin.sources[:services].keys}"
|
12
|
+
loader = ServiceLoader.new(one_plugin.clone)
|
13
|
+
loaded = loader.read_sources(one_plugin.sources[:services])
|
14
|
+
plugin.state[:services] += loaded
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module Vop
|
2
|
+
|
3
|
+
class Service < ThingWithParams
|
4
|
+
|
5
|
+
attr_reader :plugin, :name
|
6
|
+
attr_reader :data
|
7
|
+
attr_accessor :install_blocks
|
8
|
+
|
9
|
+
def initialize(plugin, name)
|
10
|
+
super()
|
11
|
+
|
12
|
+
@plugin = plugin
|
13
|
+
@name = name
|
14
|
+
@data = {
|
15
|
+
install: { }
|
16
|
+
}
|
17
|
+
@install_blocks = [ ]
|
18
|
+
end
|
19
|
+
|
20
|
+
def to_s
|
21
|
+
"Vop::Service #{name}"
|
22
|
+
end
|
23
|
+
|
24
|
+
def to_hash
|
25
|
+
meta = { "name" => @name }
|
26
|
+
@data.merge(meta)
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
module Vop
|
2
|
+
|
3
|
+
class ServiceLoader
|
4
|
+
|
5
|
+
def initialize(plugin)
|
6
|
+
@plugin = plugin
|
7
|
+
@op = plugin.op
|
8
|
+
|
9
|
+
@services = []
|
10
|
+
|
11
|
+
@plugin.inject_helpers(self)
|
12
|
+
|
13
|
+
extend ServiceSyntax
|
14
|
+
end
|
15
|
+
|
16
|
+
def new_service(name)
|
17
|
+
$logger.debug "new service in #{@plugin.name}: #{name}"
|
18
|
+
@service = Service.new(@plugin, name)
|
19
|
+
$logger.debug "service plugin : #{@service.plugin.name}"
|
20
|
+
@services << @service
|
21
|
+
@service
|
22
|
+
end
|
23
|
+
|
24
|
+
def read_sources(named_sources)
|
25
|
+
# reads a hash of <name> => <source string>
|
26
|
+
named_sources.each do |name, source|
|
27
|
+
|
28
|
+
new_service(name)
|
29
|
+
|
30
|
+
begin
|
31
|
+
self.instance_eval(source[:code], source[:file_name])
|
32
|
+
rescue SyntaxError => detail
|
33
|
+
raise Errors::ServiceLoadError.new("problem loading service #{name}", detail.backtrace.join("\n"))
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
@services
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
|
42
|
+
module Errors
|
43
|
+
|
44
|
+
class ServiceLoadError < LoadError
|
45
|
+
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|
@@ -0,0 +1,126 @@
|
|
1
|
+
module Vop
|
2
|
+
|
3
|
+
module ServiceSyntax
|
4
|
+
|
5
|
+
def resolve_options_string(options)
|
6
|
+
if options.is_a? String
|
7
|
+
options = {
|
8
|
+
description: options
|
9
|
+
}
|
10
|
+
end
|
11
|
+
options
|
12
|
+
end
|
13
|
+
|
14
|
+
def param(name, options = {})
|
15
|
+
options = resolve_options_string(options)
|
16
|
+
|
17
|
+
@service.params << CommandParam.new(name, options)
|
18
|
+
end
|
19
|
+
|
20
|
+
def param!(name, options = {})
|
21
|
+
options = resolve_options_string(options)
|
22
|
+
options.merge! mandatory: true
|
23
|
+
param(name, options)
|
24
|
+
end
|
25
|
+
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
def process_regex(regex)
|
30
|
+
@service.data[:process_regex] ||= []
|
31
|
+
@service.data[:process_regex] << regex
|
32
|
+
end
|
33
|
+
|
34
|
+
def binary_name(name)
|
35
|
+
@service.data[:binary_name] ||= []
|
36
|
+
@service.data[:binary_name] << name
|
37
|
+
end
|
38
|
+
|
39
|
+
def deploy(what = {}, &block)
|
40
|
+
if block_given?
|
41
|
+
@service.install_blocks << block
|
42
|
+
end
|
43
|
+
|
44
|
+
if what.include? :create
|
45
|
+
files = @service.data[:install][:files] ||= {}
|
46
|
+
files[:create] ||= []
|
47
|
+
files[:create] << what[:create]
|
48
|
+
end
|
49
|
+
|
50
|
+
if what.include? :files
|
51
|
+
raise "deploy (:files) needs a 'to' option" unless what.include?(:to)
|
52
|
+
files = @service.data[:install][:files] ||= {}
|
53
|
+
files[:copy] ||= []
|
54
|
+
files[:copy] << {
|
55
|
+
from: what[:files],
|
56
|
+
to: what[:to]
|
57
|
+
}
|
58
|
+
end
|
59
|
+
|
60
|
+
if what.include? :template
|
61
|
+
raise "deploy (:template) needs a 'to' option" unless what.include?(:to)
|
62
|
+
files = @service.data[:install][:files] ||= {}
|
63
|
+
(files[:template] ||= []) << what
|
64
|
+
end
|
65
|
+
|
66
|
+
if what.include? :package
|
67
|
+
@service.data[:install][:package] ||= []
|
68
|
+
|
69
|
+
if what[:package].is_a?(Array)
|
70
|
+
@service.data[:install][:package] += what[:package]
|
71
|
+
else
|
72
|
+
@service.data[:install][:package] << what[:package]
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
if what.include? :gem
|
77
|
+
@service.data[:install][:gems] ||= []
|
78
|
+
|
79
|
+
gems = if what[:gem].is_a?(Array)
|
80
|
+
what[:gem]
|
81
|
+
else
|
82
|
+
[ what[:gem] ]
|
83
|
+
end
|
84
|
+
@service.data[:install][:gems] += gems
|
85
|
+
end
|
86
|
+
|
87
|
+
if what.include? :repository
|
88
|
+
@service.data[:install][:repo] ||= []
|
89
|
+
|
90
|
+
if what[:repository].is_a?(Array)
|
91
|
+
@service.data[:install][:repo] += what[:repository]
|
92
|
+
else
|
93
|
+
@service.data[:install][:repo] << what[:repository]
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
if what.include? :url
|
98
|
+
@service.data[:install][:url] ||= []
|
99
|
+
@service.data[:install][:url] << what[:url]
|
100
|
+
end
|
101
|
+
|
102
|
+
end
|
103
|
+
|
104
|
+
def known_binaries(list)
|
105
|
+
|
106
|
+
end
|
107
|
+
|
108
|
+
def version_command(command)
|
109
|
+
|
110
|
+
end
|
111
|
+
|
112
|
+
def port(port)
|
113
|
+
|
114
|
+
end
|
115
|
+
|
116
|
+
def icon(name)
|
117
|
+
@service.data[:icon] = name
|
118
|
+
end
|
119
|
+
|
120
|
+
def vhost(vhost)
|
121
|
+
|
122
|
+
end
|
123
|
+
|
124
|
+
end
|
125
|
+
|
126
|
+
end
|