You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by "Alan Conway (JIRA)" <ji...@apache.org> on 2016/06/28 15:01:00 UTC

[jira] [Comment Edited] (DISPATCH-411) Boolean options in configs and CLI should be parsed consistently

    [ https://issues.apache.org/jira/browse/DISPATCH-411?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15353137#comment-15353137 ] 

Alan Conway edited comment on DISPATCH-411 at 6/28/16 3:00 PM:
---------------------------------------------------------------

This is again related to the new C entities, which seem to be bypassing the python schema validation layer for create/update commands. There is a hack in qpmanage to turn "true/false" into boolean values but this is incorrect and inadequate. First qdmanage has no idea at this point whether the attributes have boolean type, they might be strings that should not be converted. Second the set of conversions does not match the allowed schema values. We need to validate all management commands consistently in the python schema before delegating to the C layer so they get consistent conversions, validation, default values etc. as specified by the schema.

To be clear: the original design was that tools like qdmanage should simply pass through string values to the agent (unless qdmanage is explicitly given json, in which case it passes json types through unmodified.) The agent consistently decides what is legal and what conversions to do based on the schema.


was (Author: aconway):
This is again related to the new C entities, which seem to be bypassing the python schema validation layer for create/update commands. There is a hack in qpmanage to turn "true/false" into boolean values but this is incorrect and inadequate. First qdmanage has no idea at this point whether the attributes have boolean type, they might be strings that should not be converted. Second the set of conversions does not match the allowed schema values. We need to validate all management commands consistently in the python schema before delegating to the C layer so they get consistent conversions, validation, default values etc. as specified by the schema

> Boolean options in configs and CLI should be parsed consistently
> ----------------------------------------------------------------
>
>                 Key: DISPATCH-411
>                 URL: https://issues.apache.org/jira/browse/DISPATCH-411
>             Project: Qpid Dispatch
>          Issue Type: Bug
>    Affects Versions: 0.6.0
>            Reporter: Jiri Danek
>            Assignee: Ganesh Murthy
>
> {{waypoint=yes}} is parsed as false. I have to type {{waypoint=true}} for the next command to work. In config file, {{waypoint: yes}} does work.
> {quote}$ qdmanage create --type address prefix=jmse.queue waypoint=yes
>   "name": null,
>   "prefix": "jmse.queue",
>   "ingressPhase": 0,
>   "waypoint": false,
>   "distribution": "balanced",
>   "type": "org.apache.qpid.dispatch.router.config.address",
>   "identity": "27",
>   "egressPhase": 0
> {quote}
> There seem to be two places that parse Boolean options. First is the conf file https://github.com/apache/qpid-dispatch/blob/b5ca35fc770262850cec2b7bd134a667fd713fff/python/qpid_dispatch_internal/management/schema.py#L83, which recognizes (case insensitively) "yes, true, on, 1" as truthy values, "no, false, off, 0" as falsey values. Anything else is an error.
> Second is https://github.com/apache/qpid-dispatch/blob/2b1d8f67f3ad5dd25edaf8fc71117988a14e102d/run.py.in#L91. which recognizes (again case insensitively) "on, yes, 1" as truthy and everything else falsey (no error)
> Finally, qdmanage https://github.com/apache/qpid-dispatch/blob/9c4933ffbd4821e55b0dc870c254d55eecffea89/tools/qdmanage#L34 recognizes (case sensitive, this time) only "true", and anything else is considered to be falsey. 
> I'd wish this to be more consistent.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org