From ea4c51b822691ad59ab04fd9b12cc408fd105f1b Mon Sep 17 00:00:00 2001 From: elijah Date: Mon, 17 Dec 2012 22:17:29 -0800 Subject: forbid illegal characters in the node name. --- lib/leap_cli/commands/node.rb | 2 +- lib/leap_cli/config/manager.rb | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/leap_cli/commands/node.rb b/lib/leap_cli/commands/node.rb index 87718e9..6a60c45 100644 --- a/lib/leap_cli/commands/node.rb +++ b/lib/leap_cli/commands/node.rb @@ -22,7 +22,7 @@ module LeapCli; module Commands # argument sanity checks name = args.first assert! name, 'No specified.' - assert! name =~ /^[0-9a-z_-]+$/, "illegal characters used in node name '#{name}'" + assert! name =~ /^[0-9a-z-]+$/, "illegal characters used in node name '#{name}'" assert_files_missing! [:node_config, node.name] # create and seed new node diff --git a/lib/leap_cli/config/manager.rb b/lib/leap_cli/config/manager.rb index adda9bd..6702fc4 100644 --- a/lib/leap_cli/config/manager.rb +++ b/lib/leap_cli/config/manager.rb @@ -43,6 +43,7 @@ module LeapCli @common.inherit_from! base_common @provider.inherit_from! base_provider @nodes.each do |name, node| + Util::assert! name =~ /^[0-9a-z-]+$/, "Illegal character(s) used in node name '#{name}'" @nodes[name] = apply_inheritance(node) end -- cgit v1.2.3