From 80db7cd55385a94802579c4a94d5ad8203b3ee3d Mon Sep 17 00:00:00 2001 From: elijah Date: Mon, 1 Feb 2016 15:05:24 -0800 Subject: added manager.template(), used when creating new nodes --- lib/leap_cli/config/manager.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'lib') diff --git a/lib/leap_cli/config/manager.rb b/lib/leap_cli/config/manager.rb index 2013217..ca739c3 100644 --- a/lib/leap_cli/config/manager.rb +++ b/lib/leap_cli/config/manager.rb @@ -331,6 +331,19 @@ module LeapCli @partials[partial_path] end + # + # Loads a json template file as a Hash (used only when creating a new node .json + # file for the first time). + # + def template(template) + path = Path.named_path([:template_config, template], Path.provider_base) + if File.exists?(path) + return load_json(path, Config::Object) + else + return nil + end + end + private def load_all_json(pattern, object_class, options={}) -- cgit v1.2.3