* i/b/custom_device: add new custom-device interface
* tests: spread tests for the custom-device interface
* tests: remove unused variable
* tests: add custom-device plug to interfaces-many-core-provided
* i/b/custom-device: fix base declaration
* i/b/custom-devices: error reporting, pattern handling
* i/b/custom_device: add unit test for ** check
* i/b/custom_device: add support for read-devices attribute
* i/b/custom_device: revert change on ** in paths
It's safer to be restrictive and keep the globbing to "*".
* i/b/custom_device: update comment on AppArmor globbing
* i/b/custom_device: minor formatting change
* i/b/custom_device: improve logic of slot attribute naming
* i/b/custom_device_test: add tests
* i/b/custom_device: update interface declaration
* interfaces/custom-device: mv read/write under a files key
As suggested by Samuele. Also update all the tests.
Signed-off-by: Ian Johnson <ian.johnson@canonical.com>
* i/b/custom_device: remove leftover comments
* i/b/custom_device: remove unneeded function parameter
* i/b/custom-devices: improve validation, error handling and tests
* i/b/custom_device: test more invalid characters
Co-authored-by: Michael Vogt <mvo@ubuntu.com>
Co-authored-by: Ian Johnson <ian.johnson@canonical.com>
Currently, when tests/nested/manual/devmode-snaps-can-run-other-snaps runs, it
can sometimes fail because the core.snap in the specified directory still
exists and is incompatible with being able to build the project directory as a
snapcraft snap, so removing it here should prevent this cross-device link from
failing the build:
```
Pulling snapd-deb
+ snapcraftctl pull
[Errno 13] Permission denied: '/root/project/tests/nested/core/core-snap-refresh-on-core/core.snap'
Traceback (most recent call last):
File "/snap/snapcraft/6512/lib/python3.6/site-packages/snapcraft/file_utils.py", line 105, in link_or_copy
link(source, destination, follow_symlinks=follow_symlinks)
File "/snap/snapcraft/6512/lib/python3.6/site-packages/snapcraft/file_utils.py", line 139, in link
os.link(source_path, destination, follow_symlinks=False)
OSError: [Errno 18] Invalid cross-device link: '/root/project/tests/nested/core/core-snap-refresh-on-core/core.snap' -> '/root/parts/snapd-deb/src/tests/nested/core/core-snap-refresh-on-core/core.snap'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/snap/snapcraft/6512/bin/snapcraft", line 33, in <module>
sys.exit(load_entry_point('snapcraft==4.8', 'console_scripts', 'snapcraft')())
File "/snap/snapcraft/6512/lib/python3.6/site-packages/click/core.py", line 829, in __call__
return self.main(*args, **kwargs)
File "/snap/snapcraft/6512/lib/python3.6/site-packages/click/core.py", line 782, in main
rv = self.invoke(ctx)
File "/snap/snapcraft/6512/lib/python3.6/site-packages/click/core.py", line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/snap/snapcraft/6512/lib/python3.6/site-packages/snapcraft/cli/_command.py", line 81, in invoke
return super().invoke(ctx)
File "/snap/snapcraft/6512/lib/python3.6/site-packages/click/core.py", line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/snap/snapcraft/6512/lib/python3.6/site-packages/click/core.py", line 610, in invoke
return callback(*args, **kwargs)
File "/snap/snapcraft/6512/lib/python3.6/site-packages/snapcraft/cli/lifecycle.py", line 388, in snap
_execute(steps.PRIME, parts=tuple(), pack_project=True, output=output, **kwargs)
File "/snap/snapcraft/6512/lib/python3.6/site-packages/snapcraft/cli/lifecycle.py", line 103, in _execute
lifecycle.execute(step, project_config, parts)
File "/snap/snapcraft/6512/lib/python3.6/site-packages/snapcraft/internal/lifecycle/_runner.py", line 137, in execute
executor.run(step, part_names)
File "/snap/snapcraft/6512/lib/python3.6/site-packages/snapcraft/internal/lifecycle/_runner.py", line 191, in run
self._handle_step(part_names, part, step, current_step, cli_config)
File "/snap/snapcraft/6512/lib/python3.6/site-packages/snapcraft/internal/lifecycle/_runner.py", line 205, in _handle_step
getattr(self, "_run_{}".format(current_step.name))(part)
File "/snap/snapcraft/6512/lib/python3.6/site-packages/snapcraft/internal/lifecycle/_runner.py", line 247, in _run_pull
self._run_step(step=steps.PULL, part=part, progress="Pulling")
File "/snap/snapcraft/6512/lib/python3.6/site-packages/snapcraft/internal/lifecycle/_runner.py", line 325, in _run_step
getattr(part, step.name)()
File "/snap/snapcraft/6512/lib/python3.6/site-packages/snapcraft/internal/pluginhandler/__init__.py", line 487, in pull
self._do_runner_step(steps.PULL)
File "/snap/snapcraft/6512/lib/python3.6/site-packages/snapcraft/internal/pluginhandler/__init__.py", line 280, in _do_runner_step
return getattr(self._runner, "{}".format(step.name))()
File "/snap/snapcraft/6512/lib/python3.6/site-packages/snapcraft/internal/pluginhandler/_runner.py", line 85, in pull
steps.PULL,
File "/snap/snapcraft/6512/lib/python3.6/site-packages/snapcraft/internal/pluginhandler/_runner.py", line 189, in _run_scriptlet
raise error
File "/snap/snapcraft/6512/lib/python3.6/site-packages/snapcraft/internal/pluginhandler/_runner.py", line 179, in _run_scriptlet
scriptlet_name, function_call.strip()
File "/snap/snapcraft/6512/lib/python3.6/site-packages/snapcraft/internal/pluginhandler/_runner.py", line 233, in _handle_builtin_function
function(**function_args)
File "/snap/snapcraft/6512/lib/python3.6/site-packages/snapcraft/internal/pluginhandler/__init__.py", line 507, in _do_pull
self.source_handler.pull()
File "/snap/snapcraft/6512/lib/python3.6/site-packages/snapcraft/internal/sources/_local.py", line 41, in pull
copy_function=self.copy_function,
File "/snap/snapcraft/6512/lib/python3.6/site-packages/snapcraft/file_utils.py", line 248, in link_or_copy_tree
copy_function(source, destination)
File "/snap/snapcraft/6512/lib/python3.6/site-packages/snapcraft/file_utils.py", line 113, in link_or_copy
copy(source, destination, follow_symlinks=follow_symlinks)
File "/snap/snapcraft/6512/lib/python3.6/site-packages/snapcraft/file_utils.py", line 162, in copy
shutil.copy2(source, destination, follow_symlinks=follow_symlinks)
File "/snap/snapcraft/6512/usr/lib/python3.6/shutil.py", line 263, in copy2
copyfile(src, dst, follow_symlinks=follow_symlinks)
File "/snap/snapcraft/6512/usr/lib/python3.6/shutil.py", line 120, in copyfile
with open(src, 'rb') as fsrc:
PermissionError: [Errno 13] Permission denied: '/root/project/tests/nested/core/core-snap-refresh-on-core/core.snap'
Run the same command again with --debug to shell into the environment if you wish to introspect this failure.
-----
```
Signed-off-by: Ian Johnson <ian.johnson@canonical.com>
This reduces the delta between what we are refreshing to and may reduce some
flakiness in the test (if there is any).
Signed-off-by: Ian Johnson <ian.johnson@canonical.com>
* tests/nested/manual/core20-cloud-init-maas-signed-seed-data: add gadget variant
Add variants for the gadget snap having cloud.conf that allows MAAS and a
cloud.conf which disallows any datasource in it.
Also add an unrelated datasource file to ubuntu-seed always that gets ignored
since it is for a currently unsupported datasource (GCE).
Add a spread test for the various test cases of executing other snaps from a
devmode snap for UC16 and UC18 with the various permutations.
Signed-off-by: Ian Johnson <ian.johnson@canonical.com>
tests/nested/manual/devmode-snaps-can-run-other-snaps:
- use pipe to run umask command
- add missing snap install in bionic part
- add missing install for BASE_CORE_STRICT_SNAP
- simplify profile (re)generation
Signed-off-by: Michael Vogt <michael.vogt@canonical.com>