<div dir="ltr">Hi All,<div><br></div><div>Thank you for all the advice. @Andrew Wilkins: turning up logging unstuck me. :-)</div><div><br></div><div>Details follow, for those interested:</div><div><br></div><div>I've been mis-stating the root of the problem. It's not a blank value in config.yaml, it's a blank value in the "options" for haproxy in the bundle.yaml. The good news is that the config-yaml param thing is definitely the right fix for this.</div><div><br></div><div>The bug in python-libjuju wasn't an esoteric encoding issue -- it was simply a formatting issue, plus the fact that python-libjuju isn't interpreting all the error messages it gets back from the websocket api as errors, so I wasn't seeing the error from the gui as a traceback; I caught the error after doing a more careful read-through of the logs. I've filed a ticket against python-libjuju (<a href="https://github.com/juju/python-libjuju/issues/65">https://github.com/juju/python-libjuju/issues/65</a>) covering the issue with missing errors.</div><div><br></div><div>The actual formatting issue is that the websocket api wants the value of config-yaml to be a yaml string with everything under the application name. In Python, this line fixes everything: </div><div><br></div><div> options = yaml.dump({application: options})</div><div><br></div><div>(@Jeff Pihach: I don't see the GUI doing this, but I may be missing where it does it later on, outside of the code in your PR.)</div><div><br></div><div>In any case, I'll be submitting that as a patch to python-libjuju in the near future.</div><div><br></div><div>Meanwhile, thanks again for all your help.</div><div><br></div><div>~ PeteVG</div></div><br><div class="gmail_quote"><div dir="ltr">On Wed, Mar 1, 2017 at 12:07 AM Jeff Pihach <<a href="mailto:jeff.pihach@canonical.com">jeff.pihach@canonical.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class="gmail_msg">Hi Pete,<div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">I recently modified the GUI to use the new `configYAML` field. To do so I took the JSON that we normally sent in the `config` argument and passed it as the `configYAML` argument. You can see the PR[0] for the change made and a little code comment as to why. </div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">If you'd like an easy way to inspect the RPC calls you can also do so by checking out the JS API in the GUI and/or inspecting the WS in the GUI and performing the various actions to see the live interactions with Juju. <br class="gmail_msg"></div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">[0] <a href="https://github.com/juju/juju-gui/pull/2527/files" class="gmail_msg" target="_blank">https://github.com/juju/juju-gui/pull/2527/files</a></div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">Hope this helps!</div></div><div dir="ltr" class="gmail_msg"><div class="gmail_msg">- Jeff</div></div><div class="gmail_extra gmail_msg"><div class="gmail_quote gmail_msg">On Tue, Feb 28, 2017 at 4:42 PM, Pete Vander Giessen <span dir="ltr" class="gmail_msg"><<a href="mailto:pete.vandergiessen@canonical.com" class="gmail_msg" target="_blank">pete.vandergiessen@canonical.com</a>></span> wrote:<br class="gmail_msg"></div></div><div class="gmail_extra gmail_msg"><div class="gmail_quote gmail_msg"><blockquote class="gmail_quote gmail_msg" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class="gmail_msg">Hi All,<div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">I'm currently working on getting python-libjuju to successfully deploy the landscape-dense-maas bundle. It fails, as outlined in <a href="https://bugs.launchpad.net/juju/+bug/1651260" class="gmail_msg" target="_blank">https://bugs.launchpad.net/juju/+bug/1651260</a>.</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">(python-libjuju is a Python client that talks to Juju's websocket API; I'm currently using it inside the matrix testing framework.)</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">The comments in that bug suggest that the root of the problem is that I'm trying to deploy a charm (haproxy) that has an empty string as a default value, but python-libjuju is using the legacy "config" param when it calls ApplicationDeploy in the api, rather than the new "config-yaml" param. This sounds simple to fix -- all I have to do is change an arg from "config" to "config-yaml", and everything should work!</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">One hitch: the "config" param expects a json object, which is what we get back when we make our initial call to the planner, but config-yaml expects a string with yaml in it (this is per the logic in deployApplication in juju/apiserver/application/application.go). </div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">That also sounds simple. As we do elsewhere in python-libjuju when we want to pass a yaml blob to the API, I use Python's handy yaml library, do yaml.dump(config), where "config" is the json config object I got from the planner, and everything should work!</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">This is where I'm stuck. If I pass in such a string, the websocket API simple hangs, and stops talking to me. I don't even see any error messages in the logs on my controller :-/</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">Does anyone have any insight as to what I might be doing incorrectly? In Python3, yaml.dump will produce a utf-8 string by default. All of that will get serialized to json before being submitted over the websocket, though, so I don't *think* that it's an encoding issue. (Passing the bundle in as a yaml blob to the planner in the first place works.) The config object I get back from the planner isn't wrapped in an "options" key, but adding that key before dumping the config to a yaml string doesn't fix the problem -- I still see the hang.</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">Apologies for the length of the post. And thanks in advance for anything you can do to get me unstuck!</div><div class="gmail_msg"><br class="gmail_msg"></div><div class="gmail_msg">~ PeteVG</div></div>
<br class="gmail_msg"></blockquote></div></div><div class="gmail_extra gmail_msg"><div class="gmail_quote gmail_msg"><blockquote class="gmail_quote gmail_msg" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">--<br class="gmail_msg">
Juju-dev mailing list<br class="gmail_msg">
<a href="mailto:Juju-dev@lists.ubuntu.com" class="gmail_msg" target="_blank">Juju-dev@lists.ubuntu.com</a><br class="gmail_msg">
Modify settings or unsubscribe at: <a href="https://lists.ubuntu.com/mailman/listinfo/juju-dev" rel="noreferrer" class="gmail_msg" target="_blank">https://lists.ubuntu.com/mailman/listinfo/juju-dev</a><br class="gmail_msg">
<br class="gmail_msg"></blockquote></div></div></blockquote></div>