summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2020-06-23 19:13:03 -0500
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2020-06-23 19:13:03 -0500
commitba41e758a786158c695229faa1068c06717bf79f (patch)
tree7de894d45dd3da3539c70e5ae76c4b810663c678
parenta0f9b88d4bacad9df4bb10f7a68bfc310bbcf4b1 (diff)
downloadhorizon-ba41e758a786158c695229faa1068c06717bf79f.tar.gz
horizon-ba41e758a786158c695229faa1068c06717bf79f.tar.bz2
horizon-ba41e758a786158c695229faa1068c06717bf79f.tar.xz
horizon-ba41e758a786158c695229faa1068c06717bf79f.zip
Change Runner.Validate.hostname.Begin to allow numeric characters
-rw-r--r--devel/requirements/3b_runner.xml2
-rw-r--r--hscript/meta.cc4
-rw-r--r--tests/spec/validator_spec.rb3
3 files changed, 5 insertions, 4 deletions
diff --git a/devel/requirements/3b_runner.xml b/devel/requirements/3b_runner.xml
index 7660661..a5080fe 100644
--- a/devel/requirements/3b_runner.xml
+++ b/devel/requirements/3b_runner.xml
@@ -196,7 +196,7 @@
</formalpara>
<formalpara id="Runner.Validate.hostname.Begin">
<title>Runner.Validate.hostname.Begin</title>
- <para>The system shall verify that the value for the <literal>hostname</literal> key begins with an alphabetical character.</para>
+ <para>The system shall verify that the value for the <literal>hostname</literal> key begins with an alphanumeric character.</para>
</formalpara>
<formalpara id="Runner.Validate.hostname.Length">
<title>Runner.Validate.hostname.Length</title>
diff --git a/hscript/meta.cc b/hscript/meta.cc
index 52ed3db..15734c5 100644
--- a/hscript/meta.cc
+++ b/hscript/meta.cc
@@ -43,9 +43,9 @@ bool Hostname::validate() const {
bool any_failure = false;
std::string::size_type last_dot = 0, next_dot = 0;
- if(!isalpha(this->_value[0])) {
+ if(!isalnum(this->_value[0])) {
any_failure = true;
- output_error(pos, "hostname: must start with alphabetical character");
+ output_error(pos, "hostname: must start with alphanumeric character");
}
if(this->_value.size() > 320) {
diff --git a/tests/spec/validator_spec.rb b/tests/spec/validator_spec.rb
index 0bd3516..a5e11e6 100644
--- a/tests/spec/validator_spec.rb
+++ b/tests/spec/validator_spec.rb
@@ -136,7 +136,8 @@ RSpec.describe 'HorizonScript validation', :type => :aruba do
it "with non-alphabetical first character" do
use_fixture '0024-numeric-hostname.installfile'
run_validate
- expect(last_command_started).to have_output(/error: .*hostname.*/)
+ expect(last_command_started).to have_output(PARSER_SUCCESS)
+ expect(last_command_started).to have_output(VALIDATOR_SUCCESS)
end
# Runner.Validate.hostname.Length
it "with >320 characters" do