summaryrefslogtreecommitdiff
path: root/lib/leap_cli/config/manager.rb
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2017-04-25 12:18:04 -0700
committerelijah <elijah@riseup.net>2017-04-25 23:39:06 -0700
commit0b3aef03cb113e997c2a654ef2f7b1674a0a8877 (patch)
tree0ed6ee0636116f299e381e97b3dd34e06cdbb1be /lib/leap_cli/config/manager.rb
parentada9645de11d75701db8202f34de5c26a2b749c2 (diff)
bugfix: ensure that nodes only have one environment specified (closes #8778)
Diffstat (limited to 'lib/leap_cli/config/manager.rb')
-rw-r--r--lib/leap_cli/config/manager.rb15
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/leap_cli/config/manager.rb b/lib/leap_cli/config/manager.rb
index d69a5808..a9f1a85f 100644
--- a/lib/leap_cli/config/manager.rb
+++ b/lib/leap_cli/config/manager.rb
@@ -342,14 +342,25 @@ module LeapCli
if node.vagrant?
return self.env("local")
else
- environment = self.env(default_environment)
+ environment = nil
if node['tags']
node['tags'].to_a.each do |tag|
if self.environment_names.include?(tag)
- environment = self.env(tag)
+ if environment.nil?
+ environment = self.env(tag)
+ else
+ LeapCli::Util.bail! do
+ LeapCli.log(
+ :error,
+ "The node '%s' is invalid, because it cannot have two environments ('%s' and '%s')." %
+ [node.name, environment.name, tag]
+ )
+ end
+ end
end
end
end
+ environment ||= self.env(default_environment)
return environment
end
end