Boris,

On 9 Nov 2016, at 0:39, Boris Rybalkin wrote:

Sorry, I did not get that.

I am using snapcraft, are you saying that just creating hooks/configure is
not enaugh?

Looks like my hook is not executed:
https://github.com/syncloud/platform/tree/master/snap

Is it possible to debug the execution of snap install?

I would like to see the state of the snap after it failed to start daemons. The only way to see the problem is to run journalctl and guess by startup
errors.

If you have a hard time to troubleshoot why a daemon doesn’t start, then
I suggest to add a non-demon debug “app” to the snap.

As an example, on my Quagga Snap, I have a zebra daemon which is configured
as
   zebra:
        command: bin/zebra-service
        daemon: simple
        plugs:
            - network
            - network-bind
            - network-control
            - network-observe

But then I’ve added an additional debug command:
    zebra-debug:
        command: sbin/zebra [.. with some essential cli options ..]
        plugs:
            - network
            - network-bind
            - network-control
            - network-observe

This way, if the daemon fails to start, I can just run the zebra-debug
command and see the output directly on the screen. Much easier to debug.

Full snapcraft config is at
https://git-us.netdef.org/projects/OSR/repos/quagga-snap/browse/snapcraft

Regards,
   Martin Winter

On 9 Nov 2016 07:52, "Enwei Zhang" <enwei.zh...@canonical.com> wrote:

Got it, thanks so much.

Br
Enwei

On Wed, Nov 9, 2016 at 3:38 PM, Didier Roche <didro...@ubuntu.com> wrote:

Le 09/11/2016 à 07:44, Enwei Zhang a écrit :

Hi Didier,
Sorry to cut in.
Is "hooks" working now in snapcraft?
I encountered error:
I used below in snapcraft.yaml:

hooks: # Top-level YAML attribute, parallel to `apps`
    upgrade: # Hook name, corresponds to executable name
        plugs: [network] # Or any other plugs required by this hook

enwei@XPS-13-9350:~/work/snap/simple-daemon$ snapcraft
Issues while validating snapcraft.yaml: Additional properties are not
allowed ('hooks' was unexpected)
enwei@XPS-13-9350:~/work/snap/simple-daemon$ snapcraft --version
2.20


No, right now, they are only implemented in snapd.
You need to place the correct file in the meta/hooks/ folder (if you are using snapcraft, do this in the prime/ directory, before "snapcraft snap
prime/").

There is an example available at https://github.com/snapcore/sn
apd/tree/master/tests/lib/snaps/basic-hooks/meta/hooks.

Hope that helps!
Didier


Thanks.

Br
Enwei



On Tue, Nov 8, 2016 at 6:28 PM, Didier Roche <didro...@ubuntu.com> wrote:

Le 08/11/2016 à 04:52, Kyle Fazzari a écrit :

On Nov 6, 2016 21:51, "Didier Roche" <didro...@ubuntu.com
<mailto:didro...@ubuntu.com>> wrote:

Le 06/11/2016 à 00:22, Boris Rybalkin a écrit :

Hello,


Hey Boris,

I want to generate my config on snap install using snap location
variables.

From the docs configure hook is only triggered when 'snap set' is
called. Will configure also be called on install and upgrade?

I didn't try it myself yet, but from what I heard yeah, they will be
run
at that time. Kyle can confirm (and if so, we'll update to the
documentation to reflect that).

When I wrote it (and the docs) it was only run with `snap set`. I
believe it's been modified since then to run upon initial install as well as upgrade; indeed Gustavo mentioned that it should serve as an install and an upgrade hook. The docs weren't updated with this change,
it seems. That recommendation should also be documented.

Kyle


FYI, opened https://github.com/ubuntudesign/snapcraft.io/issues/216
about it (after confirming manually this new behavior).

So, to answer on the initial reply: yes, the hooks are ran on install
and upgrade.

Cheers,
Didier

--
Snapcraft mailing list
Snapcraft@lists.snapcraft.io
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailm
an/listinfo/snapcraft






--
Snapcraft mailing list
Snapcraft@lists.snapcraft.io
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailm
an/listinfo/snapcraft



--
Snapcraft mailing list
Snapcraft@lists.snapcraft.io
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailm
an/listinfo/snapcraft




--
Snapcraft mailing list
Snapcraft@lists.snapcraft.io
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/snapcraft

--
Snapcraft mailing list
Snapcraft@lists.snapcraft.io
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/snapcraft

Reply via email to