Closed lledargo closed 1 year ago
My initial thoughts for implementing something like this is to expand the functionality of hooks to additionally have a function that gets called when other features' functions are being called. E.g. a hook function possibly named on_feature_pre_install
which gets called for each feature when its pre_install
function gets called. Then you or I could make a hook that echos out the feature name or does other activity. That would be safe to have even in a non-DRY_RUN
situation so you could confirm the features considered by Platform if you hold onto the logs.
Additionally, the final features actually applied should be printed in some way when DEBUG
is turned on, but it doesn't currently do so. You get a Setting up features: ...
line, but it doesn't log the co-features.
I'm looking for alternatives too, so I'll think on it for a while. Is there any other way you might think to implement something like this?
I fixed up the debug logging output in commit c5520ce8046b6c0151e03f834b954ef88fb178e6. It should now print out all the features being set up if you have DEBUG=1
. Try it by using the code from the main
branch.
Sample invocation of USERS="" DEBUG=1 DRY_RUN=1 ./platform vorble/loadout/base
:
DEBUG=1
DRY_RUN=1
ENABLE_HOOK_WATERMARK=0
FEATURE_FILE=/tmp/platform.features.gXdyZd
PLZHELP=0
WATERMARK_DIR=/usr/local/etc/platform
CPU_VENDOR=intel
DISTRO=Debian
DISTRO_VERSION=10
IS_METAL=1
KERNEL=Linux
PACKAGE_MANAGER=apt
USERS=
HAS_AMD_GRAPHICS=0
HAS_NVIDIA_GRAPHICS=0
VORBLE_VERSION=0.2.0-dev
Setting up features: feature/curl feature/exiftool feature/gdb feature/htop feature/iotop feature/links feature/ltrace feature/rsync feature/screen feature/silversearcher feature/smartmontools feature/strace feature/sudo feature/tmux feature/valgrind feature/vim vorble/feature/drivers vorble/feature/firmware vorble/feature/sudo vorble/feature/vim vorble/loadout/base
apt-get update
apt-get install --yes curl gdb htop iotop libimage-exiftool-perl links ltrace rsync screen silversearcher-ag smartmontools strace sudo tmux valgrind vim
The features are all printed on one line because features are installed all at the same time and a line-by-line list would be misleading, giving the user an impression that one thing has been set up and then another. Pre- and post-requisites will get their own debug line since such features are fully set up before/after others.
Dose this change help you?
The existing dry run is really great, but sometimes I just want to make sure all of the features I expect will be called. It would be nice to have another dry run that lists loadouts and features the script will run.
So if I have a
base
loadout with prerequisitesfeature1
andfeature2
, and it also has featurefeature3
that it calls inlist-features
. Lets even sayfeature3
has a prerequisite offeature4
.Then running this dry run would list the loadout and all of the features somewhat like this:
Hope I am explaining this well, let me know if you need clarification. I might look into making this change if you don't get to it.