interfaces,docs: allow sharing SNAP{,_DATA,_COMMON} via content iface #2063

Merged
merged 1 commit into from Oct 3, 2016

Conversation

Projects
None yet
2 participants
Contributor

zyga commented Oct 3, 2016

This patch expands the features of the content interface to allow
sharing files from either $SNAP (the snap content), $SNAP_DATA (the
per-revision snap data) or $SNAP_COMMON (the data common across
revisions).

The old syntax, without any of those variables behaves as if $SNAP was
implicitly used so backwards compatiblity is retained.

Signed-off-by: Zygmunt Krynicki zygmunt.krynicki@canonical.com

interfaces,docs: allow sharing SNAP{,_DATA,_COMMON} via content iface
This patch expands the features of the content interface to allow
sharing files from either $SNAP (the snap content), $SNAP_DATA (the
per-revision snap data) or $SNAP_COMMON (the data common across
revisions).

The old syntax, without any of those variables behaves as if $SNAP was
implicitly used so backwards compatiblity is retained.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>

Would be good to have the following changes in place. I'm merging this so we don't have to worry today, but adding a card to the RC pointing into this review.

@@ -251,6 +251,11 @@ filesystem area.
* write (slot): read-write paths from providing snap to expose to the consuming snap
* target (plug): path in consuming snap to find providing snap's files
+The all of the three attributes can start with either ``$SNAP``, ``$SNAP_DATA``
+or ``$SNAP_COMMON`` to refer to the designated directory. By default, if no
+other variable is used then ``$SNAP`` is implicitly assumed. This is the same
@niemeyer

niemeyer Oct 3, 2016

Contributor

As we discussed, let's please encourage the $SNAP* variables to be always provided in the documentation. The old behavior is internally kept for compatibility only, but not documented so we can eventually kill it.

+}
+
+// Check that legacy syntax works and allows sharing read-only snap content
+func (s *ContentSuite) TestConnectedPlugSnippetSharingLegacy(c *C) {
@niemeyer

niemeyer Oct 3, 2016

Contributor

Both these tests and the test above have duplication which can be easily avoided by using a list of structs defining what's to be tested, instead of copying almost identical logic across lines and tests.

@niemeyer niemeyer merged commit cbd52a4 into snapcore:master Oct 3, 2016

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@zyga zyga deleted the zyga:better-content-iface branch Aug 22, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment