openmainframeproject / software-discovery-tool

Software Discovery Tool
Apache License 2.0
32 stars 41 forks source link

Auto config added for CI/CD #62

Closed rachejazz closed 3 years ago

rachejazz commented 3 years ago

fixes #47

Signed-off-by: rachejazz divyadeepti2000@gmail.com

This step was taken originally to save the hassle of mapping json file manually, when wished to take data from PDS. Rest of the data provided by OMP will be added by us. Users, stay at peace :) Following steps on how to use the new script:

1. Using package_build.py to extract data from PDS:

For example, RHEL_8_1_Package_List.json, Suse_Linux_Enterprise_Server_12_SP5_Package_List.json, SUSE_Package_Hub_SLES_12_SP5.json and Ubuntu_16_04_Package_List.json will be taken for demo.

divya@discoveryubuntu:/opt/software-discovery-tool$ sudo -u apache ./bin/package_build.py Ubuntu_16_04_Package_List.json
Extracting Ubuntu_16_04_Package_List.json from PDS data ... 
Saved!
filename: Ubuntu_16_04_Package_List.json
Thanks for using SDT!
divya@discoveryubuntu:/opt/software-discovery-tool$ sudo -u apache ./bin/package_build.py Suse_Linux_Enterprise_Server_12_SP5_Package_List.json
Extracting Suse_Linux_Enterprise_Server_12_SP5_Package_List.json from PDS data ... 
Saved!
filename: Suse_Linux_Enterprise_Server_12_SP5_Package_List.json
Thanks for using SDT!
divya@discoveryubuntu:/opt/software-discovery-tool$ sudo -u apache ./bin/package_build.py SUSE_Package_Hub_SLES_12_SP5.json
Extracting SUSE_Package_Hub_SLES_12_SP5.json from PDS data ... 
Saved!
filename: SUSE_Package_Hub_SLES_12_SP5.json
Thanks for using SDT!
divya@discoveryubuntu:/opt/software-discovery-tool$ sudo -u apache ./bin/package_build.py RHEL_8_1_Package_List.json
Extracting RHEL_8_1_Package_List.json from PDS data ... 
Saved!
filename: RHEL_8_1_Package_List.json
Thanks for using SDT!

2. Check the files are present in data directory

divya@discoveryubuntu:/opt/software-discovery-tool$ ls distro_data/distro_data/
cached_data.json          RHEL_8_1_Package_List.json
ClefOS_7_List.json        Suse_Linux_Enterprise_Server_12_SP5_Package_List.json
Debian_Buster_List.json   SUSE_Package_Hub_SLES_12_SP5.json
OpenSUSE_Leap_15_3.json   Ubuntu_16_04_Package_List.json
OpenSUSE_Tumbleweed.json  ZOS_Software_List.json

3. Using config_build.py to automate config update

NOTE The script deletes any cache data that was present before. So no need of manual removal.

divya@discoveryubuntu:/opt/software-discovery-tool$ sudo -u apache ./bin/config_build.py 
Scanning distro_data directory...
Found new file: Ubuntu_16_04_Package_List.json
Found new file: Suse_Linux_Enterprise_Server_12_SP5_Package_List.json
Found new file: RHEL_8_1_Package_List.json
Found new file: SUSE_Package_Hub_SLES_12_SP5.json
Attempting to delete cached_data.json...
Done.

4. Restart server

divya@discoveryubuntu:/opt/software-discovery-tool$ sudo apachectl restart
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message

Working screenshot :) image

pleia2 commented 3 years ago

This looks great!

Can you also update the documentation in this PR too? Both docs/Adding_new_distros.md and docs/Installation.md will need to be adjusted to reference the new configuration files.

rachejazz commented 3 years ago

Sure! It's amusing and amazing at the same time how each document will be reduced to a few lines just by adding 2 binaries 👻

rachejazz commented 3 years ago

I've missed the major point of this script. Adding another feature:

I'll improve the doc and add this feature as well