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.
Files changed (195) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +2 -2
  3. data/extended/hetzner/commands/add_ssh_key.rb +22 -0
  4. data/extended/hetzner/commands/disable_linux_install.rb +26 -0
  5. data/extended/hetzner/commands/enable_linux_install.rb +41 -0
  6. data/extended/hetzner/commands/hetzner_http.rb +24 -0
  7. data/extended/hetzner/commands/hetzner_machines.rb +11 -0
  8. data/extended/hetzner/commands/hetzner_server_list.rb +26 -0
  9. data/extended/hetzner/commands/linux_install_options.rb +29 -0
  10. data/extended/hetzner/commands/list_ssh_keys.rb +16 -0
  11. data/extended/hetzner/entities/hetzner_account.rb +9 -0
  12. data/extended/hetzner/hetzner.plugin +3 -0
  13. data/extended/hetzner_vop_0_2_x/commands/list_old_v2_vms.rb +46 -0
  14. data/extended/hetzner_vop_0_2_x/commands/old_libvirt_machines.rb +16 -0
  15. data/extended/hetzner_vop_0_2_x/commands/vop_0_2_x_ssh_options.rb +20 -0
  16. data/extended/hetzner_vop_0_2_x/hetzner_vop_0_2_x.plugin +5 -0
  17. data/extended/libvirt/commands/delete_vm.rb +32 -0
  18. data/extended/libvirt/commands/libvirt_config_file.rb +5 -0
  19. data/extended/libvirt/commands/libvirt_machines.rb +17 -0
  20. data/extended/libvirt/commands/libvirt_ssh_options.rb +29 -0
  21. data/extended/libvirt/commands/list_networks.rb +21 -0
  22. data/extended/libvirt/commands/list_pools.rb +20 -0
  23. data/extended/libvirt/commands/list_vms.rb +28 -0
  24. data/extended/libvirt/commands/list_vms_for_scan.rb +12 -0
  25. data/extended/libvirt/commands/list_vms_with_addresses.rb +20 -0
  26. data/extended/libvirt/commands/new_vm.rb +110 -0
  27. data/extended/libvirt/commands/parent.rb +10 -0
  28. data/extended/libvirt/commands/rename_vm.rb +34 -0
  29. data/extended/libvirt/commands/start_vm.rb +7 -0
  30. data/extended/libvirt/commands/stop_vm.rb +8 -0
  31. data/extended/libvirt/commands/vm_address.rb +7 -0
  32. data/extended/libvirt/commands/vm_addresses.rb +32 -0
  33. data/extended/libvirt/commands/vnc_ports.rb +32 -0
  34. data/extended/libvirt/helpers/helper.rb +3 -0
  35. data/extended/libvirt/libvirt.plugin +5 -0
  36. data/extended/libvirt/services/libvirt.rb +19 -0
  37. data/extended/libvirt_with_proxy/commands/reverse_proxy.rb +13 -0
  38. data/extended/libvirt_with_proxy/commands/vms_with_domains.rb +18 -0
  39. data/extended/libvirt_with_proxy/entities/_vms_with_domains.rbx +24 -0
  40. data/extended/libvirt_with_proxy/libvirt_with_proxy.plugin +1 -0
  41. data/extended/rails_machines/commands/rails_machines.rb +6 -0
  42. data/extended/rails_machines/commands/update_status.rb +38 -0
  43. data/extended/rails_machines/commands/write_found_machines_into_rails_db.rb.not +30 -0
  44. data/extended/rails_machines/rails_machines.plugin +1 -0
  45. data/extended/redis_cache/commands/flush_cache.rb +5 -0
  46. data/extended/redis_cache/commands/invalidate_cache.rb +26 -0
  47. data/extended/redis_cache/filters/cache_filter.rb +78 -0
  48. data/extended/redis_cache/helpers/cache_wrapper.rb +35 -0
  49. data/extended/redis_cache/redis_cache.plugin +8 -0
  50. data/extended/spares/commands/convert_spare.rb +93 -0
  51. data/extended/spares/commands/list_spares.rb +9 -0
  52. data/extended/spares/commands/new_vm_from_spare.rb +24 -0
  53. data/extended/spares/commands/post_convert_spare.rb +13 -0
  54. data/extended/spares/commands/prepare_spares.rb +17 -0
  55. data/extended/spares/commands/wait.rb +29 -0
  56. data/extended/spares/commands/wtf.rb +9 -0
  57. data/extended/spares/spares.plugin +1 -0
  58. data/standard/apt/apt.plugin +0 -0
  59. data/standard/apt/commands/add_apt_repo.rb +14 -0
  60. data/standard/git/commands/deploy.rb +19 -0
  61. data/standard/git/commands/deploy_from_git.rb +34 -0
  62. data/standard/git/commands/deploy_from_github.rb +12 -0
  63. data/standard/git/commands/git_clone.rb +7 -0
  64. data/standard/git/commands/git_clone_web.rb +22 -0
  65. data/standard/git/git.plugin +0 -0
  66. data/standard/linux/commands/append_to_file.rb +14 -0
  67. data/standard/linux/commands/chmod.rb +7 -0
  68. data/standard/linux/commands/curl.rb +15 -0
  69. data/standard/linux/commands/current_user.rb +5 -0
  70. data/standard/linux/commands/distro.rb +2 -1
  71. data/standard/linux/commands/download_file.rb +6 -6
  72. data/standard/linux/commands/external_ip.rb +15 -0
  73. data/standard/linux/commands/file_exists.rb +7 -0
  74. data/standard/linux/commands/home.rb +7 -0
  75. data/standard/linux/commands/hostname.rb +5 -0
  76. data/standard/linux/commands/internal_ip.rb +14 -0
  77. data/standard/linux/commands/ipaddress.rb +10 -0
  78. data/standard/linux/commands/list_files.rb +8 -6
  79. data/standard/linux/commands/list_ip_addresses.rb +22 -0
  80. data/standard/linux/commands/listen_ports.rb +3 -2
  81. data/standard/linux/commands/maybe_sudo.rb +8 -0
  82. data/standard/linux/commands/mkdirs.rb +12 -0
  83. data/standard/linux/commands/processes.rb +8 -6
  84. data/standard/linux/commands/processes_like.rb +7 -7
  85. data/standard/linux/commands/processes_top.rb +23 -0
  86. data/standard/linux/commands/processes_top_cpu.rb +8 -0
  87. data/standard/linux/commands/processes_top_mem.rb +8 -0
  88. data/standard/linux/commands/read_file.rb +7 -2
  89. data/standard/linux/commands/replace_in_file.rb +22 -0
  90. data/standard/linux/commands/set_hostname.rb +36 -0
  91. data/standard/linux/commands/update_hosts_file.rb +27 -0
  92. data/standard/linux/commands/write_file.rb +8 -21
  93. data/standard/linux/linux.plugin +1 -2
  94. data/standard/machines/commands/delete_old_machines.rb +17 -0
  95. data/standard/machines/commands/localhost.rb +7 -2
  96. data/standard/machines/commands/localhost_ssh_options.rb +9 -0
  97. data/standard/machines/commands/new_machine.rb +24 -0
  98. data/standard/machines/commands/new_vm_from_scratch.rb +25 -0
  99. data/standard/machines/commands/old_machines.rb +6 -0
  100. data/standard/machines/commands/select_machine.rb +4 -5
  101. data/standard/machines/entities/machine.rb +12 -0
  102. data/standard/machines/machines.plugin +1 -1
  103. data/standard/redis_machines/commands/installation_status.rb +10 -0
  104. data/standard/redis_machines/commands/track_installation_status.rb +13 -0
  105. data/standard/redis_machines/redis_machines.plugin +3 -0
  106. data/standard/rpm/commands/list_rpm_packages.rb +24 -0
  107. data/standard/rpm/rpm.plugin +1 -0
  108. data/standard/scanner/commands/clean_metadata.rb +8 -0
  109. data/standard/scanner/commands/fresh_ssh_test.rb +6 -0
  110. data/standard/scanner/commands/inspect_async.rb +6 -0
  111. data/standard/scanner/commands/inspect_machine.rb +42 -0
  112. data/standard/scanner/commands/machines_found.rb +35 -0
  113. data/standard/scanner/commands/metadata.rb +9 -0
  114. data/standard/scanner/commands/redis_machines.rb +11 -0
  115. data/standard/scanner/commands/scan.rb +5 -0
  116. data/standard/scanner/commands/scan_host.rb +7 -0
  117. data/standard/scanner/commands/scan_machines.rb +11 -0
  118. data/standard/scanner/commands/trigger_ssh_test.rb +8 -0
  119. data/standard/scanner/scanner.plugin +5 -0
  120. data/standard/services/commands/describe_service.rb +7 -0
  121. data/standard/services/commands/describe_service_installation.rb +13 -0
  122. data/standard/services/commands/detect_services.rb +34 -0
  123. data/standard/services/commands/install_service.rb +134 -0
  124. data/standard/services/commands/list_known_services.rb +14 -0
  125. data/standard/services/commands/load_plugin_services.rb +17 -0
  126. data/standard/services/entities/service.rb +3 -0
  127. data/standard/services/helpers/service.rb +31 -0
  128. data/standard/services/helpers/service_loader.rb +50 -0
  129. data/standard/services/helpers/service_syntax.rb +126 -0
  130. data/standard/services/services.plugin +9 -0
  131. data/standard/ssh/commands/clean_known_host.rb +11 -0
  132. data/standard/ssh/commands/clear_ssh_cache.rb +9 -0
  133. data/standard/ssh/commands/get_ssh_connection.rb +36 -0
  134. data/standard/ssh/commands/scp_down.rb +9 -0
  135. data/standard/ssh/commands/scp_up.rb +9 -0
  136. data/standard/ssh/commands/ssh.rb +20 -0
  137. data/standard/ssh/commands/ssh_call.rb +98 -0
  138. data/standard/ssh/commands/ssh_connection.rb +55 -0
  139. data/standard/ssh/commands/ssh_extended.rb +6 -0
  140. data/standard/ssh/commands/ssh_options.rb +12 -0
  141. data/standard/ssh/commands/sudo.rb +12 -0
  142. data/standard/ssh/commands/test_ssh.rb +43 -0
  143. data/standard/{linux → ssh}/helpers/regex.rb +0 -0
  144. data/standard/ssh/ssh.plugin +10 -0
  145. data/standard/ssh_keys/commands/add_authorized_key.rb +14 -0
  146. data/standard/ssh_keys/commands/disable_ssh_key_check.rb +11 -0
  147. data/standard/ssh_keys/commands/generate_keypair.rb +17 -0
  148. data/standard/ssh_keys/ssh_keys.plugin +0 -0
  149. data/standard/systemd/commands/disable_systemd_service.rb +8 -0
  150. data/standard/systemd/commands/enable_systemd_service.rb +8 -0
  151. data/standard/systemd/commands/list_systemd_services.rb +23 -0
  152. data/standard/systemd/commands/start_systemd_service.rb +6 -0
  153. data/standard/systemd/commands/stop_systemd_service.rb +6 -0
  154. data/standard/systemd/commands/systemd_service_status.rb +6 -0
  155. data/standard/systemd/commands/write_systemd_config.rb +16 -0
  156. data/standard/systemd/helpers/param_service.rb +7 -0
  157. data/standard/systemd/systemd.plugin +0 -0
  158. data/standard/systemd/templates/systemd_service.erb +11 -0
  159. data/standard/templates/commands/read_template.rb +8 -0
  160. data/standard/templates/commands/write_template.rb +37 -0
  161. data/standard/templates/templates.plugin +3 -0
  162. data/vop-plugins.gemspec +6 -7
  163. metadata +156 -55
  164. data/Gemfile +0 -3
  165. data/Gemfile.lock +0 -68
  166. data/standard/debian-iso/commands/fetch_debian_iso.rb +0 -3
  167. data/standard/debian-iso/commands/fetch_ubuntu_iso.rb +0 -22
  168. data/standard/debian-iso/commands/list_isos.rb +0 -6
  169. data/standard/debian-iso/commands/rebuild_debian_iso.rb +0 -40
  170. data/standard/debian-iso/debian-iso.plugin +0 -2
  171. data/standard/debian-iso/files/rebuild-debian-iso +0 -74
  172. data/standard/debian-iso/templates/preseed.cfg +0 -45
  173. data/standard/libvirt/commands/delete_vm.rb +0 -16
  174. data/standard/libvirt/commands/list_local_vms.rb +0 -4
  175. data/standard/libvirt/commands/list_vms.rb +0 -15
  176. data/standard/libvirt/commands/new_vm.rb +0 -61
  177. data/standard/libvirt/commands/start_vm.rb +0 -6
  178. data/standard/libvirt/commands/stop_vm.rb +0 -6
  179. data/standard/libvirt/libvirt.plugin +0 -2
  180. data/standard/linux/commands/disk_free.rb +0 -26
  181. data/standard/linux/commands/disk_used.rb +0 -4
  182. data/standard/linux/commands/find.rb +0 -15
  183. data/standard/linux/commands/mkdir.rb +0 -6
  184. data/standard/linux/todo +0 -2
  185. data/standard/machines/commands/list_machines_old.rb +0 -7
  186. data/standard/machines/commands/machine.rb +0 -3
  187. data/standard/machines/commands/run_command.rb +0 -10
  188. data/standard/plugin.vop +0 -1
  189. data/standard/services/loader/service.rb +0 -3
  190. data/standard/vagrant/commands/vagrant_global_status.rb +0 -32
  191. data/standard/vagrant/vagrant.plugin +0 -1
  192. data/standard/working_copies/commands/git_working_copies.rb +0 -11
  193. data/standard/working_copies/commands/list_project_folders.rb +0 -8
  194. data/standard/working_copies/commands/working_copy.rb +0 -3
  195. data/standard/working_copies/working_copies.plugin +0 -1
@@ -0,0 +1,13 @@
1
+ param! "service"
2
+ param "section", default: :install
3
+
4
+ show display_type: :data
5
+
6
+ run do |service, section|
7
+ result = @op.describe_service(service)
8
+ if result.has_key? section
9
+ result[section]
10
+ else
11
+ result
12
+ end
13
+ end
@@ -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,3 @@
1
+ entity do |plugin|
2
+ plugin.state[:services].map { |x| x.to_hash.merge("plugin_name" => x.plugin.name) }
3
+ 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
@@ -0,0 +1,9 @@
1
+ depends_on :machines
2
+
3
+ on :init do |plugin|
4
+ plugin.state[:services] = []
5
+ end
6
+
7
+ hook :loading_finished do
8
+ @op.load_plugin_services
9
+ end
@@ -0,0 +1,11 @@
1
+ param! "ip"
2
+
3
+ run do |ip|
4
+ # TODO validate ip ?
5
+ localhost = @op.machines["localhost"]
6
+
7
+ home = localhost.ssh('echo $HOME').chomp
8
+ known_hosts = File.join(home, ".ssh", "known_hosts")
9
+
10
+ localhost.ssh "ssh-keygen -f #{known_hosts} -R #{ip}"
11
+ end