Git Product home page Git Product logo

Comments (11)

goodboy avatar goodboy commented on August 10, 2024 1

@whiteinge nice and thanks for looking into it.

Actually the main problem for me was it exposed a bug in salt-virt which I now have a fix for and will get in later today.
So all good on my end 👍

from pepper.

goodboy avatar goodboy commented on August 10, 2024

Oh and just to be extra thorough, if you watch the salt-api trace logs you'll see the same types as well:

00:57:13 [28149] [TRACE   ] get_event() received = {'tag': 'salt/job/20170301005713642409/ret/sip-cannon', 'data': {'fun_args': ['trunkte
st2', '2', '2048', 'image=/var/lib/libvirt/images/centos66.qcow2', 'enable_vnc=True', 'config={"master": "goodboy.qa.sangoma.local"}', 's
tart=False', 'enable_qcow=True'], 'jid': '20170301005713642409', 'return': {'args': "('trunktest2', '2', '2048')", 'kwargs': '{\'__pub_us
er\': \'saltvirt\', \'__pub_arg\': [\'trunktest2\', \'2\', \'2048\', \'image=/var/lib/libvirt/images/centos66.qcow2\', \'enable_vnc=True\
', \'config={"master": "goodboy.qa.sangoma.local"}\', \'start=False\', \'enable_qcow=True\'], \'start\': False, \'config\': {\'master\': 
\'goodboy.qa.sangoma.local\'}, \'image\': \'/var/lib/libvirt/images/centos66.qcow2\', \'__pub_fun\': \'test.arg_repr\', \'enable_qcow\': 
True, \'__pub_jid\': \'20170301005713642409\', \'__pub_tgt\': \'sip-cannon\', \'__pub_tgt_type\': \'glob\', \'enable_vnc\': True, \'__pub
_ret\': \'\'}'}, 'retcode': 0, 'success': True, 'cmd': '_return', '_stamp': '2017-03-01T05:57:13.698160', 'fun': 'test.arg_repr', 'id': '
sip-cannon'}}                                                                                                                            

from pepper.

whiteinge avatar whiteinge commented on August 10, 2024

Coincidentally, there's an open PR in Salt that has a fix to make the foo=Foo processing identical to the salt CLI processing. Until that fix is merged and released the best way to preserve types is to use the new --json flag in Pepper (#98) to send JSON instead of name=value arguments.

from pepper.

whiteinge avatar whiteinge commented on August 10, 2024

Ninja edit: I failed at reading -- that PR is a fix for calling Runners. I'm not aware of a mismatch when calling execution functions on minions.

I'll take a closer look at this.

from pepper.

goodboy avatar goodboy commented on August 10, 2024

@whiteinge yeah I think I found the reason after using the python api.

args are shipped verbatim as parsed strings as opposed to converting key=val pairs into **kwargs as is done with the runner client.

The tricky part I'm not sure how to handle is how to deliver parsed **kwargs for each underlying client type. For example local takes them in a kwarg dict whilst runner takes them as **kwargs (which I don't think works by the way in salt core).

I can rummage up a PR for at least the local client if you're cool with it.

from pepper.

whiteinge avatar whiteinge commented on August 10, 2024

I haven't had a chance to take a look at this yet, but shipping args verbatim as name=value pairs is what we want Pepper to do. The reason for that is that the salt CLI command gets that same format from the shell and Salt actually splits them (and also runs the right-hand side through the YAML parser) which is what that parse_input function does. Pepper needs to be updated to also do that for runner calls (once the above PR is merged).

from pepper.

goodboy avatar goodboy commented on August 10, 2024

@whiteinge

shipping args verbatim as name=value pairs is what we want Pepper to do

kk that's fine then but I guess it's besides the point of the missing type casting?

Salt actually splits them (and also runs the right-hand side through the YAML parser) which is what that parse_input function does.

^ would make me think that once that's fixed then maybe this type difference problem goes away?

from pepper.

whiteinge avatar whiteinge commented on August 10, 2024

Yeah, I think so. Running the right-hand side through the YAML parser is what performs the type casting. E.g. foo=True becomes {"foo": true}. And that's what the CLI relies on for that too.

from pepper.

whiteinge avatar whiteinge commented on August 10, 2024

I can reproduce this. The problem is somewhere in salt-api or in Salt. Trying to find the culprit.

If you need a workaround in the meantime, sending JSON via the --json flag to Pepper will allow you to specify the right data types up-front rather than relying on the name=value parsing in Salt.

from pepper.

gtmanfred avatar gtmanfred commented on August 10, 2024

This will be fixed with the neon release of salt.

from pepper.

goodboy avatar goodboy commented on August 10, 2024

@gtmanfred woot glad to see it finally landed :)

from pepper.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.