Skip to content

Commit

Permalink
Include product property in profile class
Browse files Browse the repository at this point in the history
All profiles have a product and having this property defined in profile
object is very helpful to collect and classify stats from profiles.
  • Loading branch information
marcusburghardt committed Jun 6, 2024
1 parent cb40f6b commit f5656d1
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions utils/profile_tool/profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,15 @@ def get_profile(profiles_files, file, policies, profile=None):

class Profile:
def __init__(self, path, title):
self.path = path
normalized_path = os.path.normpath(path)
profile_file = os.path.basename(normalized_path)
self.path = normalized_path
self.title = title
self.id = profile_file.split('.profile')[0]
self.product = normalized_path.split('/')[-3]
self.rules = []
self.variables = {}
self.unselected_rules = []
profile_file = os.path.basename(path)
self.id = profile_file.split('.profile')[0]

def add_rule(self, rule_id):
if rule_id.startswith("!"):
Expand Down

0 comments on commit f5656d1

Please sign in to comment.