This changes the naming of the aspects feature to be "registry" instead
of bundle (i.e., a configuration space backed with its own storage) and
"view" instead of aspect. Once this lands, anyone that has this enabled
needs to unset the experimental flag and rename the state entry before
refreshing snapd and then re-enable.
Signed-off-by: Miguel Pires <miguel.pires@canonical.com>
* many: add support for user daemons in "snapctl services" by introducing the same --user/--global switches as "snap services"
* o/hookstate/ctlcmd: remove error messages
* cmd/snap,o/hookstate/ctlcmd: correct some doc strings
* daemon,cmd/snap: support for user services in snap services
* NEWS: update news to reflect this functionality
* cmd/snap: add missing unit tests
* many: use interface instead for StatusDecorator to allow for unit testing
* daemon: fix a static check for a range loop where a variable could be omitted
* daemon,cmd/snap: support user-service status of the root user with a --user switch
* t/main/services-user: add a case for root user
* t/main/services-user: fix wrong filename
* cmd/snap: fix TestAppStatus unit test failing
* cmd/snap: extend help for "snap services" to describe the new --global and --user switches
remove errors on redundant switches, remove unneeded argument, move validation of arguments closer to entry of Execute
* cmd/snap: refer directly to fields in the help docs
Add a "features" field containing a map of feature flag names to boolean
subfields for whether the feature is "supported" and/or "enabled", along
with an "unsupported-reason" if the feature is not supported.
Feature flags which are not set to true or false are omitted from this
map. Feature flags may be unsupported but nonetheless enabled. This
indicates that the feature flag has been set to true, but the backing
feature itself is not currently supported.
Signed-off-by: Oliver Calder <oliver.calder@canonical.com>
* client,cmd/snap: introduce --user, --system and --users switches for snap service operations
* client,o/servicestate: move Scope/UserSelection to client for reuse in client
* client,cmd/snap: improve handling of user and scope args
* NEWS: update news to reflect that we now support user daemons in start/stop/restart
* cmd/snap: some review feedback on allowed input
* t/main/services-user: add additional user to verify services are correctly affected
* cmd/snap: do not allow --system --user together, do not allow --users with =all
* tests,cmd: use --users=all in test, dont mark --users optional, enforce a value for it, add case for --system --users=all in spread test
* cmd/snap: add a comment for unreachable code, and correct a couple of messages
* o/assertstate, o/devicestate: add more general function for fetching validation set assertions
* daemon, client: add API routes for creating/removing recovery system
* daemon, o/snapstate: add .snap file extension to snaps from forms
The seed writer will fail to consider files as snaps if their filenames
do not end in .snap.
* tests: test creating a recovery system
* tests: add spread test for offline creation of recovery system
* tests: update offline recovery system test to reboot into new system
* tests/nested/manual/recovery-system-reboot: add variants for factory-reset and install modes
* tests: replace usage of default-recovery-system with default-recovery
* o/devicestate: enable offline creation of recovery system entirely from pre-installed snaps
* daemon, client: test that offline API works without providing snaps or validation sets
* tests/nested/manual/recovery-system-offline: test offline remodel with only pre-installed snaps
* tests/nested/manual/recovery-system-reboot: modify test to create system with new set of essential snaps
* tests: disable shellcheck printf check
* daemon: rename functions for working with form values and add one for working with booleans
* daemon: acquire state lock later in postSystemActionCreateOffline
* daemon: cleanup form files if we fail to make change to create a recovery system
* daemon: rename parseValidationSets to assertionsFromValidationSetStrings for clarity
* client, daemon, tests: add "offline" field to create recovery system JSON api
* daemon: convert TODO about comma-delimited list into explanation of why we use a comma delimited list
* NEWS.md: add mention of create/remove recovery systems API
* tests/nested/manual/recovery-system-offline: explicitly disable network from nested vm
* tests/nested/manual/recovery-system-reboot: do not use new gadget in recovery system for now
* tests/lib/nested.sh: add variable NESTED_FORCE_MS_KEYS to force using microsoft keys
* tests/nested/manual/recovery-system-reboot: add back gadget snap swap to test
* tests/nested/manual/recovery-system-reboot: retry POST to remove since there might be an auto-refresh happening
* o/devicestate: use default recovery system that is independent of seeded systems
* o/devicestate: use default recovery system from state when rebooting without a specified label
This change has the side effect of enabling users to reboot into any
recovery system with "snap reboot --recover", regardless if it is the
default or the most recently seeded system.
* o/devicestate: expose default-recovery-system via DeviceManager.Systems()
* daemon, client: expose default-recovery-system via the systems api
* c/snap: update help text for reboot to match new default-recovery-system behavior
* c/snap: add default-recovery-system to notes section in recovery cli output
* o/devicestate: prevent removal of default recovery system
* o/devicestate, daemon: use default-recovery-system for factory-reset mode as well
* c/snap: update help text to mention that default recovery system is used for factory-reset
* o/devicestate: make a newly seeded system the default-recovery-system
* o/devicestate: add helper to DeviceManager for getting the default-recovery-system
* o/devicestate: use default-recovery-system for install mode as well
* c/snap: correct "snap reboot" help text
* o/devicestate, daemon: store more information for default-recovery-system in state to match seeded systems
* cmd/snap: tweak default recovery system notes
Signed-off-by: Maciej Borzecki <maciej.borzecki@canonical.com>
* o/devicestate: make sure that we're storing correct type when setting default-recovery-system, extend tests
Make sure we're storing the right type when setting default-recovery-system.
Signed-off-by: Maciej Borzecki <maciej.borzecki@canonical.com>
---------
Signed-off-by: Maciej Borzecki <maciej.borzecki@canonical.com>
Co-authored-by: Maciej Borzecki <maciej.borzecki@canonical.com>
This field determines the time after which a pending refresh
is forced for a running snap in the next auto-refresh.
* many: prepare RefreshInhibitProceedTime for configurable max inhibition
* many: remove unneeded newline in RefreshInhibitProceedTime doc comment
* client/packages_test: test client snap with nil RefreshInhibitProceedTime
* client/packages_test: make TestClientSnap tests more readable
* many: precompute refreshInhibitProceedTime in aboutSnap
This avoids locking/unlocking each snap to get RefreshInhibitProceedTime.
We get the proceed time while already holding the lock.
Signed-off-by: Zeyad Gouda <zeyad.gouda@canonical.com>
* daemon: add offline field to remodeling JSON payload
* client, cmd/snap: add offline boolean option for remodeling to client and cli interface
* daemon: make snap files optional in the "multipart/form-data" remodel api
* tests/nested/manual/remodel-offline: add variants to test different combinations of installed/local snaps/assertions
* client: update comment on RemodelWithLocalSnaps to mention not contacting the store
* c/snap: remove unneeded var declaration
* tests/nested/manual/remodel-offline: clarify section that acks/adds the validation set assertion
* tests/nested/manual/remodel-offline: fix shellcheck warning on test's -a flag
* client: verify that normal (online) remodel does not set offline field in JSON payload
* aspects: namespace Get value at API, not aspects/
Make aspects/ return the retrieved value without the namespace keyed by
the request (per the spec). Since the API supports a GET with many
request paths, it can then build the namespace only once with all the
values it retrieved.
Signed-off-by: Miguel Pires <miguel.pires@canonical.com>
* many: add a CLI for aspect get and set
Signed-off-by: Miguel Pires <miguel.pires@canonical.com>
---------
Signed-off-by: Miguel Pires <miguel.pires@canonical.com>
* tests: cover auth.json NFS related fixes in nfs-support test
* client,tests: do not try to change the gid when reading/removing auth.json
the group is not relevant for this even under NFS, otoh
trying to switch it fails under running with sg
this makes sg lxd -c "snap..." work again
* skip nfs-support in ubuntu trusty
group 'systemd-journal' does not exist
---------
Co-authored-by: Sergio Cazzolato <sergio.cazzolato@canonical.com>
Replace ioutil.WriteFile with os.WriteFile since the former has been
deprecated since go1.16 and simply calls the latter.
Signed-off-by: Miguel Pires <miguel.pires@canonical.com>
* many: implement snap install --prefer
Signed-off-by: Zeyad Gouda <zeyad.gouda@canonical.com>
* many: add more tests and validation to --prefer install flag
* client/snap_op: add tests for prefer flag
* daemon/api_snaps: add input validation for prefer flag
* prefer flag cannot be used with unaliased flag
* prefer is supported only for install action
* prefer is not supported int multi-snap operations
* add tests
* o/snapstate: prevent implicilty setting unaliased flag when prefer flag is passed
* add tests
* spread: update parallel-install-auto-aliases to cover edge cases for --prefer
* check --prefer interaction with --unaliased implicit passing
* resolve conflicts after merging master
Signed-off-by: Zeyad Gouda <zeyad.gouda@canonical.com>
* spread: fix comment typo in main/parallel-install-auto-aliases
Signed-off-by: Zeyad Gouda <zeyad.gouda@canonical.com>
* daemon: update flags conflict error message to be consistent
Signed-off-by: Zeyad Gouda <zeyad.gouda@canonical.com>
* many: adjust help texts and move Prefer closer to Unaliased in structs
Signed-off-by: Zeyad Gouda <zeyad.gouda@canonical.com>
* daemon/api_snaps_test: update TestPostSnapPreferWrongAction to match updated error message
Signed-off-by: Zeyad Gouda <zeyad.gouda@canonical.com>
---------
Signed-off-by: Zeyad Gouda <zeyad.gouda@canonical.com>
* client: fix specificErr handling in SnapshotExport()
The code was checking generating a `specificErr` but then checked
`if err != nil {` (and not check for specificErr) and also lacked
a unit test.
When adding the code test it became clear that the other issue
there is that the response body was never read so r.err() would
always return nil.
This commit fixes both issues.
* client: fix TestClientExportSnapshotSpecificErr naming
Co-authored-by: Miguel Pires <miguelpires94@gmail.com>
---------
Co-authored-by: Miguel Pires <miguelpires94@gmail.com>
This adds options --snap and --assertion to the "snap remodel"
command, which can be used to pass local files to snapd so offline
remodelling is possible.