govuk-connect 0.5.2 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 96fcd456119377e987a030728e2a35d21ae6fb97200de1337df929822d9b56a5
4
- data.tar.gz: 9e16ea46cb21a8226495da7d85025bfb30958f5a0be07c5e9ea4ee25ff48659d
3
+ metadata.gz: 40b05abfbca40a3b8f8729a78372915eec32ab961f6f6906b46239929dbf3425
4
+ data.tar.gz: 17210ea67f872030a904f674a24635f9d39f4077386e779755b5674f737623fa
5
5
  SHA512:
6
- metadata.gz: 3aa7936fca2f9749fffbc1464707a0b5102504d656d49d0f10ad9dafc226700831fcc74e78d72cc01cae6ddfe520e2f087cfed86e25b968458fbe5ed92986fcf
7
- data.tar.gz: a041ef55618929e10456cda3e8fd59bc15fb3f2910fc0074885cdeeabe894cce7835f4a438a3d5e618aa33d6a0eeadc92e1aade12694ab8a52b7a85a5667b3ec
6
+ metadata.gz: 91c2408222918dc7557b326a612c580027a8b2e81d375c5d35af2dca875557ae882078df1e743874118f5b3feff6671d50b0009f55d0e30a6bbf4d55aedd398b
7
+ data.tar.gz: d205e9baf15907debb7be37205fc58d1a8322d82379dad5be5c8e931351f2a9ec51e525f2b7783e243afed6af62d4d9a1633dc71503ee2f77496b052ab0bde5f
@@ -227,7 +227,7 @@ class GovukConnect::CLI
227
227
  def ssh_username
228
228
  @ssh_username ||= begin
229
229
  if File.exist? config_file
230
- config_ssh_username = YAML.load_file(config_file)["ssh_username"]
230
+ config_ssh_username = load_yaml(config_file)["ssh_username"]
231
231
  end
232
232
 
233
233
  config_ssh_username || ENV["USER"]
@@ -235,9 +235,7 @@ class GovukConnect::CLI
235
235
  end
236
236
 
237
237
  def ssh_identity_file
238
- @ssh_identity_file ||= begin
239
- YAML.load_file(config_file)["ssh_identity_file"] if File.exist? config_file
240
- end
238
+ @ssh_identity_file ||= (load_yaml(config_file)["ssh_identity_file"] if File.exist? config_file)
241
239
  end
242
240
 
243
241
  def ssh_identity_arguments
@@ -315,12 +313,12 @@ class GovukConnect::CLI
315
313
  hieradata_file = File.join(local_hieradata_root, "#{environment}.yaml")
316
314
  log "debug: reading #{hieradata_file}"
317
315
 
318
- environment_specific_hieradata = YAML.load_file(hieradata_file)
316
+ environment_specific_hieradata = load_yaml(hieradata_file)
319
317
 
320
318
  if environment_specific_hieradata["node_class"]
321
319
  environment_specific_hieradata["node_class"]
322
320
  else
323
- common_hieradata = YAML.load_file(
321
+ common_hieradata = load_yaml(
324
322
  File.join(local_hieradata_root, "common.yaml"),
325
323
  )
326
324
 
@@ -328,6 +326,21 @@ class GovukConnect::CLI
328
326
  end
329
327
  end
330
328
 
329
+ def load_yaml(file_path)
330
+ # Psych (the gem that provides YAML parsing) introduced a new method,
331
+ # safe_load_file, in version 3.3 (which shipped with Ruby 3.0) and in
332
+ # version 4 (shipped with Ruby 3.1) the API for load_file changed and will
333
+ # error with GOV.UK hieradata.
334
+ #
335
+ # Once this gem no longer supports Ruby 2.x (or pins to a version of Psych)
336
+ # we can remove this conditional and use YAML.safe_load_file only
337
+ if YAML.respond_to?(:safe_load_file)
338
+ YAML.safe_load_file(file_path, aliases: true)
339
+ else
340
+ YAML.load_file(file_path)
341
+ end
342
+ end
343
+
331
344
  def node_classes_for_environment_and_hosting(environment, hosting)
332
345
  govuk_puppet_node_class_data(
333
346
  environment,
@@ -664,7 +677,7 @@ class GovukConnect::CLI
664
677
  info EXAMPLES
665
678
  print_empty_line
666
679
  info bold("CONNECTION TYPES")
667
- types.keys.each do |x|
680
+ types.each_key do |x|
668
681
  info " #{x}"
669
682
  description = CONNECTION_TYPE_DESCRIPTIONS[x]
670
683
  info " #{description}" if description
@@ -966,7 +979,7 @@ class GovukConnect::CLI
966
979
  warn @option_parser.help
967
980
 
968
981
  warn "\nValid connection types are:\n"
969
- types.keys.each do |x|
982
+ types.each_key do |x|
970
983
  warn " - #{x}"
971
984
  end
972
985
  print_empty_line
@@ -982,7 +995,7 @@ class GovukConnect::CLI
982
995
  error "error: unknown connection type: #{type}\n"
983
996
 
984
997
  warn "Valid connection types are:\n"
985
- types.keys.each do |x|
998
+ types.each_key do |x|
986
999
  warn " - #{x}"
987
1000
  end
988
1001
  print_empty_line
@@ -1004,7 +1017,7 @@ class GovukConnect::CLI
1004
1017
  error "error: unknown environment '#{environment}'"
1005
1018
  print_empty_line
1006
1019
  info "Valid environments are:"
1007
- JUMPBOXES.keys.each { |e| info " - #{e}" }
1020
+ JUMPBOXES.each_key { |e| info " - #{e}" }
1008
1021
  exit 1
1009
1022
  end
1010
1023
 
@@ -1,3 +1,3 @@
1
1
  module GovukConnect
2
- VERSION = "0.5.2".freeze
2
+ VERSION = "0.6.0".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: govuk-connect
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Government Digital Service
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-07-13 00:00:00.000000000 Z
11
+ date: 2022-02-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: climate_control
@@ -56,16 +56,16 @@ dependencies:
56
56
  name: rubocop-govuk
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - '='
60
60
  - !ruby/object:Gem::Version
61
- version: 3.17.0
61
+ version: 4.3.0
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - '='
67
67
  - !ruby/object:Gem::Version
68
- version: 3.17.0
68
+ version: 4.3.0
69
69
  description: Command line tool to connect to GOV.UK infrastructure
70
70
  email:
71
71
  - govuk-dev@digital.cabinet-office.gov.uk
@@ -90,14 +90,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
90
90
  requirements:
91
91
  - - ">="
92
92
  - !ruby/object:Gem::Version
93
- version: '2.5'
93
+ version: '2.6'
94
94
  required_rubygems_version: !ruby/object:Gem::Requirement
95
95
  requirements:
96
96
  - - ">="
97
97
  - !ruby/object:Gem::Version
98
98
  version: '0'
99
99
  requirements: []
100
- rubygems_version: 3.0.3.1
100
+ rubygems_version: 3.3.7
101
101
  signing_key:
102
102
  specification_version: 4
103
103
  summary: govuk-connect command line tool