← Back to issue list

Experimental offline mode fails with network present

View original Launchpad issue

Metadata

Project
snapcraft
Number
#1950479
Type
issue
State
open
Author
~igorljubuncic-deactivatedaccount
Labels
cache caching experimental network offline snapcraft
Created
2021-11-10 15:00:54.407532+00:00
Updated
2021-11-10 15:00:54.407532+00:00
Closed

Current evaluation

No evaluation has been recorded for this issue yet.

Issue body

The experimental offline mode in snapcraft does not work as intended, and does not have a graceful failover. How to reproduce: Ubuntu 18.04 system (and also in some cases 20.04) Run snapcraft --offline (with lxd or multipass) on any snapcraft.yaml The run will fail with: Sorry, an error occurred in Snapcraft: 'NoneType' object is not subscriptable We would appreciate it if you anonymously reported this issue. Complete trace: Traceback (most recent call last): File "/snap/snapcraft/6954/bin/snapcraft", line 8, in <module> sys.exit(run()) File "/snap/snapcraft/6954/lib/python3.8/site-packages/click/core.py", line 1137, in __call__ return self.main(*args, **kwargs) File "/snap/snapcraft/6954/lib/python3.8/site-packages/click/core.py", line 1062, in main rv = self.invoke(ctx) File "/snap/snapcraft/6954/lib/python3.8/site-packages/click/core.py", line 1646, in invoke super().invoke(ctx) File "/snap/snapcraft/6954/lib/python3.8/site-packages/click/core.py", line 1404, in invoke return ctx.invoke(self.callback, **ctx.params) File "/snap/snapcraft/6954/lib/python3.8/site-packages/click/core.py", line 763, in invoke return __callback(*args, **kwargs) File "/snap/snapcraft/6954/lib/python3.8/site-packages/click/decorators.py", line 26, in new_func return f(get_current_context(), *args, **kwargs) File "/snap/snapcraft/6954/lib/python3.8/site-packages/snapcraft/cli/_runner.py", line 130, in run snap_command.invoke(ctx) File "/snap/snapcraft/6954/lib/python3.8/site-packages/click/core.py", line 1404, in invoke return ctx.invoke(self.callback, **ctx.params) File "/snap/snapcraft/6954/lib/python3.8/site-packages/click/core.py", line 763, in invoke return __callback(*args, **kwargs) File "/snap/snapcraft/6954/lib/python3.8/site-packages/snapcraft/cli/lifecycle.py", line 387, in snap _execute(steps.PRIME, parts=tuple(), pack_project=True, output=output, **kwargs) File "/snap/snapcraft/6954/lib/python3.8/site-packages/snapcraft/cli/lifecycle.py", line 125, in _execute with build_provider_class( File "/snap/snapcraft/6954/lib/python3.8/site-packages/snapcraft/internal/build_providers/_base_provider.py", line 87, in __enter__ self.create() File "/snap/snapcraft/6954/lib/python3.8/site-packages/snapcraft/internal/build_providers/_lxd/_lxd.py", line 284, in create self.launch_instance() File "/snap/snapcraft/6954/lib/python3.8/site-packages/snapcraft/internal/build_providers/_base_provider.py", line 263, in launch_instance self._setup_snapcraft() File "/snap/snapcraft/6954/lib/python3.8/site-packages/snapcraft/internal/build_providers/_lxd/_lxd.py", line 481, in _setup_snapcraft super()._setup_snapcraft() File "/snap/snapcraft/6954/lib/python3.8/site-packages/snapcraft/internal/build_providers/_base_provider.py", line 508, in _setup_snapcraft snap_injector.apply() File "/snap/snapcraft/6954/lib/python3.8/site-packages/snapcraft/internal/build_providers/_snap.py", line 392, in apply snap.push_host_snap(file_pusher=self._file_pusher) File "/snap/snapcraft/6954/lib/python3.8/site-packages/snapcraft/internal/build_providers/_snap.py", line 141, in push_host_snap host_snap_repo.local_download( File "/snap/snapcraft/6954/lib/python3.8/site-packages/snapcraft/internal/repo/snaps.py", line 181, in local_download if self.has_assertions(): File "/snap/snapcraft/6954/lib/python3.8/site-packages/snapcraft/internal/repo/snaps.py", line 152, in has_assertions return not self.get_local_snap_info()["revision"].startswith("x") TypeError: 'NoneType' object is not subscriptable Expected behavior: 1. If snapcraft --offline is run and there is network and NO cached assets exist, it should inform the user that it needs to pull the assets from the network the first time. 2. If snapcraft -offline is run and there is network and cached assets, it should run as though there is no network; and there should be no errors. 3. If snapcraft --offline is run and there is no network and no cached assets, it should inform the user that it cannot complete the task as there are no available assets that can be retrieved. 4. If snapcraft --offline is run and there is no network and but there are cached assets, it should complete normally. Also, if snapcraft is run without offline mode (not specified) and there is no network, it should check for network status first before trying to launch the container, as the container startup will time out (unspecified) but this behavior cannot be distinguished from: a) slow network b) slow vm/container behavior where it can take a long time (minutes) for the vm/container to start.

Evaluation history

No evaluation history available.