Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Products gatherer #285

Merged
merged 5 commits into from
Oct 31, 2023
Merged

Products gatherer #285

merged 5 commits into from
Oct 31, 2023

Conversation

arbulu89
Copy link
Contributor

@arbulu89 arbulu89 commented Oct 31, 2023

/etc/products.d/ folder products information gatherer.
It walks the path searching for all files and returns the value on them, mapped for file names.
It returns all the fields available in the xml, basically, because it is even easier to return everything rather than picking specific values. <- FYI @abravosuse

#> ./trento-agent facts gather --gatherer products
INFO[2023-10-31 08:44:01] loading plugins                              
INFO[2023-10-31 08:44:01] Starting products facts gathering process    
INFO[2023-10-31 08:44:01] Requested products facts gathered            
INFO[2023-10-31 08:44:01] Gathered fact for "products" with argument "": 
INFO[2023-10-31 08:44:01] Name: 
Check ID: 

Value:

#{
  "Leap.prod": #{
    "product": #{
      "arch": "x86_64",
      "buildconfig": #{
        "create_flavors": "true",
        "producttheme": "openSUSE"
      },
      "codestream": #{
        "endoflife": "2024-11-30",
        "name": "openSUSE Leap 15"
      },
      "cpeid": "cpe:/o:opensuse:leap:15.3",
      "description": "openSUSE Leap 15.3.",
      "endoflife": "2022-11-30",
      ...
      "name": "Leap",
      "productline": "Leap",
      ...
      "release": "2",
      ...
    }
  },
  "baseproduct": #{
    "product": #{
      "arch": "x86_64",
      ...
      "codestream": #{
        "endoflife": "2024-11-30",
        "name": "openSUSE Leap 15"
      },
     ...
      "name": "Leap",
      "productline": "Leap",
      ...
      "vendor": "openSUSE",
      "version": "15.3"
    }
  }
} 

The check could simply look like (but you could loop around all the products as well):

facts.products.baseproduct.product.vendor == "openSUSE"

@arbulu89 arbulu89 added the enhancement New feature or request label Oct 31, 2023
@arbulu89 arbulu89 marked this pull request as ready for review October 31, 2023 07:53
Copy link

@abravosuse abravosuse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me Xabi

Copy link
Member

@CDimonaco CDimonaco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@EMaksy EMaksy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey man lgtm :)

@arbulu89 arbulu89 merged commit a54dd6b into main Oct 31, 2023
10 checks passed
@arbulu89 arbulu89 deleted the products-gatherer branch October 31, 2023 12:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

Successfully merging this pull request may close these issues.

4 participants