govuk-connect 0.5.1 → 0.7.0
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/govuk_connect/cli.rb +24 -11
- data/lib/govuk_connect/version.rb +1 -1
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0cec686de41c55db9dbb4d680aa596cdb8ac039845011bb4aa435b94eb3f4e9f
|
4
|
+
data.tar.gz: bb8eb071164ade05f8dbbe1e2e3bc780ea883dc848b384de14f2ea795d5920f3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 35f339438073571faee19d7da1a8d191d15a8cd389b3786f686c1ab59e3c3e0a23bddd5948135578b5cc87572d971c896c4c4feb0287e0c2b2acfa3e79c16da2
|
7
|
+
data.tar.gz: 7b50c8d20288f0206dc8d312f8f4c05b0f0763c1437726865af18c2cf7f0ceaebeb1a99135044a3cd1f49d4be548c7327a6d784b0b16031114cef6ad446f4102
|
data/lib/govuk_connect/cli.rb
CHANGED
@@ -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 =
|
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 ||=
|
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
|
@@ -254,7 +252,7 @@ class GovukConnect::CLI
|
|
254
252
|
|
255
253
|
def govuk_node_list_classes(environment, hosting)
|
256
254
|
log "debug: looking up classes in #{hosting}/#{environment}"
|
257
|
-
classes = ssh_capture("govuk_node_list --classes").sort
|
255
|
+
classes = ssh_capture(environment, hosting, "govuk_node_list --classes").sort
|
258
256
|
|
259
257
|
log "debug: classes:"
|
260
258
|
classes.each { |c| log " - #{c}" }
|
@@ -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 =
|
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 =
|
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.
|
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.
|
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.
|
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.
|
1020
|
+
JUMPBOXES.each_key { |e| info " - #{e}" }
|
1008
1021
|
exit 1
|
1009
1022
|
end
|
1010
1023
|
|
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.
|
4
|
+
version: 0.7.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:
|
11
|
+
date: 2022-08-08 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.
|
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.
|
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.
|
93
|
+
version: '2.7'
|
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.
|
100
|
+
rubygems_version: 3.3.19
|
101
101
|
signing_key:
|
102
102
|
specification_version: 4
|
103
103
|
summary: govuk-connect command line tool
|