{"id":17377336,"url":"https://github.com/voxpupuli/puppet_metadata","last_synced_at":"2025-12-28T19:32:47.461Z","repository":{"id":37839609,"uuid":"264251817","full_name":"voxpupuli/puppet_metadata","owner":"voxpupuli","description":"The gem intends to provide an abstraction over Puppet's metadata.json file. Its API allow easy iteration over its illogical data structures.","archived":false,"fork":false,"pushed_at":"2025-04-16T13:39:19.000Z","size":333,"stargazers_count":3,"open_issues_count":9,"forks_count":13,"subscribers_count":40,"default_branch":"master","last_synced_at":"2025-05-01T00:38:46.103Z","etag":null,"topics":["hacktoberfest","puppet","ruby"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/voxpupuli.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"open_collective":"vox-pupuli","github":"voxpupuli"}},"created_at":"2020-05-15T17:05:11.000Z","updated_at":"2025-04-15T08:40:37.000Z","dependencies_parsed_at":"2023-11-09T13:04:22.065Z","dependency_job_id":"4e9f0e43-2388-4c63-944a-2a0b96a0e67c","html_url":"https://github.com/voxpupuli/puppet_metadata","commit_stats":{"total_commits":168,"total_committers":13,"mean_commits":"12.923076923076923","dds":0.5654761904761905,"last_synced_commit":"40fcd66e27a0fc5ef1494e15c12d32b4f7a54ee8"},"previous_names":[],"tags_count":36,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voxpupuli%2Fpuppet_metadata","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voxpupuli%2Fpuppet_metadata/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voxpupuli%2Fpuppet_metadata/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voxpupuli%2Fpuppet_metadata/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/voxpupuli","download_url":"https://codeload.github.com/voxpupuli/puppet_metadata/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252694345,"owners_count":21789847,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hacktoberfest","puppet","ruby"],"created_at":"2024-10-16T05:05:25.174Z","updated_at":"2025-12-28T19:32:47.455Z","avatar_url":"https://github.com/voxpupuli.png","language":"Ruby","funding_links":["https://opencollective.com/vox-pupuli","https://github.com/sponsors/voxpupuli"],"categories":[],"sub_categories":[],"readme":"# puppet_metadata\n\n[![License](https://img.shields.io/github/license/voxpupuli/puppet_metadata.svg)](https://github.com/voxpupuli/puppet_metadata/blob/master/LICENSE)\n[![Test](https://github.com/voxpupuli/puppet_metadata/actions/workflows/test.yml/badge.svg)](https://github.com/voxpupuli/puppet_metadata/actions/workflows/test.yml)\n[![codecov](https://codecov.io/gh/voxpupuli/puppet_metadata/branch/master/graph/badge.svg?token=Mypkl78hvK)](https://codecov.io/gh/voxpupuli/puppet_metadata)\n[![Release](https://github.com/voxpupuli/puppet_metadata/actions/workflows/release.yml/badge.svg)](https://github.com/voxpupuli/puppet_metadata/actions/workflows/release.yml)\n[![RubyGem Version](https://img.shields.io/gem/v/puppet_metadata.svg)](https://rubygems.org/gems/puppet_metadata)\n[![RubyGem Downloads](https://img.shields.io/gem/dt/puppet_metadata.svg)](https://rubygems.org/gems/puppet_metadata)\n[![Donated by Ewoud Kohl van Wijngaarden](https://img.shields.io/badge/donated%20by-Ewoud%20Kohl%20van%20Wijngaarden-fb7047.svg)](#transfer-notice)\n\nThe gem intends to provide an abstraction over Puppet's metadata.json file. Its API allow easy iteration over its illogical data structures.\n\n- [puppet\\_metadata](#puppet_metadata)\n  - [New CLI interface in 6.0.0](#new-cli-interface-in-600)\n  - [Manage OS versions in metadata.json](#manage-os-versions-in-metadatajson)\n    - [List supported OS versions](#list-supported-os-versions)\n    - [Add missing supported OS versions](#add-missing-supported-os-versions)\n    - [Remove EOL OS versions](#remove-eol-os-versions)\n  - [Generating Github Actions outputs](#generating-github-actions-outputs)\n  - [Work with the API](#work-with-the-api)\n    - [List all supported operating systems](#list-all-supported-operating-systems)\n    - [List supported major puppet versions](#list-supported-major-puppet-versions)\n    - [Check if an operating systems is supported](#check-if-an-operating-systems-is-supported)\n    - [Get all versions for an Operating System that are not EoL](#get-all-versions-for-an-operating-system-that-are-not-eol)\n    - [Get all versions for an Operating System that are not EoL after a certain date](#get-all-versions-for-an-operating-system-that-are-not-eol-after-a-certain-date)\n  - [Updating OS EOL dates](#updating-os-eol-dates)\n    - [Adding new operating systems](#adding-new-operating-systems)\n  - [List supported setfiles](#list-supported-setfiles)\n  - [Transfer Notice](#transfer-notice)\n  - [License](#license)\n  - [Release information](#release-information)\n\n## New CLI interface in 6.0.0\n\nVersion 6.0.0 introduces a new CLI interface, in `bin/puppet-metadata`.\nIt provides a new way of handling default CLI options, like the path to the metadata.json.\n\n```\n$ bundle exec bin/puppet-metadata --help\nUsage: puppet-metadata [options] \u003caction\u003e [options]\n        --filename METADATA          Metadata filename\n\nACTIONS\n  os-versions         Manage operating system versions in metadata.json\n  setfiles            Show the various setfiles supported by the metadata\n\nSee 'puppet-metadata ACTION --help' for more information on a specific action.\n```\n\n`--filename ` is optional.\nIf ommitted, a metadata.json in the current directory will be parsed.\n\nEach action is implemented as a file in `lib/puppet_metadata/command/*rb` and automatically loaded via `lib/puppet_metadata/command.rb`.\n\n## Manage OS versions in metadata.json\n\nThe `os-versions` command provides a unified interface to view, add, and remove operating system versions in the metadata.json.\n\n### List supported OS versions\n\nBy default, `os-versions` shows which OS versions in your metadata.json are still supported and which are EOL:\n\n```\n$ bundle exec puppet-metadata os-versions\nmodule-name supports these non-EOL operating system versions:\n  AlmaLinux: 8, 9\n  CentOS: 9\n  Debian: 11, 12\n  OracleLinux: 8, 9, 10\n  RedHat: 8, 9\n  Rocky: 8, 9\n  Ubuntu: 22.04, 24.04\n\nmodule-name supports these EOL operating system versions:\n  Fedora: 40\n  Ubuntu: 20.04\n```\n\nYou can filter to a specific OS:\n\n```\n$ bundle exec puppet-metadata os-versions --os Ubuntu\nmodule-name supports these non-EOL operating system versions:\n  Ubuntu: 22.04, 24.04\n\nmodule-name supports these EOL operating system versions:\n  Ubuntu: 20.04\n```\n\n### Add missing supported OS versions\n\nUse `--add-missing` to automatically add all non-EOL OS versions to metadata.json:\n\n```\n$ bundle exec puppet-metadata os-versions --add-missing\nAdded support:\nCentOS =\u003e 10\nDebian =\u003e 13\n```\n\nThese OSes are exceptions (to align with [beaker-hostgenerator](https://github.com/voxpupuli/beaker-hostgenerator) support):\n\n- For SLES, only major versions are added.\n- For Ubuntu, only LTS versions are added.\n\n### Remove EOL OS versions\n\nUse `--remove-eol` to automatically remove all EOL OS versions from metadata.json:\n\n```\n$ bundle exec puppet-metadata os-versions --remove-eol\nRemoved EOL operating systems:\nCentOS =\u003e 7, 8\nDebian =\u003e 9, 10\nUbuntu =\u003e 20.04\n```\n\nYou can preview changes without modifying metadata.json using `--noop`:\n\n```\n$ bundle exec puppet-metadata os-versions --add-missing --noop\n[NOOP] Would add support:\nCentOS =\u003e 10\nDebian =\u003e 13\n```\n\n## Generating Github Actions outputs\n\nTo get outputs [usable in Github Actions](https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions), there is the `metadata2gha` command available. This generates based on metadata.json, such as [Beaker](https://github.com/voxpupuli/beaker) setfiles, Puppet major versions and a Puppet unit test matrix.\n\n```console\n$ metadata2gha\npuppet_major_versions=[{\"name\":\"Puppet 8\",\"value\":8,\"collection\":\"puppet8\"},{\"name\":\"Puppet 7\",\"value\":7,\"collection\":\"puppet7\"}]\npuppet_unit_test_matrix=[{\"puppet\":8,\"ruby\":\"3.2\"},{\"puppet\":7,\"ruby\":\"2.7\"}]\npuppet_beaker_test_matrix=[{\"name\":\"Puppet 8 - Debian 12\",\"env\":{\"BEAKER_PUPPET_COLLECTION\":\"puppet8\",\"BEAKER_SETFILE\":\"debian12-64{hostname=debian12-64-puppet8}\"}},{\"name\":\"Puppet 7 - Debian 12\",\"env\":{\"BEAKER_PUPPET_COLLECTION\":\"puppet7\",\"BEAKER_SETFILE\":\"debian12-64{hostname=debian12-64-puppet7}\"}}]\n```\n\nPuppet major versions formatted for readability:\n```json\n[\n  {\n    \"name\": \"Puppet 8\",\n    \"value\": 8,\n    \"collection\": \"puppet8\"\n  },\n  {\n    \"name\": \"Puppet 7\",\n    \"value\": 7,\n    \"collection\": \"puppet7\"\n  }\n]\n```\n\nPuppet unit test matrix formatted for readability:\n```json\n[\n  {\n    \"puppet\": 8,\n    \"ruby\": \"3.2\"\n  },\n  {\n    \"puppet\": 7,\n    \"ruby\": \"2.7\"\n  }\n]\n```\n\nBeaker test matrix formatted for readability\n```json\n[\n  {\n    \"name\": \"Puppet 8 - Debian 12\",\n    \"env\": {\n      \"BEAKER_PUPPET_COLLECTION\": \"puppet8\",\n      \"BEAKER_SETFILE\": \"debian12-64{hostname=debian12-64-puppet8}\"\n    }\n  },\n  {\n    \"name\": \"Puppet 7 - Debian 12\",\n    \"env\": {\n      \"BEAKER_PUPPET_COLLECTION\": \"puppet7\",\n      \"BEAKER_SETFILE\": \"debian12-64{hostname=debian12-64-puppet7}\"\n    }\n  }\n]\n```\n\nIf you need custom hostname or multiple hosts in your integration tests this could be achived by using the --beaker-hosts option\n\nOption argument is 'HOSTNAME:ROLES;HOSTNAME:..;..' where\n- hosts are separated by ';'\n- host number and roles are separated by ':'\n- Roles follow beaker-hostgenerator syntax\nIf you don't need any extra roles use '1;2;..'\n\n```console\n$ metadata2gha --beaker-hosts 'foo:primary.ma;bar:secondary.a'\n```\n\nThis results in the following JSON data\n```json\n[\n  {\n    \"name\": \"Puppet 7 - Debian 12\",\n    \"env\": {\n      \"BEAKER_PUPPET_COLLECTION\": \"puppet7\",\n      \"BEAKER_SETFILE\": \"debian12-64primary.ma{hostname=foo-puppet7}-debian12-64secondary.a{hostname=bar-puppet7}\"\n    }\n  }\n]\n```\n\nIf you need to Expand the matrix ie by product versions it could be achived by using the --beaker-facter option\n\nOption argument is 'FACT:LABEL:VALUE,VALUE,..' where\n- Fact, label and values are separated by ':'\n- Values are separated by ','\n\n```console\n$ metadata2gha --beaker-facter 'mongodb_repo_version:MongoDB:4.4,5.0,6.0,7.0'\n```\n\nThis results in the following JSON data\n```json\n[\n  {\n    \"name\": \"Puppet 7 - Debian 12 - MongoDB 4.4\",\n    \"env\": {\n        \"BEAKER_PUPPET_COLLECTION\": \"puppet7\",\n        \"BEAKER_SETFILE\": \"debian12-64{hostname=debian12-64-puppet7}\",\n        \"BEAKER_FACTER_mongodb_repo_version\": \"4.4\"\n    }\n  },\n  {\n    \"name\": \"Puppet 7 - Debian 12 - MongoDB 5.0\",\n    \"env\": {\n      \"BEAKER_PUPPET_COLLECTION\": \"puppet7\",\n      \"BEAKER_SETFILE\": \"debian12-64{hostname=debian12-64-puppet7}\",\n      \"BEAKER_FACTER_mongodb_repo_version\": \"5.0\"\n    }\n  },\n  {\n    \"name\": \"Puppet 7 - Debian 12 - MongoDB 6.0\",\n    \"env\": {\n      \"BEAKER_PUPPET_COLLECTION\": \"puppet7\",\n      \"BEAKER_SETFILE\": \"debian12-64{hostname=debian12-64-puppet7}\",\n      \"BEAKER_FACTER_mongodb_repo_version\": \"6.0\"\n    }\n  },\n  {\n    \"name\": \"Puppet 7 - Debian 12 - MongoDB 7.0\",\n    \"env\": {\n      \"BEAKER_PUPPET_COLLECTION\": \"puppet7\",\n      \"BEAKER_SETFILE\": \"debian12-64{hostname=debian12-64-puppet7}\",\n      \"BEAKER_FACTER_mongodb_repo_version\": \"7.0\"\n    }\n  }\n]\n```\n\n## Work with the API\n\nThe API can be initialised like this:\n\n```ruby\nrequire 'puppet_metadata'\nmetadata = PuppetMetadata.read('/path/to/a/metadata.json')\n```\n\nThe metadata object has several different methods that we can call\n\n### List all supported operating systems\n\n```\n[9] pry(main)\u003e metadata.operatingsystems\n=\u003e {\"Archlinux\"=\u003enil, \"Gentoo\"=\u003enil, \"Fedora\"=\u003e[\"32\", \"33\"], \"CentOS\"=\u003e[\"7\", \"8\"], \"RedHat\"=\u003e[\"7\", \"8\"], \"Ubuntu\"=\u003e[\"18.04\"], \"Debian\"=\u003e[\"9\", \"10\"], \"VirtuozzoLinux\"=\u003e[\"7\"]}\n[10] pry(main)\u003e\n```\n\n### List supported major puppet versions\n\n```\n[10] pry(main)\u003e metadata.puppet_major_versions\n=\u003e [6, 7]\n[11] pry(main)\u003e\n```\n\n### Check if an operating systems is supported\n\n```\n[6] pry(main)\u003e metadata.os_release_supported?('Archlinux', nil)\n=\u003e true\n[7] pry(main)\u003e\n```\n\n### Get all versions for an Operating System that are not EoL\n\n```\n[1] pry(main)\u003e require 'puppet_metadata'\n=\u003e true\n[2] pry(main)\u003e PuppetMetadata::OperatingSystem.supported_releases('RedHat')\n=\u003e [\"8\", \"9\", \"10\"]\n[3] pry(main)\u003e PuppetMetadata::OperatingSystem.supported_releases('windows')\n=\u003e []\n[4] pry(main)\u003e\n```\n\n**For Operating systems without any known releases, an empty array is returned.**\n\n### Get all versions for an Operating System that are not EoL after a certain date\n\n```\n[1] pry(main)\u003e require 'puppet_metadata'\n=\u003e true\n[2] pry(main)\u003e PuppetMetadata::OperatingSystem.supported_releases('CentOS', Date.parse('2025-04-15'))\n=\u003e [\"9\", \"10\"]\n[3] pry(main)\u003e\n```\n\nCentOS 8 and older aren't listed.\n8 is EoL since 2024-05-31.\n\n## Updating OS EOL dates\n\nThe EOL dates for operating systems are stored in `data/eol_dates.json` and are automatically updated weekly via GitHub Actions using data from [endoflife.date](https://endoflife.date/).\n\n- For Amazon Linux, this is security support, not standard support.\n- For Debian, this is extended life cycle, not standard support.\n- For CentOS, this is security support, not active support.\n- For OracleLinux, this is basic support, not extended support.\n- For RedHat, this is maintenance support, not extended life cycle.\n- For Rocky, this is security support, not active support.\n- For SLES, this is general support, not long term service pack support.\n\nTo manually update the EOL dates:\n\n```bash\n./bin/update_eol_dates\n```\n\n### Adding new operating systems\n\nTo add a new operating system to the EOL tracking:\n\n1. Add an entry to the `OS_MAPPING` hash in `bin/update_eol_dates`\n2. Map it to the corresponding [endoflife.date product identifier](https://endoflife.date/docs/api/)\n3. Run `./bin/update_eol_dates` to fetch the data\n4. If the OS requires special handling (like Amazon Linux which uses multiple API endpoints), add a custom handler function\n\n## List supported setfiles\n\nWhen running beaker on the CLI, you can specify a specific setfile. `puppet_metadata` provides `bin/setfiles` to list all setfiles:\n\n```\n$ bundle exec setfiles\nSkipping EOL operating system Debian 10\nSkipping EOL operating system Ubuntu 18.04\nBEAKER_SETFILE=\"centos9-64{hostname=centos9-64-puppet8.example.com}\"\nBEAKER_SETFILE=\"centos9-64{hostname=centos9-64-puppet7.example.com}\"\nBEAKER_SETFILE=\"debian11-64{hostname=debian11-64-puppet8.example.com}\"\nBEAKER_SETFILE=\"debian11-64{hostname=debian11-64-puppet7.example.com}\"\nBEAKER_SETFILE=\"ubuntu2004-64{hostname=ubuntu2004-64-puppet8.example.com}\"\nBEAKER_SETFILE=\"ubuntu2004-64{hostname=ubuntu2004-64-puppet7.example.com}\"\n```\n\nAs an argument you can provide a path to a metadata.json. If none provided, it assumes that there's a metadata.json in the same directory where you run the command.\nTo make copy and paste easier, each setfile string is prefixed so it can directly be used as environment variable.\n\n## Transfer Notice\n\nThis plugin was originally authored by [Ewoud Kohl van Wijngaarden](https://github.com/ekohl).\nThe maintainer preferred that [Vox Pupuli](https://voxpupuli.org/) take ownership of the module for future improvement and maintenance.\nExisting pull requests and issues were transferred, please fork and continue to contribute [here](https://github.com/voxpupuli/puppet_metadata).\n\n## License\n\nThis gem is licensed under the Apache-2 license.\n\n## Release information\n\nTo make a new release, please do:\n* Update the version in the puppet_metadata.gemspec file\n* Install gems with `bundle install --with release --path .vendor`\n* generate the changelog with `bundle exec rake changelog`\n* Create a PR with it\n* After it got merged, push a tag. A github workflow will do the actual release\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvoxpupuli%2Fpuppet_metadata","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvoxpupuli%2Fpuppet_metadata","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvoxpupuli%2Fpuppet_metadata/lists"}