summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2016-02-01 15:05:24 -0800
committerelijah <elijah@riseup.net>2016-02-01 15:05:24 -0800
commit80db7cd55385a94802579c4a94d5ad8203b3ee3d (patch)
tree461c41bd7794a5a30a9622c7c842f112fe3287fb /lib
parentceb6a0552097a2cc261cd4884a13cf53deabc337 (diff)
added manager.template(), used when creating new nodes
Diffstat (limited to 'lib')
-rw-r--r--lib/leap_cli/config/manager.rb13
1 files changed, 13 insertions, 0 deletions
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={})