aboutsummaryrefslogtreecommitdiff
path: root/lib/leap_cli/commands/node.rb
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2013-06-04 23:06:10 -0700
committerelijah <elijah@riseup.net>2013-06-04 23:06:10 -0700
commit8f79b632aeeee1111087dee6ebb6302aca700bbd (patch)
tree647b24bee28b28301de6c4a82a916222cde491e8 /lib/leap_cli/commands/node.rb
parenta46321a43318a9cd3e2dd645b64fe81b71e7f8ea (diff)
downloadleap_cli-8f79b632aeeee1111087dee6ebb6302aca700bbd.tar.gz
leap_cli-8f79b632aeeee1111087dee6ebb6302aca700bbd.tar.bz2
add support for `leap facts`. includes some fun new helpers, like run_with_progress(), capture(), and replace_file!().
Diffstat (limited to 'lib/leap_cli/commands/node.rb')
-rw-r--r--lib/leap_cli/commands/node.rb11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/leap_cli/commands/node.rb b/lib/leap_cli/commands/node.rb
index bf552d3..12c9500 100644
--- a/lib/leap_cli/commands/node.rb
+++ b/lib/leap_cli/commands/node.rb
@@ -45,7 +45,7 @@ module LeapCli; module Commands
node.desc 'Bootstraps a node or nodes, setting up SSH keys and installing prerequisite packages'
node.long_desc "This command prepares a server to be used with the LEAP Platform by saving the server's SSH host key, " +
- "copying the authorized_keys file, and installing packages that are required for deploying. " +
+ "copying the authorized_keys file, installing packages that are required for deploying, and registering important facts. " +
"Node init must be run before deploying to a server, and the server must be running and available via the network. " +
"This command only needs to be run once, but there is no harm in running it multiple times."
node.arg_name 'FILTER' #, :optional => false, :multiple => false
@@ -61,6 +61,13 @@ module LeapCli; module Commands
ssh_connect(node, :bootstrap => true, :echo => options[:echo]) do |ssh|
ssh.install_authorized_keys
ssh.install_prerequisites
+ ssh.leap.capture(facter_cmd) do |response|
+ if response[:exitcode] == 0
+ update_node_facts(node.name, response[:data])
+ else
+ log :failed, "to run facter on #{node.name}"
+ end
+ end
end
finished << node.name
end
@@ -79,6 +86,7 @@ module LeapCli; module Commands
rename_file! [path, node.name], [path, new_name]
end
remove_directory! [:node_files_dir, node.name]
+ rename_node_facts(node.name, new_name)
end
end
@@ -93,6 +101,7 @@ module LeapCli; module Commands
if node.vagrant?
vagrant_command("destroy --force", [node.name])
end
+ remote_node_facts(node.name)
end
end
end