Michael Pasternak has uploaded a new change for review. Change subject: cli: accept IP address as FQ argument rather than string #886067 ......................................................................
cli: accept IP address as FQ argument rather than string #886067 https://bugzilla.redhat.com/show_bug.cgi?id=886067 Change-Id: Ie6e46cf671f05580cbf5734cad3a1532e4df45ab Signed-off-by: Michael Pasternak <[email protected]> --- M src/cli/parser.py 1 file changed, 12 insertions(+), 3 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine-cli refs/changes/54/12954/1 diff --git a/src/cli/parser.py b/src/cli/parser.py index b855d08..30f6b24 100644 --- a/src/cli/parser.py +++ b/src/cli/parser.py @@ -29,7 +29,7 @@ multi-line inputs. """ - tokens = ('UUID', 'WORD', 'STRING', 'NUMBER', 'OPTION', 'LT', 'LTLT', 'GT', 'GTGT', + tokens = ('IPADDR', 'UUID', 'WORD', 'STRING', 'NUMBER', 'OPTION', 'LT', 'LTLT', 'GT', 'GTGT', 'BANG', 'PIPE', 'NEWLINE', 'MARKER', 'HEREDOC', 'SHELL') literals = ('=', ';') states = [('heredoc1', 'inclusive'), ('heredoc2', 'exclusive'), @@ -46,6 +46,13 @@ t_ignore_quoted_newline = r'\\\n' t_heredoc2_ignore = ' \t' t_shell_ignore = ' \t' + + def t_IPADDR(self, t): + # ip validity check performed on the server side, + # this pattern only recognizes the IP address form + r'\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}' + t.value = str(t.value) + return t def t_UUID(self, t): r'[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}' @@ -166,7 +173,8 @@ p[0] = p[1] + [p[2]] def p_argument(self, p): - """argument : UUID + """argument : IPADDR + | UUID | WORD | STRING | NUMBER @@ -197,7 +205,8 @@ p[0] = (p[1], p[3]) def p_option_value(self, p): - """option_value : UUID + """option_value : IPADDR + | UUID | WORD | STRING | NUMBER -- To view, visit http://gerrit.ovirt.org/12954 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ie6e46cf671f05580cbf5734cad3a1532e4df45ab Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine-cli Gerrit-Branch: master Gerrit-Owner: Michael Pasternak <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
