Permalink
Browse files

cosmetics and changes in virtualop_install

  • Loading branch information...
1 parent dcbf397 commit 5e73d4eab4ee6ddb5f092959d9fd07f49b1928aa @philippt philippt committed Mar 11, 2012
View
@@ -0,0 +1 @@
+.dropbox
@@ -27,17 +27,17 @@
machine.mkdir("dir_name" => "/etc/vop/virtualop.conf.d")
# won't work without these
- plugins_to_enable = %w|bash machines ssh_connector|
+ plugins_to_enable = %w|bash machines ssh_connector erb_processor|
# is more fun with those
- plugins_to_enable += %w|erb_processor gems git_scm github_scm logging rpm ssh_keys sshd_log unix_services|
+ plugins_to_enable += %w|git_scm github_scm logging packages rpm apt gems ssh_keys sshd_log unix_services|
# and these are currently used by virtualop.org
- plugins_to_enable += %w|hetzner hosting_accounts imap iptables_generator libvirt machine_crawler vop_services drop_dir vm_handling ssh_keys|
+ plugins_to_enable += %w|hosting_accounts hetzner imap iptables_generator libvirt machine_crawler drop_dir vm_handling ssh_keys|
plugins_to_enable.each do |module_name|
machine.ssh_and_check_result("command" => "echo '--- {}' > /etc/vop/virtualop.conf.d/#{module_name}.conf")
- end
+ end
end
@@ -4,6 +4,8 @@
param :user
param "file_name", "the poor file whose existence we want to check", :mandatory => true
+mark_as_read_only
+
on_machine do |machine,params|
file_name = params["file_name"]
@@ -5,6 +5,8 @@
display_type :list
+mark_as_read_only
+
on_machine do |machine, params|
machine.ssh_and_check_result("command" => "ls #{params["directory"]}").map do |item|
item.strip
@@ -1,7 +1,7 @@
param :machine
param! "file_name", "qualified path to the file_name"
-display_type :list
+#display_type :list
on_machine do |machine, params|
machine.ssh_and_check_result("command" => "cat #{params["file_name"]}")
@@ -6,20 +6,31 @@ def with_files(machine, directory, pattern, user = nil, &block)
if machine.file_exists(o)
file_pattern = directory + '/' + pattern
begin
- options = {
- "command" => "ls -1 #{file_pattern}"
- }
- options["user"] = user unless user == nil
- output = machine.ssh_and_check_result(options)
- #output = host.ssh_and_check_result(options)
- output.split("\n").each do |line|
- matched = /#{directory}\/(.+)/.match(line)
+ machine.list_files("directory" => file_pattern).each do |file|
+ matched = /#{directory}\/(.+)/.match(file)
if matched
block.call(matched.captures[0])
else
- $logger.error("unexpected result '#{line}' from directory listing...something's wrong here.")
+ $logger.error("unexpected result '#{file}' from directory listing...something's wrong here.")
end
end
+
+ # options = {
+ # "command" => "ls -1 #{file_pattern}"
+ # }
+ # options["user"] = user unless user == nil
+ # output = machine.ssh_and_check_result(options)
+#
+#
+ # #output = host.ssh_and_check_result(options)
+ # output.split("\n").each do |line|
+ # matched = /#{directory}\/(.+)/.match(line)
+ # if matched
+ # block.call(matched.captures[0])
+ # else
+ # $logger.error("unexpected result '#{line}' from directory listing...something's wrong here.")
+ # end
+ # end
rescue Exception => ex
$logger.error("exception #{ex.class.to_s} : #{ex.message}")
[]
@@ -1,6 +1,6 @@
description "selects a machine to work with (and updates the 'host' context parameter)"
-param :machine_without_context, :is_default_param => true
+param :machine_without_context, :default_param => true
execute_request do |request, response|
new_machine = request.get_param_value("machine")

0 comments on commit 5e73d4e

Please sign in to comment.