Snapcraft.yaml - plugs format

Hei,

I’ve seen snapcraft.yaml have the plugs: section in two styles.

plugs: [list of plugs, another one, ...]

and then

plugs:
    - one plug
    - another plug

Does the 1st format [list] actually work? Based on some snappy-debug logs I’m getting it seems like it would not work…

  • Using core20 as base.

This is the log entry I got.

AppArmor =
Time: Apr  3 11:23:07
Log: apparmor="DENIED" operation="open" profile="snap.pelion-edge.fluent-bit" name="/run/log/journal/" pid=34182 comm="flb-pipeline" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
File: /run/log/journal/ (read)
Suggestions:
* adjust program to use $SNAP_DATA
* adjust program to use /run/shm/snap.$SNAP_NAME.*
* adjust program to use /run/snap.$SNAP_NAME.*
* adjust snap to use snap layouts (https://forum.snapcraft.io/t/snap-layouts/7207)
* add 'log-observe' to 'plugs'

= AppArmor =
Time: Apr  3 11:23:07
Log: apparmor="DENIED" operation="open" profile="snap.pelion-edge.fluent-bit" name="/var/log/journal/" pid=34182 comm="flb-pipeline" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
File: /var/log/journal/ (read)
Suggestions:
* adjust program to read necessary files from $SNAP, $SNAP_DATA, $SNAP_COMMON, $SNAP_USER_DATA or $SNAP_USER_COMMON
* add 'log-observe' to 'plugs'

and the logs went away, once I changed the format from:

@@ -93,7 +119,11 @@ apps:
       restart-condition: always
       command: launch-fluent-bit.sh
       daemon: simple
-      plugs: [network, network-bind, system-files-logs, log-observe]
+      plugs: 
+        - network
+        - network-bind
+        - system-files-logs
+        - log-observe

Did you also connect the plugs using snap connect ... ?

(Both formats are fine)

Yes, I did. We have connect.sh script that gets installed via another script (I’ve been iterating this thing, so I have a script that does these things automatically).

And they also show up in the output of snap connections (just to make sure) ?

I’ve run a number of test builds and the problem is not re-occuring. I would then conclude it is somehow my mistake and this can be ignored.

1 Like

Ok and some more testing shows me, that there is a time frame between when I install the snap and before the connect.sh gets actually run. It’s quite slow to run it and during that time I get the snappy-debug notes coming. After a reboot the system is clean.