forked from oamg/leapp-repository
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement 3rd party vendors' configuration files support (oamg#5)
* Add the initial implementation of third-party integration * Add vendors' PES events parsing * Add vendors dir existence checks * Add a testing deployment script * Remove references to target system type selector * Correct the copying in deployment script * Vendor list handling in PES actor * Trace-level logging for vendor repomaps * Repomap additional logging * Deployment script touch-up: base on cloudlinux branch * Make PES events scanner accept empty event lists * Add a test case for empty PES file * Add missing file to the deployment script * Add information about the vendors mechanism to README * Create an additional deployment script for non-CL cases * Create the vendors.d folder with the generic deployment script * Update deployment scripts * Clarifications to the README file related to repositories * Fix the deployment script not having the correct path * Implement vendor package signature loading * Additional logging for the vendor activation * Accept multiple active vendor lists if present * Fix the ActiveVendor loading in vendor signature scanner * Add the new channel-swtich file to deployment script * Produce custom repofile messages for vendor repofiles * Remove unneeded FactsPhase sets * Simplify the package signature check * Reorder the FactsPhase to make sure signed package scanner receives data * Target 3rd_parties' version of signed package scanner * Fix vendor signature comparsion * Allow for multiple RepositoriesMap messages to be processed * Changed actor execution order to provide vendor repo data * Fix the dnfplugin str encode errors * Revert "Fix the dnfplugin str encode errors" This reverts commit ddcbbf5. * Fix the dnfplugin str encode errors (without introducing platform-dependent functions) * Some clarifications in README about vendors.d * Move a "successful read" message to debug category * Switch encode handling to version independent of six version * Add docstrings to new actors * Remove script files from the repository Co-authored-by: Aleksey Petryankin <[email protected]>
- Loading branch information
Showing
25 changed files
with
815 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
repos/system_upgrade/common/actors/checkenabledvendorrepos/actor.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
from leapp.actors import Actor | ||
from leapp.libraries.stdlib import api | ||
from leapp.models import ( | ||
RepositoriesFacts, | ||
VendorRepositoriesMapCollection, | ||
ActiveVendorList, | ||
) | ||
from leapp.tags import FactsPhaseTag, IPUWorkflowTag | ||
|
||
|
||
class CheckEnabledVendorRepos(Actor): | ||
""" | ||
Create a list of vendors whose repositories are present on the system. | ||
Only those vendors' configurations (new repositories, PES actions, etc.) | ||
will be included in the upgrade process. | ||
""" | ||
|
||
name = "check_enabled_vendor_repos" | ||
consumes = (RepositoriesFacts, VendorRepositoriesMapCollection) | ||
produces = (ActiveVendorList) | ||
tags = (IPUWorkflowTag, FactsPhaseTag.Before) | ||
|
||
def process(self): | ||
vendor_mapping_data = {} | ||
active_vendors = [] | ||
|
||
# Make a dict for easy lookup of repoid -> vendor name. | ||
for map_coll in api.consume(VendorRepositoriesMapCollection): | ||
for map in map_coll.maps: | ||
for repo in map.repositories: | ||
# Cut the .csv, keep only the vendor name. | ||
vendor_mapping_data[repo.from_repoid] = map.file[:-4] | ||
|
||
# Is the repo listed in the vendor map as from_repoid present on the system? | ||
for repos in api.consume(RepositoriesFacts): | ||
for repo_file in repos.repositories: | ||
for repo in repo_file.data: | ||
self.log.debug( | ||
"Looking for repository {} in vendor maps".format(repo.repoid) | ||
) | ||
if repo.repoid in vendor_mapping_data: | ||
# If the vendor's repository is present in the system, count the vendor as active. | ||
new_vendor = vendor_mapping_data[repo.repoid] | ||
self.log.debug( | ||
"Repository {} found, enabling vendor {}".format( | ||
repo.repoid, new_vendor | ||
) | ||
) | ||
active_vendors.append(new_vendor) | ||
|
||
if active_vendors: | ||
self.log.debug("Active vendor list: {}".format(active_vendors)) | ||
api.produce(ActiveVendorList(data=active_vendors)) | ||
else: | ||
self.log.info("No active vendors found, vendor list not generated") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
repos/system_upgrade/common/actors/peseventsscanner/tests/files/sample04.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"legal_notice": "Copyright (c) 2022 CloudLinux Inc.", | ||
"packageinfo": [], | ||
"timestamp": "202207130941Z" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.