<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<p><br>
</p>
<br>
<div class="moz-cite-prefix">On 10/27/2016 08:52 AM, Didier Roche
wrote:<br>
</div>
<blockquote
cite="mid:68bb80bc-f846-fd99-a010-bdf7695e8a80@ubuntu.com"
type="cite">
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
<div class="moz-cite-prefix">Le 27/10/2016 à 17:33, Aaron Ogle a
écrit :<br>
</div>
<blockquote
cite="mid:CAGX5j1zgPh8R0o5n_8pDNTqCbjASj3rja3rLNZrMKDOXkOuS6w@mail.gmail.com"
type="cite">
<div dir="ltr">Didier:
<div><br>
</div>
<div>This sounds like exactly what I wanted! So once this
lands I will be able to just use: <span
style="color:rgb(24,54,145);background-color:rgb(247,247,247);font-family:consolas,"liberation
mono",menlo,courier,monospace;font-size:13.6px">snapctl
get value</span> to get user set information?</div>
</div>
</blockquote>
Exactly!<br>
<br>
<blockquote
cite="mid:CAGX5j1zgPh8R0o5n_8pDNTqCbjASj3rja3rLNZrMKDOXkOuS6w@mail.gmail.com"
type="cite">
<div dir="ltr">
<div><br>
</div>
<div>Will the snapctl command be available anywhere in the
snap or only in the hooks?</div>
</div>
</blockquote>
<br>
I guess the main intent is to use them primarily in hooks, but
nothing should prevent it to be available in your other snap
daemon as well (as it's part of the core rootfs).<br>
</blockquote>
<br>
There's currently a limitation here in that `snapctl get/set` needs
to know the snap whose config is being queried/altered (and snaps
shouldn't be able to query/alter the config of other snaps). This is
done via a token that is generated and tracked by snapd for each
hook instance and then used in each `snapctl` invocation. Currently
this token is not generated for apps, which means `snapctl` is only
useful within hooks for the time being. I'm uncertain on the
timeline, but as I understand it, the plan is to make `snapctl` work
within apps as well.<br>
<br>
<blockquote
cite="mid:68bb80bc-f846-fd99-a010-bdf7695e8a80@ubuntu.com"
type="cite"> <br>
<blockquote
cite="mid:CAGX5j1zgPh8R0o5n_8pDNTqCbjASj3rja3rLNZrMKDOXkOuS6w@mail.gmail.com"
type="cite">
<div dir="ltr">
<div><br>
</div>
<div>Also the upgrade hook looks like it could be a thing of
beauty. Any plans for a downgrade hook?</div>
</div>
</blockquote>
<br>
I don't know about any plan for that, I'll let others answer. I
think you mean a downgrade hook being executed after a snap revert
to fetch back "newer data" that could be lost in the revert
process and transfer back to the older version? Or do you have any
other use case in mind?<br>
<br>
Didier<br>
<blockquote
cite="mid:CAGX5j1zgPh8R0o5n_8pDNTqCbjASj3rja3rLNZrMKDOXkOuS6w@mail.gmail.com"
type="cite"><br>
<div class="gmail_quote">
<div dir="ltr">On Thu, Oct 27, 2016 at 10:14 AM Didier Roche
<<a moz-do-not-send="true"
href="mailto:didrocks@ubuntu.com">didrocks@ubuntu.com</a>>
wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">Le
27/10/2016 à 16:50, Aaron Ogle a écrit :<br
class="gmail_msg">
> Greetings,<br class="gmail_msg">
><br class="gmail_msg">
> With our Rocket.Chat snap, we're looking to be able to
allow someone<br class="gmail_msg">
> to run an external mongodb instead of the built in
one. As well as<br class="gmail_msg">
> we'd like to add something like caddy / traefik etc to
do ssl<br class="gmail_msg">
> termination. But its not a daemon we would want
enabled out of the<br class="gmail_msg">
> box because of the effect on existing users.<br
class="gmail_msg">
><br class="gmail_msg">
> So basically looking for a way let the user of a snap
enable or<br class="gmail_msg">
> disable two different daemons in our snap.<br
class="gmail_msg">
><br class="gmail_msg">
> Is this possible using anything out of the box? Or
would I have to<br class="gmail_msg">
> make the command ran in the daemon look at an
environment variable /<br class="gmail_msg">
> file etc. and determine if it should make the daemon
just exit?<br class="gmail_msg">
><br class="gmail_msg">
> How have others handled this? Or allowing users to
customize snap<br class="gmail_msg">
> behaviour?<br class="gmail_msg">
<br class="gmail_msg">
Hey Aaron,<br class="gmail_msg">
<br class="gmail_msg">
sounds like a great plan for usability!<br class="gmail_msg">
<br class="gmail_msg">
I would suggest using configure hooks to proceed that. Hooks
are just a<br class="gmail_msg">
way for users to set variable=value. Based on that, you can
control your<br class="gmail_msg">
daemon with a configure script (triggered by this command)
inside your<br class="gmail_msg">
snap. This one can triggers start and stop inside a mongodb
daemon<br class="gmail_msg">
wrapper (waiting for a certain value to be passed for
instance before<br class="gmail_msg">
executing the real daemon).<br class="gmail_msg">
<br class="gmail_msg">
The documentation is not yet published on <a
moz-do-not-send="true" href="http://snapcraft.io"
rel="noreferrer" class="gmail_msg" target="_blank">snapcraft.io</a>
AFAIK, but is<br class="gmail_msg">
available there:<br class="gmail_msg">
<a moz-do-not-send="true"
href="https://github.com/snapcore/snapd/blob/master/docs/hooks.md"
rel="noreferrer" class="gmail_msg" target="_blank">https://github.com/snapcore/snapd/blob/master/docs/hooks.md</a>.<br
class="gmail_msg">
<br class="gmail_msg">
However, please keep in mind about this bug<br
class="gmail_msg">
<a moz-do-not-send="true"
href="https://bugs.launchpad.net/snappy/+bug/1636931"
rel="noreferrer" class="gmail_msg" target="_blank">https://bugs.launchpad.net/snappy/+bug/1636931</a>,
we need a new core image<br class="gmail_msg">
to have snapctl available from your snap, and so, you won't
be able to<br class="gmail_msg">
experiment it right away.<br class="gmail_msg">
<br class="gmail_msg">
I'll probably write a codelab on this precise topic in a
couple of weeks<br class="gmail_msg">
FYI (once the feature is really available to users and
developers).<br class="gmail_msg">
Cheers,<br class="gmail_msg">
Didier<br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
--<br class="gmail_msg">
Snapcraft mailing list<br class="gmail_msg">
<a moz-do-not-send="true"
href="mailto:Snapcraft@lists.snapcraft.io"
class="gmail_msg" target="_blank">Snapcraft@lists.snapcraft.io</a><br
class="gmail_msg">
Modify settings or unsubscribe at: <a
moz-do-not-send="true"
href="https://lists.ubuntu.com/mailman/listinfo/snapcraft"
rel="noreferrer" class="gmail_msg" target="_blank">https://lists.ubuntu.com/mailman/listinfo/snapcraft</a><br
class="gmail_msg">
</blockquote>
</div>
<div dir="ltr">-- <br>
</div>
<div data-smartmail="gmail_signature">
<div dir="ltr">
<div><br>
</div>
<div>
<table
style="color:rgb(0,0,0);font-family:verdana;font-size:medium"
border="0" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td style="padding-right:15px"> <img
moz-do-not-send="true"
src="https://cdn-download.rocket.chat/email-signature.png?v=3"
style="width: 80px; display: block; margin-left:
10px;"> </td>
<td
style="padding-left:15px;border-left-width:1px;border-left-style:solid;border-left-color:rgb(240,240,240)"
valign="top">
<table
style="border-collapse:collapse;font-size:12px;margin-top:4px"
border="0" cellpadding="3" cellspacing="0"
width="100%">
<tbody>
<tr>
<td style="padding:3px 0px
10px;margin:0px;font-family:verdana,geneva,sans-serif;font-size:12px;color:rgb(86,97,120)">
<b style="display:block;font-size:12px">Aaron
Ogle</b> <span
style="color:rgb(153,153,153);font-size:10px;display:block">Core
Developer</span> </td>
</tr>
<tr>
<td style="padding:0px 0px 2px;margin:0px">
<p style="margin:0px;padding:0px"><a
moz-do-not-send="true"
href="mailto:aaron.ogle@rocket.chat"
style="color:rgb(156,160,172);font-size:10px"
target="_blank">aaron.ogle@rocket.chat</a></p>
</td>
</tr>
<tr>
</tr>
<tr>
<td style="padding:0px 0px 2px;margin:0px">
<p style="margin:0px;padding:0px"><a
moz-do-not-send="true"
href="https://demo.rocket.chat/direct/aaron.ogle"
style="color:rgb(156,160,172);font-size:10px" target="_blank">@aaron.ogle</a></p>
</td>
</tr>
<tr>
<td style="padding:0px 0px 2px;margin:0px">
<p style="margin:0px;padding:0px"><a
moz-do-not-send="true"
href="https://rocket.chat"
style="color:rgb(156,160,172);font-size:10px"
target="_blank">https://rocket.chat</a></p>
</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
</blockquote>
<p><br>
</p>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
Kyle Fazzari (kyrofa)
Software Engineer
Canonical Ltd.
<a class="moz-txt-link-abbreviated" href="mailto:kyle@canonical.com">kyle@canonical.com</a></pre>
</body>
</html>