puppet_metadata 0.3.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +27 -0
- data/lib/puppet_metadata.rb +1 -0
- data/lib/puppet_metadata/aio.rb +59 -0
- data/lib/puppet_metadata/github_actions.rb +27 -0
- data/lib/puppet_metadata/metadata.rb +5 -1
- data/lib/puppet_metadata/operatingsystem.rb +3 -2
- metadata +15 -8
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: e8eb631a9aedc17f9f1e298507ab1b181b6e5923b412fcfb4e169cdff9820b12
         | 
| 4 | 
            +
              data.tar.gz: e991cabd97835e963c08ab86dcf86455d3e898400032584d64cf40a1251af986
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: b7b644b7fd564ae6a4fe57ba11becd6ffc242e9744362fc882412425783f0af70464f99da7dd30eaa9cb6da447ce4c85267797605f92365606bcbf52d48c8210
         | 
| 7 | 
            +
              data.tar.gz: 6cd2fa3fd5d41ef5fe01dc91143e31873e98237da6757df2d3500c4d44b9b7406f78f48f0c69fc22905773d27ebd76852611e4208fe911e382348d214505c0ff
         | 
    
        data/README.md
    CHANGED
    
    | @@ -1,5 +1,13 @@ | |
| 1 1 | 
             
            # puppet_metadata
         | 
| 2 2 |  | 
| 3 | 
            +
            [](https://github.com/voxpupuli/puppet_metadata/blob/master/LICENSE)
         | 
| 4 | 
            +
            [](https://github.com/voxpupuli/puppet_metadata/actions/workflows/test.yml)
         | 
| 5 | 
            +
            [](https://codecov.io/gh/voxpupuli/puppet_metadata)
         | 
| 6 | 
            +
            [](https://github.com/voxpupuli/puppet_metadata/actions/workflows/release.yml)
         | 
| 7 | 
            +
            [](https://rubygems.org/gems/puppet_metadata)
         | 
| 8 | 
            +
            [](https://rubygems.org/gems/puppet_metadata)
         | 
| 9 | 
            +
            [](#copyright)
         | 
| 10 | 
            +
             | 
| 3 11 | 
             
            The gem intends to provide an abstraction over Puppet's metadata.json file. Its API allow easy iteration over its illogical data structures.
         | 
| 4 12 |  | 
| 5 13 | 
             
            ## Generating Github Actions outputs
         | 
| @@ -90,3 +98,22 @@ This results in the following JSON data | |
| 90 98 | 
             
            ```
         | 
| 91 99 |  | 
| 92 100 | 
             
            It is also possible to specify a comma separated list of operating systems as used in `metadata.json` (`CentOS,Ubuntu`).
         | 
| 101 | 
            +
             | 
| 102 | 
            +
            ## Transfer Notice
         | 
| 103 | 
            +
             | 
| 104 | 
            +
            This plugin was originally authored by [Ewoud Kohl van Wijngaarden](https://github.com/ekohl).
         | 
| 105 | 
            +
            The maintainer preferred that [Vox Pupuli](https://voxpupuli.org/) take ownership of the module for future improvement and maintenance.
         | 
| 106 | 
            +
            Existing pull requests and issues were transferred, please fork and continue to contribute [here](https://github.com/voxpupuli/puppet_metadata).
         | 
| 107 | 
            +
             | 
| 108 | 
            +
            ## License
         | 
| 109 | 
            +
             | 
| 110 | 
            +
            This gem is licensed under the Apache-2 license.
         | 
| 111 | 
            +
             | 
| 112 | 
            +
            ## Release information
         | 
| 113 | 
            +
             | 
| 114 | 
            +
            To make a new release, please do:
         | 
| 115 | 
            +
            * Update the version in the puppet_metadata.gemspec file
         | 
| 116 | 
            +
            * Install gems with `bundle install --with release --path .vendor`
         | 
| 117 | 
            +
            * generate the changelog with `bundle exec rake changelog`
         | 
| 118 | 
            +
            * Create a PR with it
         | 
| 119 | 
            +
            * After it got merged, push a tag. A github workflow will do the actual release
         | 
    
        data/lib/puppet_metadata.rb
    CHANGED
    
    | @@ -1,5 +1,6 @@ | |
| 1 1 | 
             
            # A module that provides abstractions around Puppet's metadata format.
         | 
| 2 2 | 
             
            module PuppetMetadata
         | 
| 3 | 
            +
              autoload :AIO, 'puppet_metadata/aio'
         | 
| 3 4 | 
             
              autoload :Beaker, 'puppet_metadata/beaker'
         | 
| 4 5 | 
             
              autoload :GithubActions, 'puppet_metadata/github_actions'
         | 
| 5 6 | 
             
              autoload :Metadata, 'puppet_metadata/metadata'
         | 
| @@ -0,0 +1,59 @@ | |
| 1 | 
            +
            module PuppetMetadata
         | 
| 2 | 
            +
              class AIO 
         | 
| 3 | 
            +
                COMPATIBLE = {
         | 
| 4 | 
            +
                  'AlmaLinux'   => 'RedHat',
         | 
| 5 | 
            +
                  'Amazon'      => 'RedHat',
         | 
| 6 | 
            +
                  'CentOS'      => 'RedHat',
         | 
| 7 | 
            +
                  'OracleLinux' => 'RedHat',
         | 
| 8 | 
            +
                  'Rocky'       => 'RedHat',
         | 
| 9 | 
            +
                  'Scientific'  => 'RedHat',
         | 
| 10 | 
            +
                }
         | 
| 11 | 
            +
             | 
| 12 | 
            +
                BUILDS = { 
         | 
| 13 | 
            +
                  # RPM-based
         | 
| 14 | 
            +
                  'RedHat' => {
         | 
| 15 | 
            +
                    '5' => 5..7,
         | 
| 16 | 
            +
                    '6' => 5..7,
         | 
| 17 | 
            +
                    '7' => 5..7,
         | 
| 18 | 
            +
                    '8' => 5..7,
         | 
| 19 | 
            +
                  },
         | 
| 20 | 
            +
                  'Fedora' => {
         | 
| 21 | 
            +
                    '26' => [5],
         | 
| 22 | 
            +
                    '27' => 5..6,
         | 
| 23 | 
            +
                    '28' => 5..6,
         | 
| 24 | 
            +
                    '29' => 5..6,
         | 
| 25 | 
            +
                    '30' => 5..7,
         | 
| 26 | 
            +
                    '31' => 5..7,
         | 
| 27 | 
            +
                    '32' => 6..7,
         | 
| 28 | 
            +
                    '34' => 6..7,
         | 
| 29 | 
            +
                  },
         | 
| 30 | 
            +
                  'SLES' => {
         | 
| 31 | 
            +
                    '11' => [7],
         | 
| 32 | 
            +
                    '12' => [7],
         | 
| 33 | 
            +
                    '15' => [7],
         | 
| 34 | 
            +
                  },
         | 
| 35 | 
            +
                  # deb-based
         | 
| 36 | 
            +
                  'Debian' => {
         | 
| 37 | 
            +
                    '7' => [5],
         | 
| 38 | 
            +
                    '8' => 5..7,
         | 
| 39 | 
            +
                    '9' => 5..7,
         | 
| 40 | 
            +
                    '10' => 5..7,
         | 
| 41 | 
            +
                    '11' => 6..7,
         | 
| 42 | 
            +
                  },
         | 
| 43 | 
            +
                  'Ubuntu' => {
         | 
| 44 | 
            +
                    '14.04' => 5..6,
         | 
| 45 | 
            +
                    '16.04' => 5..7,
         | 
| 46 | 
            +
                    '18.04' => 5..7,
         | 
| 47 | 
            +
                    '20.04' => 6..7,
         | 
| 48 | 
            +
                  },
         | 
| 49 | 
            +
                }
         | 
| 50 | 
            +
             | 
| 51 | 
            +
                def self.find_base_os(os)
         | 
| 52 | 
            +
                  COMPATIBLE.fetch(os, os)
         | 
| 53 | 
            +
                end
         | 
| 54 | 
            +
             | 
| 55 | 
            +
                def self.has_aio_build?(os, release, puppet_version)
         | 
| 56 | 
            +
                  BUILDS.dig(find_base_os(os), release)&.include?(puppet_version)
         | 
| 57 | 
            +
                end
         | 
| 58 | 
            +
              end
         | 
| 59 | 
            +
            end
         | 
| @@ -13,6 +13,7 @@ module PuppetMetadata | |
| 13 13 | 
             
                    beaker_setfiles: beaker_setfiles(beaker_use_fqdn, beaker_pidfile_workaround),
         | 
| 14 14 | 
             
                    puppet_major_versions: puppet_major_versions,
         | 
| 15 15 | 
             
                    puppet_unit_test_matrix: puppet_unit_test_matrix,
         | 
| 16 | 
            +
                    github_action_test_matrix: github_action_test_matrix(use_fqdn: beaker_use_fqdn, pidfile_workaround: beaker_pidfile_workaround),
         | 
| 16 17 | 
             
                  }
         | 
| 17 18 | 
             
                end
         | 
| 18 19 |  | 
| @@ -63,5 +64,31 @@ module PuppetMetadata | |
| 63 64 | 
             
                    '2.7'
         | 
| 64 65 | 
             
                  end
         | 
| 65 66 | 
             
                end
         | 
| 67 | 
            +
             | 
| 68 | 
            +
             | 
| 69 | 
            +
                def github_action_test_matrix(use_fqdn: false, pidfile_workaround: false)
         | 
| 70 | 
            +
                  matrix_include = []
         | 
| 71 | 
            +
             | 
| 72 | 
            +
                  metadata.operatingsystems.each do |os, releases|
         | 
| 73 | 
            +
                    releases&.each do |release|
         | 
| 74 | 
            +
                      puppet_major_versions.each do |puppet_version|
         | 
| 75 | 
            +
                        next unless AIO.has_aio_build?(os, release, puppet_version[:value])
         | 
| 76 | 
            +
             | 
| 77 | 
            +
                        setfile = PuppetMetadata::Beaker.os_release_to_setfile(os, release, use_fqdn: use_fqdn, pidfile_workaround: pidfile_workaround)
         | 
| 78 | 
            +
                        next unless setfile
         | 
| 79 | 
            +
             | 
| 80 | 
            +
                        matrix_include << {
         | 
| 81 | 
            +
                          setfile: {
         | 
| 82 | 
            +
                            name: setfile[1],
         | 
| 83 | 
            +
                            value: setfile[0],
         | 
| 84 | 
            +
                          },
         | 
| 85 | 
            +
                          puppet: puppet_version
         | 
| 86 | 
            +
                        }
         | 
| 87 | 
            +
                      end
         | 
| 88 | 
            +
                    end
         | 
| 89 | 
            +
                  end
         | 
| 90 | 
            +
             | 
| 91 | 
            +
                  matrix_include
         | 
| 92 | 
            +
                end
         | 
| 66 93 | 
             
              end
         | 
| 67 94 | 
             
            end
         | 
| @@ -141,7 +141,11 @@ module PuppetMetadata | |
| 141 141 | 
             
                  requirement = requirements['puppet']
         | 
| 142 142 | 
             
                  raise Exception, 'No Puppet requirement found' unless requirement
         | 
| 143 143 |  | 
| 144 | 
            -
                   | 
| 144 | 
            +
                  # Current latest major is 7. It is highly recommended that modules
         | 
| 145 | 
            +
                  # actually specify exact bounds, but this prevents an infinite loop.
         | 
| 146 | 
            +
                  end_major = requirement.end == SemanticPuppet::Version::MAX ? 7 : requirement.end.major
         | 
| 147 | 
            +
             | 
| 148 | 
            +
                  (requirement.begin.major..end_major).select do |major|
         | 
| 145 149 | 
             
                    requirement.include?(SemanticPuppet::Version.new(major, 0, 0)) || requirement.include?(SemanticPuppet::Version.new(major, 99, 99))
         | 
| 146 150 | 
             
                  end
         | 
| 147 151 | 
             
                end
         | 
| @@ -22,9 +22,10 @@ module PuppetMetadata | |
| 22 22 | 
             
                  # https://wiki.debian.org/DebianReleases
         | 
| 23 23 | 
             
                  'Debian' => {
         | 
| 24 24 | 
             
                    # TODO: EOL is standard support, not the extended life cycle
         | 
| 25 | 
            +
                    '11' => nil, # '~2024',
         | 
| 25 26 | 
             
                    '10' => nil, # '~2022',
         | 
| 26 | 
            -
                    '9' =>  | 
| 27 | 
            -
                    '8' => '2018-06- | 
| 27 | 
            +
                    '9' => '2020-07-06',
         | 
| 28 | 
            +
                    '8' => '2018-06-17',
         | 
| 28 29 | 
             
                    '7' => '2016-04-26',
         | 
| 29 30 | 
             
                    '6' => '2015-05-31',
         | 
| 30 31 | 
             
                    '5' => '2012-02-06',
         | 
    
        metadata
    CHANGED
    
    | @@ -1,30 +1,36 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: puppet_metadata
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version:  | 
| 4 | 
            +
              version: 1.1.1
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Vox Pupuli
         | 
| 8 8 | 
             
            - Ewoud Kohl van Wijngaarden
         | 
| 9 | 
            -
            autorequire:
         | 
| 9 | 
            +
            autorequire: 
         | 
| 10 10 | 
             
            bindir: bin
         | 
| 11 11 | 
             
            cert_chain: []
         | 
| 12 | 
            -
            date:  | 
| 12 | 
            +
            date: 2021-08-21 00:00:00.000000000 Z
         | 
| 13 13 | 
             
            dependencies:
         | 
| 14 14 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 15 15 | 
             
              name: metadata-json-lint
         | 
| 16 16 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| 17 17 | 
             
                requirements:
         | 
| 18 | 
            -
                - - " | 
| 18 | 
            +
                - - ">="
         | 
| 19 19 | 
             
                  - !ruby/object:Gem::Version
         | 
| 20 20 | 
             
                    version: '2.0'
         | 
| 21 | 
            +
                - - "<"
         | 
| 22 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 23 | 
            +
                    version: '4'
         | 
| 21 24 | 
             
              type: :runtime
         | 
| 22 25 | 
             
              prerelease: false
         | 
| 23 26 | 
             
              version_requirements: !ruby/object:Gem::Requirement
         | 
| 24 27 | 
             
                requirements:
         | 
| 25 | 
            -
                - - " | 
| 28 | 
            +
                - - ">="
         | 
| 26 29 | 
             
                  - !ruby/object:Gem::Version
         | 
| 27 30 | 
             
                    version: '2.0'
         | 
| 31 | 
            +
                - - "<"
         | 
| 32 | 
            +
                  - !ruby/object:Gem::Version
         | 
| 33 | 
            +
                    version: '4'
         | 
| 28 34 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 29 35 | 
             
              name: semantic_puppet
         | 
| 30 36 | 
             
              requirement: !ruby/object:Gem::Requirement
         | 
| @@ -121,6 +127,7 @@ files: | |
| 121 127 | 
             
            - README.md
         | 
| 122 128 | 
             
            - bin/metadata2gha
         | 
| 123 129 | 
             
            - lib/puppet_metadata.rb
         | 
| 130 | 
            +
            - lib/puppet_metadata/aio.rb
         | 
| 124 131 | 
             
            - lib/puppet_metadata/beaker.rb
         | 
| 125 132 | 
             
            - lib/puppet_metadata/github_actions.rb
         | 
| 126 133 | 
             
            - lib/puppet_metadata/metadata.rb
         | 
| @@ -129,7 +136,7 @@ homepage: http://github.com/voxpupuli/puppet_metadata | |
| 129 136 | 
             
            licenses:
         | 
| 130 137 | 
             
            - Apache-2.0
         | 
| 131 138 | 
             
            metadata: {}
         | 
| 132 | 
            -
            post_install_message:
         | 
| 139 | 
            +
            post_install_message: 
         | 
| 133 140 | 
             
            rdoc_options:
         | 
| 134 141 | 
             
            - "--main"
         | 
| 135 142 | 
             
            - README.md
         | 
| @@ -146,8 +153,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 146 153 | 
             
                - !ruby/object:Gem::Version
         | 
| 147 154 | 
             
                  version: '0'
         | 
| 148 155 | 
             
            requirements: []
         | 
| 149 | 
            -
            rubygems_version: 3. | 
| 150 | 
            -
            signing_key:
         | 
| 156 | 
            +
            rubygems_version: 3.2.22
         | 
| 157 | 
            +
            signing_key: 
         | 
| 151 158 | 
             
            specification_version: 4
         | 
| 152 159 | 
             
            summary: Data structures for the Puppet Metadata
         | 
| 153 160 | 
             
            test_files: []
         |