From b8aaba4482568ea7411ccf83751611db36334c22 Mon Sep 17 00:00:00 2001 From: John Lettman Date: Sun, 25 Aug 2024 02:08:43 -0400 Subject: [PATCH] Snap: use strict confinement (fix #48) (#50) * snapcraft.yaml: use strict confinement * __main__.py: isort --- snapcraft.yaml | 21 ++++++++++++++++++++- src/jockey/__main__.py | 5 +++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/snapcraft.yaml b/snapcraft.yaml index 99a77a5..27a2d00 100644 --- a/snapcraft.yaml +++ b/snapcraft.yaml @@ -7,15 +7,34 @@ description: | It uses automatic caching of Juju's status in json format to enable faster parsing. license: MIT grade: stable -confinement: classic +confinement: strict architectures: [amd64, i386, arm64, armhf, ppc64el] +plugs: + juju-bin: + interface: content + content: juju-bin + target: $SNAP/usr/juju + default-provider: juju + dot-local-share-juju: + interface: personal-files + read: + - $HOME/.local/share/juju + - $HOME/.local/share/juju/ssh + - $HOME/.local/share/juju/lxd + write: + - $HOME/.local/share/juju/cookies + apps: juju-jockey: command: bin/juju-jockey plugs: + - juju-bin + - dot-local-share-juju - home + - ssh-keys + - network parts: juju-jockey: diff --git a/src/jockey/__main__.py b/src/jockey/__main__.py index 042bb1f..e9ad7a7 100755 --- a/src/jockey/__main__.py +++ b/src/jockey/__main__.py @@ -1,6 +1,7 @@ #!/usr/bin/env python3 """Jockey: a Juju query language to put all of your Juju objects at your fingertips.""" from argparse import ArgumentParser, FileType, Namespace +import os import sys from typing import Optional, Sequence @@ -17,6 +18,10 @@ from jockey.status_keeper import cache_juju_status, read_local_juju_status_file, retrieve_juju_cache +if "SNAP" in os.environ: + os.environ["PATH"] += ":" + os.path.join(os.environ["SNAP"], "usr", "juju", "bin") + + INFO_MESSAGE = f""" +----+ |NOTE|