summaryrefslogtreecommitdiff
path: root/lib/leap_cli/config/environment.rb
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2016-08-24 17:37:00 -0700
committerelijah <elijah@riseup.net>2016-08-24 17:37:00 -0700
commitb928a8f29b40df545ac6a72ead6cb9ed6a36fbda (patch)
treee83790db3d53ae6c3d9195889a47e4800bdad601 /lib/leap_cli/config/environment.rb
parent205b61dfe721e6d88fc06b050a0497eeb35f4e02 (diff)
leap vm: fixed bug, added more sanity checking.
Diffstat (limited to 'lib/leap_cli/config/environment.rb')
-rw-r--r--lib/leap_cli/config/environment.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/leap_cli/config/environment.rb b/lib/leap_cli/config/environment.rb
index dadd9eaf..ce570839 100644
--- a/lib/leap_cli/config/environment.rb
+++ b/lib/leap_cli/config/environment.rb
@@ -121,6 +121,18 @@ module LeapCli; module Config
end
end
+ #
+ # Alters the node's json config file. Unfortunately, doing this will
+ # strip out all the comments.
+ #
+ def update_node_json(node, new_values)
+ node_json_path = Path.named_path([:node_config, node.name])
+ old_data = load_json(node_json_path, Config::Node)
+ new_data = old_data.merge(new_values)
+ new_contents = JSON.sorted_generate(new_data) + "\n"
+ Util::write_file! node_json_path, new_contents
+ end
+
private
def load_all_json(pattern, object_class, options={})