Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add functionality to report repo style and distro
This is a fairly large commit that adds functionality for Tern to report what repo style and distro the container image is based off of. The following changes were made to the files listed below: 1) tern/command_lib/base.yml Add an 'os_guess' section for each package manager entry. os_guess is a list of possible OSes for the given pkg manager. 2) tern/classes/image_layer.py Add an 'os_guess' attribute to the ImageLayer class. This also includes adding a @Property python decorator for it and a setter method to access the os_guess value. 3) tests/test_class_image_layer.py Add a check to verify the functionality of the getter and setter methods for os_guess in the ImageLayer class. 4) tern/command_lib/command_lib.py Add a check_os_guess function that will return the list of os_guess values associated with a given binary (provided that the binary exists in base.yml). If the binary provided does not exist in base.yml, return a blank string. 5) tern/helpers/common.py - Adds a function called get_os_release that checks the /etc/os-release file of the mounted image layer for OS information. If no information can be found it returns a blank string. - Updates the get_os_style function to call get_os_release and check for OS information in the os-release file. If OS info is returned, pass this info on to the user with a high degree of certainty. If no OS info is returned from get_os_release, make an educated guess as to the OS of the image layer based on the package format and package manager in base.yml. 6) tern/report/formats.py Add two os_style-related reports to format the OS suggestion in the final report based on where the OS information was gathered from. 7) tern/utils/constants Add the two paths where the os-release file could be. Resolves tern-tools#161 See also tern-tools#338 Signed-off-by: Rose Judge <[email protected]>
- Loading branch information