411ac6c...
by
Andrew Phelps <email address hidden>
o/snapstate: install components from the store (#14092)
* o/snapstate: replace some args to doInstallComponent with a flags type
* o/snapstate: create validate-component task when installing component from the store
* o/snapstate: add arg to doInstall for components
* o/snapstate: install components from store in StoreTarget
* o/snapstate: add component fields to fakeSnappyBackend ops
* o/snapstate: add helpers for checking tasks for installing components
* o/snapstate: add testing channel that adds a component to snap that is being installed
* o/snapstate: use instance name in path to that is set for remove ops in test backend
* o/snapstate: extend doInstall to handle components
* o/snapstate: refactor addTask in doInstall to update prev pointer to eliminate manual tracking of last task
* o/snapstate: test tasks created when installing component from the store
* o/snapstate: remove component files when snap file is also ephemeral
* o/snapstate: change component types in error strings to be more clear
* o/snapstate: always install components for each snap in a consistent order
* o/snapstate: replace pointer params to doInstall with copies
* o/snapstate: unexport componentTarget
* o/snapstate: add TODOs about handling components
* o/snapstate: add comment explaining why we do not create setup-profiles task for new components when installed with snap
* o/snapstate: remove usage of new go stdlib function
* o/snapstate: fully initialize ComponentSetup in store's InstallGoal implementation
* o/snapstate: rename componentInstallFlags.SkipSecurity to SkipProfiles
* o/snapstate: move componentTarget struct
* o/snapstate: eliminate componentTarget type
* store, o/snapstate: swap out resources slice in SnapAction for flag in RefreshOptions
* o/snapstate: remove this change for now, it should not be a part of this PR
* o/snapstate: add TODO about ordering component and snap hook tasks
* o/snapstate: rename variable for readability
90c2e4c...
by
Andrew Phelps <email address hidden>
many: modify snap run to understand component hooks (#13976)
* snap, s/snaptest: add function for reading the ComponentInfo of the current revision of a component for a snap revision
* s/snapenv, c/snap: add support for component hooks to ExtendEnvForRun
* c/snap: update run to be able to run component hooks
* c/snap: refactor runSnapConfine to operate on a runnable that can represent snap hooks, component hooks, and apps
This commit doesn't need to be here, and things will work without it.
But things were getting a bit complicated in runSnapConfine with
arguments that represented different things based on what we were
running.
* c/snap-exec: handle running component hooks in snap-exec
* c/snap-exec: move parsing of snap-exec target into execHook and execApp
* snap: make error message when failing to parse current component revision a bit better
* c/snap: add IsHook method to runnable type for easier checking
* s/snaptest: use os.Symlink rather than atomic variant in test code
* snap, s/snapdir, c/snap: fix import cycle issue with hook from snapdir into snap
* c/snap, c/snap-exec: docs and panicking default for NewContainerFromDir
* c/snap, c/snap-exec: set up hook for snap.NewContainerFromDir
* c/snap: remove TODO about getting component revision
* c/snap, c/snap-exec: use _ imports rather than initializing hook manually
* s/naming: add ParseComponentRef function
* snap, o/s/backend, daemon: replace ComponentLinkPath and ComponentInstallDate param with naming.ComponentRef
* snap: use ComponentLinkPath helper in ComponentLinkPath
* s/snapdir: add doc comment for NewContainerForDir
* Revert "snap: use ComponentLinkPath helper in ComponentLinkPath"
This reverts commit 9a56c379779490f798613db31aa66b2b177ddd3d.
* Revert "snap, o/s/backend, daemon: replace ComponentLinkPath and ComponentInstallDate param with naming.ComponentRef"
This reverts commit ca39dc1e60174d769ef2345f1e4b58d63f0f7528.
tests/core/netplan: override ld.so cache to avoid the host's cache files
The test breaks on UC24 in a peculiar way. The `netplan` CLI tool is a Python
script which attempts to load libnetplan.so.* through ctypes. However, in a
snap, the contents of /etc come from the host, so in case on UC24 environment,
the netplan client invoked from eg. core20 would observe actual ld.so.cache from
UC24. Thus Python's ctype library, would call `ldconfig-p`, which then consumes
the ld.so.cache from UC24, thus listing incorrect version of the libnetplan
library (specifically UC24 has libnetplan.so.1, while earlier versions had
libnetplan.so.0.0).
Attempt to fix this by providing a custom wrapper for ldconfig, which generates
a cache on the side under $SNAP_DATA, thus using the libraries which are
actually visible to the snap.
Signed-off-by: Maciej Borzecki <email address hidden>
Python will try to guess the IO encoding based on the terminal, but apparently
not all terminals support UTF-8, thus causing errors like this:
$ PYTHONIOENCODING="ascii" api-client --socket /run/snapd-snap.socket /v2/snaps
Traceback (most recent call last):
File "/snap/api-client/x1/bin/api-client.py", line 40, in <module>
sys.exit(main(sys.argv))
File "/snap/api-client/x1/bin/api-client.py", line 36, in main
print(body.decode('UTF-8'))
UnicodeEncodeError: 'ascii' codec can't encode character '\xa0' in position 3183: ordinal not in range(128)
Signed-off-by: Maciej Borzecki <email address hidden>