How do you configure the YAML for application API’s. For instance the snapcraft.YAML defined for Mosquitto does not define any API commands - and does not seem to work with mosquitto_sub or mosquitto_pub.
How do you configure the YAML for application API interfaces.
I don’t understand what you mean by “configure for application APIs”. To add additional commands you just need to add another app config to the apps: section, and ensure the files are present in the snap by adjusting the prime: section to not exclude them. (at the moment the yaml only includes the usr/local/sbin/mosquitto file and dependent libraries, so you’ll need to add the mosquitto_sub and mosquitto_pub files wherever they reside.
from the command line. When the same code base is installed as a snap on Ubuntu 16, That doesn’t work.
I understand what you are saying about the apps:section and prime. I don’t know if Mosquitto_pub and Mosquitto_sub are separate packages. I know the client is. Good tip, I’ll look into that.
I’ve done the hello world tutorial. It doesn’t include an example where input values are passed. I believe that should be defined in a YAML Command entry. I’ve read most of the docs. I’m still not clear on how to configure YAML for an existing apt-get deployed app and have it function the same way with a snap deployed app.
For “why”, whoever coded the snapcraft.yaml (if that wasn’t you) probably overlooked the other commands. If you coded it then “how” it is incomplete, I’ve already explained that the additional commands need to be specified and included.
Passing arguments to the command can be specified by the yaml if you want to ensure they’re always the same on every invocation. Otherwise omit them in the yaml and rely on the user entering them on the command-line when they call the apps.
All arguments passed by the user are forwarded into the command executed by snapd when running the app with no configuration required to make it so.
For example, you could specify an echo command on a snap called my-super-snap with command: echo foo.
It will always print out “foo” when called as my-super-snap.echo.
If the user calls your command with my-super-snap.echo bar then it will print “foo bar”.
In this way you can set arguments like “foo” in this example to always be passed, and the user can add their own arguments which supplement any hard-coded ones. You can also set the command with no arguments in the yaml and expect that the user pass them on the command-line.