6 Commits

Author SHA1 Message Date
Pawel Stolowski
e208824cee Implementation of snap disconnect --forget logic. The --forget flags sets the "forget" flag on the disconnect task, and modifies disconnect handler to either run the normal disconnect logic + forget the connection from conns, or
just forget it if already disconnected. In the latter case disconnect hooks are not created/run.
2020-01-15 12:23:34 +01:00
Maciej Borzecki
0955c4b430 cmd/snap, client, daemon, ifacestate: show a leading attribute of a connection (#6576)
* dameon: include connection plug/slot attributes in /v2/connections endpoint

* overlord/ifacestate: extend connections state API to include plug/slot attributes

* client: add definitions for connection plug/slot attributes

* cmd/snap: show leading attribute when displaying connections

Some interfaces, such as 'content', have an attribute that is used internally to
match the plug and slot. Display the value of the leading attribute of an
established connection in 'snap connections' output.

* tests/main/snap-connections: account for content interface attributes
2019-03-11 10:21:32 +01:00
Maciej Borzecki
cde2e03742 daemon: tweaks for /v2/connections, extend tests
Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
2019-01-28 13:49:01 +01:00
Maciej Borzecki
3d2ebc9c10 daemon: introduce helper strucs for marshalling connections endpoint data
Introduce helper structures for marshalling data returned by /v2/connections API
endpoint.

Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
2019-01-16 12:47:58 +01:00
Zygmunt Krynicki
e498019746 daemon: unify duplicated interface info JSON types
There were two very similar types that deal with JSON encoding of an
interface info. They were used by the legacy and non-legacy response for
/v2/interfaces. One of the types is a subset of the other so we can just
merge them.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
2018-07-11 11:04:32 +02:00
Zygmunt Krynicki
964d06a0e7 interfaces,daemon: move JSON types to the daemon
This patch moves JSON marshaling code from the interface repository to
the daemon API layer. This is the first step towards cleaning up the
return types so that upcoming interface re-mapping patches can stop
changing deeply connected snap.{Plug,Slot}Info types.

Because JSON marshaling requires instance methods we can no longer use
interfaces.Info.MarshalJSON. Instead the code is inlined in the only
place using that type, namely the getInterfaces function in the daemon.
The duplicated tests are removed since this is already tested with
existing API tests.

While doing this I noticed some duplication and some (perhaps) confusing
names, those will be handled in upcoming patches. I added a TODO for
this.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
2018-07-11 10:43:55 +02:00