[MediaWiki-commits] [Gerrit] operations...cumin[master]: OpenStack: limit grammar to not overlap the global one

2017-09-26 Thread jenkins-bot (Code Review)
jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/380653 )

Change subject: OpenStack: limit grammar to not overlap the global one
..


OpenStack: limit grammar to not overlap the global one

* In order to not overlap with the global grammar syntax for the
  aliases, limit the openstack grammar keys to lower case letters and at
  least two carachters long.

Change-Id: I725943233c8396ebb2a2b0004064adb150b9905d
---
M cumin/backends/openstack.py
M cumin/tests/fixtures/backends/grammars/openstack_invalid.txt
M cumin/tests/fixtures/backends/grammars/openstack_valid.txt
3 files changed, 8 insertions(+), 2 deletions(-)

Approvals:
  jenkins-bot: Verified
  Volans: Looks good to me, approved



diff --git a/cumin/backends/openstack.py b/cumin/backends/openstack.py
index c48bca5..2ee9426 100644
--- a/cumin/backends/openstack.py
+++ b/cumin/backends/openstack.py
@@ -34,8 +34,8 @@
 quoted_string = pp.quotedString.copy().addParseAction(pp.removeQuotes)  # 
Both single and double quotes are allowed
 
 # Key-value tokens: key:value
-# All printables characters except the parentheses that are part of this 
or the global grammar
-key = pp.Word(pp.alphanums + '-_.')('key')
+# Lowercase key, all printable characters except the parentheses that are 
part of the global grammar for the value
+key = pp.Word(pp.srange('[a-z0-9-_.]"'), min=2)('key')
 all_but_par = ''.join([c for c in pp.printables if c not in ('(', ')', 
'{', '}')])
 value = (quoted_string | pp.Word(all_but_par))('value')
 item = pp.Combine(key + ':' + value)
diff --git a/cumin/tests/fixtures/backends/grammars/openstack_invalid.txt 
b/cumin/tests/fixtures/backends/grammars/openstack_invalid.txt
index 2c6cc72..4468c10 100644
--- a/cumin/tests/fixtures/backends/grammars/openstack_invalid.txt
+++ b/cumin/tests/fixtures/backends/grammars/openstack_invalid.txt
@@ -4,3 +4,8 @@
 key:value :value
 "key":value
 key%:value
+A:value
+a:value
+KEY:value
+Key:value
+kEy:value
diff --git a/cumin/tests/fixtures/backends/grammars/openstack_valid.txt 
b/cumin/tests/fixtures/backends/grammars/openstack_valid.txt
index f4b3d01..a4f7a76 100644
--- a/cumin/tests/fixtures/backends/grammars/openstack_valid.txt
+++ b/cumin/tests/fixtures/backends/grammars/openstack_valid.txt
@@ -8,3 +8,4 @@
 project:"Project Name"
 project:project_name name:host1
 project:"Project Name" name:host1
+ip:value

-- 
To view, visit https://gerrit.wikimedia.org/r/380653
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I725943233c8396ebb2a2b0004064adb150b9905d
Gerrit-PatchSet: 2
Gerrit-Project: operations/software/cumin
Gerrit-Branch: master
Gerrit-Owner: Volans 
Gerrit-Reviewer: Chasemp 
Gerrit-Reviewer: Faidon Liambotis 
Gerrit-Reviewer: Volans 
Gerrit-Reviewer: jenkins-bot <>

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits


[MediaWiki-commits] [Gerrit] operations...cumin[master]: OpenStack: limit grammar to not overlap the global one

2017-09-25 Thread Volans (Code Review)
Volans has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/380653 )

Change subject: OpenStack: limit grammar to not overlap the global one
..

OpenStack: limit grammar to not overlap the global one

* In order to not overlap with the global grammar syntax for the
  aliases, limit the openstack grammar keys to lower case letters and at
  least length two carachters.

Change-Id: I725943233c8396ebb2a2b0004064adb150b9905d
---
M cumin/backends/openstack.py
M cumin/tests/fixtures/backends/grammars/openstack_invalid.txt
M cumin/tests/fixtures/backends/grammars/openstack_valid.txt
3 files changed, 8 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/operations/software/cumin 
refs/changes/53/380653/1

diff --git a/cumin/backends/openstack.py b/cumin/backends/openstack.py
index c48bca5..2ee9426 100644
--- a/cumin/backends/openstack.py
+++ b/cumin/backends/openstack.py
@@ -34,8 +34,8 @@
 quoted_string = pp.quotedString.copy().addParseAction(pp.removeQuotes)  # 
Both single and double quotes are allowed
 
 # Key-value tokens: key:value
-# All printables characters except the parentheses that are part of this 
or the global grammar
-key = pp.Word(pp.alphanums + '-_.')('key')
+# Lowercase key, all printable characters except the parentheses that are 
part of the global grammar for the value
+key = pp.Word(pp.srange('[a-z0-9-_.]"'), min=2)('key')
 all_but_par = ''.join([c for c in pp.printables if c not in ('(', ')', 
'{', '}')])
 value = (quoted_string | pp.Word(all_but_par))('value')
 item = pp.Combine(key + ':' + value)
diff --git a/cumin/tests/fixtures/backends/grammars/openstack_invalid.txt 
b/cumin/tests/fixtures/backends/grammars/openstack_invalid.txt
index 2c6cc72..4468c10 100644
--- a/cumin/tests/fixtures/backends/grammars/openstack_invalid.txt
+++ b/cumin/tests/fixtures/backends/grammars/openstack_invalid.txt
@@ -4,3 +4,8 @@
 key:value :value
 "key":value
 key%:value
+A:value
+a:value
+KEY:value
+Key:value
+kEy:value
diff --git a/cumin/tests/fixtures/backends/grammars/openstack_valid.txt 
b/cumin/tests/fixtures/backends/grammars/openstack_valid.txt
index f4b3d01..a4f7a76 100644
--- a/cumin/tests/fixtures/backends/grammars/openstack_valid.txt
+++ b/cumin/tests/fixtures/backends/grammars/openstack_valid.txt
@@ -8,3 +8,4 @@
 project:"Project Name"
 project:project_name name:host1
 project:"Project Name" name:host1
+ip:value

-- 
To view, visit https://gerrit.wikimedia.org/r/380653
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I725943233c8396ebb2a2b0004064adb150b9905d
Gerrit-PatchSet: 1
Gerrit-Project: operations/software/cumin
Gerrit-Branch: master
Gerrit-Owner: Volans 

___
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits