cloudstrap 0.42.9.pre → 0.43.0.pre
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/lib/cloudstrap/component_versions.rb +35 -0
- data/lib/cloudstrap/config.rb +36 -1
- metadata +2 -1
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: bc9419405b45fa2b6ce77e13a6214eea069b1cdb
         | 
| 4 | 
            +
              data.tar.gz: 4a3b4d6cec099f2fd7f51cf530bb605664996214
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: c75b853bce1ab62228e7cf76f1a22c85102fe4679e477480814587cbb3d6e369a82e6e6e07c6e03320c98afd6e5614ecb3edd9866cd48c03ab2f2eba5658fb85
         | 
| 7 | 
            +
              data.tar.gz: bcc021f60f44c04ad9f2a5b4057d93fd25d5e395e1a969c54740aca873c7e9e418071bd258bd7bf0a4b962cf74ca1c78c0d99c4c2d1b23311b2a6e62129e73e4
         | 
| @@ -0,0 +1,35 @@ | |
| 1 | 
            +
            require 'faraday'
         | 
| 2 | 
            +
            require 'multi_json'
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            module Cloudstrap
         | 
| 5 | 
            +
              class ComponentVersions
         | 
| 6 | 
            +
                def initialize(config)
         | 
| 7 | 
            +
                  @config = config
         | 
| 8 | 
            +
                  self
         | 
| 9 | 
            +
                end
         | 
| 10 | 
            +
             | 
| 11 | 
            +
                def hcp
         | 
| 12 | 
            +
                  version_from https.get @config.hcp_metadata
         | 
| 13 | 
            +
                end
         | 
| 14 | 
            +
             | 
| 15 | 
            +
                def hce
         | 
| 16 | 
            +
                  version_from https.get @config.hce_metadata
         | 
| 17 | 
            +
                end
         | 
| 18 | 
            +
             | 
| 19 | 
            +
                def hsm
         | 
| 20 | 
            +
                  version_from https.get @config.hsm_metadata
         | 
| 21 | 
            +
                end
         | 
| 22 | 
            +
             | 
| 23 | 
            +
                private
         | 
| 24 | 
            +
             | 
| 25 | 
            +
                def https
         | 
| 26 | 
            +
                  @https ||= Faraday.new "https://#{@config.artifact_origin}"
         | 
| 27 | 
            +
                end
         | 
| 28 | 
            +
             | 
| 29 | 
            +
                def version_from(response)
         | 
| 30 | 
            +
                  return unless response.success?
         | 
| 31 | 
            +
             | 
| 32 | 
            +
                  MultiJson.load(response.body).fetch('Version')
         | 
| 33 | 
            +
                end
         | 
| 34 | 
            +
              end
         | 
| 35 | 
            +
            end
         | 
    
        data/lib/cloudstrap/config.rb
    CHANGED
    
    | @@ -2,6 +2,8 @@ require 'contracts' | |
| 2 2 | 
             
            require 'pastel'
         | 
| 3 3 | 
             
            require 'yaml'
         | 
| 4 4 |  | 
| 5 | 
            +
            require_relative 'component_versions'
         | 
| 6 | 
            +
             | 
| 5 7 | 
             
            module Cloudstrap
         | 
| 6 8 | 
             
              class Config
         | 
| 7 9 | 
             
                include ::Contracts::Core
         | 
| @@ -113,6 +115,34 @@ module Cloudstrap | |
| 113 115 | 
             
                  lookup(:artifact_prefix) { '/downloads' }
         | 
| 114 116 | 
             
                end
         | 
| 115 117 |  | 
| 118 | 
            +
                Contract None => String
         | 
| 119 | 
            +
                def hce_prefix
         | 
| 120 | 
            +
                  lookup(:hce_prefix) do
         | 
| 121 | 
            +
                    "#{artifact_prefix}/hce"
         | 
| 122 | 
            +
                  end.squeeze('/')
         | 
| 123 | 
            +
                end
         | 
| 124 | 
            +
             | 
| 125 | 
            +
                Contract None => String
         | 
| 126 | 
            +
                def hce_metadata
         | 
| 127 | 
            +
                  lookup(:hce_metadata) do
         | 
| 128 | 
            +
                    "#{hce_prefix}/dist/v2/linux-amd64.json"
         | 
| 129 | 
            +
                  end.squeeze('/')
         | 
| 130 | 
            +
                end
         | 
| 131 | 
            +
             | 
| 132 | 
            +
                Contract None => String
         | 
| 133 | 
            +
                def hsm_prefix
         | 
| 134 | 
            +
                  lookup(:hsm_prefix) do
         | 
| 135 | 
            +
                    "#{artifact_prefix}/hsm"
         | 
| 136 | 
            +
                  end.squeeze('/')
         | 
| 137 | 
            +
                end
         | 
| 138 | 
            +
             | 
| 139 | 
            +
                Contract None => String
         | 
| 140 | 
            +
                def hsm_metadata
         | 
| 141 | 
            +
                  lookup(:hsm_metadata) do
         | 
| 142 | 
            +
                    "#{hsm_prefix}/cli/update/linux-amd64.json"
         | 
| 143 | 
            +
                  end.squeeze('/')
         | 
| 144 | 
            +
                end
         | 
| 145 | 
            +
             | 
| 116 146 | 
             
                Contract None => String
         | 
| 117 147 | 
             
                def hcp_prefix
         | 
| 118 148 | 
             
                  lookup(:hcp_prefix) do
         | 
| @@ -134,7 +164,7 @@ module Cloudstrap | |
| 134 164 |  | 
| 135 165 | 
             
                Contract None => String
         | 
| 136 166 | 
             
                def hcp_bootstrap_version
         | 
| 137 | 
            -
                  lookup(:hcp_bootstrap_version) {  | 
| 167 | 
            +
                  lookup(:hcp_bootstrap_version) { latest.hcp }
         | 
| 138 168 | 
             
                end
         | 
| 139 169 |  | 
| 140 170 | 
             
                alias hcp_version hcp_bootstrap_version
         | 
| @@ -234,6 +264,11 @@ EOS | |
| 234 264 | 
             
                  @path ||= File.expand_path [dir, file].join('/')
         | 
| 235 265 | 
             
                end
         | 
| 236 266 |  | 
| 267 | 
            +
                Contract None => ComponentVersions
         | 
| 268 | 
            +
                def latest
         | 
| 269 | 
            +
                  @latest ||= ComponentVersions.new self
         | 
| 270 | 
            +
                end
         | 
| 271 | 
            +
             | 
| 237 272 | 
             
                Contract None => Hash
         | 
| 238 273 | 
             
                def config
         | 
| 239 274 | 
             
                  @settings ||= if File.exist?(path)
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: cloudstrap
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0. | 
| 4 | 
            +
              version: 0.43.0.pre
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Chris Olstrom
         | 
| @@ -336,6 +336,7 @@ files: | |
| 336 336 | 
             
            - lib/cloudstrap/amazon/service.rb
         | 
| 337 337 | 
             
            - lib/cloudstrap/amazon/support/rate_limit_handler.rb
         | 
| 338 338 | 
             
            - lib/cloudstrap/bootstrap_agent.rb
         | 
| 339 | 
            +
            - lib/cloudstrap/component_versions.rb
         | 
| 339 340 | 
             
            - lib/cloudstrap/config.rb
         | 
| 340 341 | 
             
            - lib/cloudstrap/errors.rb
         | 
| 341 342 | 
             
            - lib/cloudstrap/hcp/bootstrap_properties.rb
         |