Conversation
|
Do we want to put an example of how to use the |
tern/analyze/default/debug/run.py
Outdated
| # cleanup | ||
| rootfs.clean_up() | ||
| else: | ||
| print("Something when wrong in loading the image") |
There was a problem hiding this comment.
Small nit: something went wrong.
Sure, I can include that with the final commit. Should it go in CONTRIBUTING.md since it's a tern development specific feature? |
do we want to find a way to separate the debug output from the terminal activity output? This might be out of scope for this PR, and if so I can open another issue for it.
However,
|
@rnjudge any feedback on this? |
@nishakm I think it might be better as a subsection in adding-to-the-command-library.md? The other debug functionality is there and the step functionality is helpful if someone is trying to add to the command library but not getting the output they expect from the |
I will put some documentation in there for now. |
I've made it look like this:
I've changed the messages this way: |
This is work towards tern-tools#660 "Debug" is a loose term with regards to this kind of operation. We're basically "stepping-though" the layers of the container image or running scripts in an already mounted environment. This subcommand covers operations that will be useful for developers of Tern to troubleshoot any issues with the default operation. The entrypoint is in tern/analyze/default/debug/run.py. This is does not use a logger and is meant to be used in a development environment where stdout is available to look at. We move verify_invoke.py into a folder called "debug" under the default operation where "debug" will contain all the operations related to stepping through a container image. We then edit run.py to use the existing module paths. Finally, we add the subcommand "debug" to __main__.py and check if the user has selected it in do_main. Signed-off-by: Nisha K <nishak@vmware.com>
This is work towards tern-tools#660 This commit moves the container_debug.py script into the debug subcommand. We add a '--step' option to go into interactive mode where we ask what layer the user wants to inspect. When the user chooses the layer, Tern will mount upto the layer selected and provides a command to chroot into the layer to look around. We also roll in the '--recover' option to unmount the layers after the user is done inspecting. We can now remove the container_debug.py script Signed-off-by: Nisha K <nishak@vmware.com>
This completes work towards tern-tools#660 - Updated the instructions to verify scripts in base.yml using 'tern debug'. - Removed instructions to verify scripts in snippets.yml as all of them just point to scripts in base.yml - Added instructions to use 'tern debug --step' to inspect a container image at a given layer Signed-off-by: Nisha K <nishak@vmware.com>
da8bd15 to
f09fa05
Compare
rnjudge
left a comment
There was a problem hiding this comment.
The errors I was seeing are gone. This looks good! Merging now.
Fixes #660
The "debug" option includes the ability to test out
script in base.yml and to inspect the filesystem at a given
layer index.
To inspect a layer's manifested filesystem run:
tern debug -i <image:tag> --stepThis will set up an interactive session where the user will be
asked for a layer to inspect. Once chosen, Tern will mount the
layers and provide instructions to inspect the filesystem or or
chroot into it.
To recover the filesystem or clean up run:
tern debug --recoverTo run a script from base.yml run:
tern debug -i <image:tag> --keys base <package_manager> <names/version/etc>keys are the keys in base.yml that point to a specific script to
verify.