Can't connect to content slot, since "content" directive somehow gets dropped from snapcraft.yaml

Pretty simple but puzzling problem. I have the following in my snapcraft.yaml:

    interface: content
    content: socket-directory
      - $SNAP_DATA/sockets

I’m trying to connect a corresponding plug to that slot; but getting the following error:

error: cannot perform the following tasks:
- Connect ammp-edge:control to ammp-wifi-ap:control (connection not allowed by slot rule of interface "content")

Sure enough, in $SNAP/meta/snap.yaml I actually have the following:

    interface: content
    - $SNAP_DATA/sockets

With the content: socket-directory line missing. Any ideas what’s causing that? Build log is here if that’s of interest - couldn’t find anything relevant in there.

Things I’ve tried:

  • Reshuffling my snapcraft.yaml file
  • Changing the content directive name to something else

Still no luck. I’ve definitely previously used this same syntax to create snaps with content slots, which are then built on - and everything worked fine. No idea what’s causing this to now fail in such an odd way.

This is probably a bug, we will look into this

Confirmed bug, sorry @svet for the troubles.

I put a PR up to fix this:

1 Like

Thank you @cjp256 for the quick turnaround on fixing this!

I have kind of a tangential question, since I’m under a bit of time pressure to deploy this snap to devices we’ll be putting out in the field in the coming days. So I need to work out the best option for building this for armhf. Would you say I should:

  1. Wait for the fix to make it into a new snapcraft release, and for that to be deployed to the launchpad build farm (probably not in the next days?)
  2. Use snapcraft remote-build to build with an older snapcraft version on launchpad (not sure it’s possible to specify the snapcraft version used?)
  3. Just build it myself, by using snapcraft from the master branch, on an armhf device

Thanks in advance for any advice!

@svet it should get merged soon, but give edge/pr-2934 channel a try:

sudo snap refresh snapcraft --channel=edge/pr-2934

Alternatively, stable/3.8 may work too.

@svet: @sergiusens just merged this to master, so it should populate into the edge channel in the next couple hours. That’ll make it work with snapcraft remote-build (as it uses the edge channel by default).

1 Like

Great thank you @cjp256!

Out of curiosity - would triggering the build via be the same as running snapcraft remote-build? I know both approaches build on launchpad, but not sure if there’s a difference (e.g. in terms of snapcraft version used).

I believe that will use the stable channel.

Snapcraft’s remote-build is currently set to use edge channel, though if you picked up snapcraft from edge/pr-2933 you’ll get have a --launchpad-snapcraft-channel option to make it configurable.

1 Like

Thanks @cjp256! I had a go at what you suggested - wanted to make two observations. These are more related to the snapcraft remote-build experience than my original question, but figured I’d just drop them in here also.

  1. I noticed in the recent comments on that the default (remote) channel is now “stable” rather than “edge”, so using the edge/pr-2399 version (locally) in order to explicitly set the remote channel to “edge” was indeed necessary - thanks for the tip :+1:
  1. For some reason the contents of my local source directory (from where I run snapcraft remote-build) do not actually get uploaded to the builder - only my snapcraft.yaml. This was leading to a patch file (from missing from $SNAPCRAFT_PROJECT_DIR on the builder (which is basically The most immediate workaround I thought of was to add wget to build-packages and specifically download that file as part of override-pull so it’s available. But I’m guessing this is otherwise a bug?

Thanks again for the help.