From 50980798983c9cf9b4d562a2a9279ef3ab3d25fc Mon Sep 17 00:00:00 2001 From: elijah Date: Tue, 12 Apr 2016 10:25:25 -0700 Subject: move template() from manager to environment. closes #8026 --- lib/leap_cli/config/environment.rb | 13 +++++++++++++ lib/leap_cli/config/manager.rb | 16 +++------------- 2 files changed, 16 insertions(+), 13 deletions(-) (limited to 'lib/leap_cli') diff --git a/lib/leap_cli/config/environment.rb b/lib/leap_cli/config/environment.rb index 3f0b3f3..df4b56c 100644 --- a/lib/leap_cli/config/environment.rb +++ b/lib/leap_cli/config/environment.rb @@ -100,6 +100,19 @@ module LeapCli; module Config end 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={}) diff --git a/lib/leap_cli/config/manager.rb b/lib/leap_cli/config/manager.rb index 4ad8b71..ecc59f3 100644 --- a/lib/leap_cli/config/manager.rb +++ b/lib/leap_cli/config/manager.rb @@ -71,6 +71,9 @@ module LeapCli def common; env(default_environment).common; end def secrets; env(default_environment).secrets; end def nodes; env(default_environment).nodes; end + def template(*args) + self.env.template(*args) + end def default_environment LeapCli.leapfile.environment @@ -280,19 +283,6 @@ module LeapCli @connections ||= ConnectionList.new 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 ## -- cgit v1.2.3