content sharing from $SNAP_COMMON

Tim Kuhlman timothy.kuhlman at canonical.com
Fri Dec 9 22:53:01 UTC 2016


I had an opportunity to experiment some more unfortunately it still isn't working but I can provide more details.

I was pointed to some documentation at https://github.com/snapcore/snapd/wiki/Content-Interface and used that
to update a bit of naming in the config. I have been running on yakety with the version of snapd and other
tools from yakety but in my debugging I updated to the latest snapd from the snappy edge ppa because I
discovered that without that $SNAP* prefixes in the config don't work otherwise.

I'm working with the promreg charm which is the producer, it has this config:
slots:
  content:
    content: promreg
    read: [$SNAP_COMMON/promreg]

The consumer is the prometheus charm which has this config.
plugs:
  content:
    content: promreg
    target: etc/prometheus/promreg

After creating the charms and installing them then linking with the command `snap connect prometheus:content
promreg:content` I ran `sudo snap run --shell prometheus` initially I would get path errors, which I solved
with the upgraded snapd.

The directory '/var/snap/promreg/common/promreg' does exist and has data in it. The destination directory in
the prometheus snap didn't originally exist but I tried creating it after reading
http://askubuntu.com/questions/841004/cannot-get-basic-content-interface-example-working-with-snapcraft

After getting a shell with the command `sudo snap run --shell prometheus` I see that the destination dir is
empty if the destination dir was pre-existing and it doesn't exist at all if dir wasn't pre-existing.

Any details I am missing? other debug steps?

Tim

On 12/05/2016 12:25 AM, Didier Roche wrote:
> Le 02/12/2016 à 19:34, Tim Kuhlman a écrit :
>> I have a snap that writes data to $SNAP_COMMON as it runs and I want to make that data available to another
>> snap. Unfortunately when I setup the content interface and set the plug side to share
>> '/var/snap/snap-name/common/subdir' it fails.
>>
>> I can share data in $SNAP with the content interface but of course the daemon running in that snap can't
>> write there. Am I missing anything? Is there any way to share dynamically created data from one snap with another?
>>
>> Thanks for the help.
> 
> Hey Tim,
> 
> I know that was supposed to be supported, but I don't know the
> implementation status of this.
> 
> Zygmunt, can you shed some lights to us there?
> Cheers,
> Didier
> 
> 




More information about the Snapcraft mailing list