dash 4.0.5 → 4.0.7

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ee8ed58f4d81341ced43dc7d970c081a4c92becc3492860cf3ec8fd1a80687ec
4
- data.tar.gz: 588e1b33ca3f041a54beb773472cab9b8144892a32972b71ae9c58306cbb8612
3
+ metadata.gz: d13e0fdb207715506d85fa85be2a719ca70640130f22ca948c075fd787b3dd88
4
+ data.tar.gz: cc42a4346178f4ffbcf7b7b2f03820e49f99e9d54c78ab864493a0c0b8b214e4
5
5
  SHA512:
6
- metadata.gz: b24d5758340f3e3b7b7b6ecf1df765ffabab7360ddd5bc0df99dad3b90ba3662fc65dcbbe6bfa99af29dea90efb977f4b3d5a2d68454c1e652d57602857f9166
7
- data.tar.gz: bbc5bfea941e10310fd01776548b462e9e0e82d4228ed25bb66a0c16b35083979473cb2232ccb7bab3820ccaa45ae32303f424ffebfe76ac321b84354c54cf2e
6
+ metadata.gz: cdf2135081cc1acc7de1d73d7c7156f93262ad82a5848a6db6aaf484bf4859ed3e529fede60ac0c67df99ec021acdd2cbf6a9175982af8f31873afa03cc2113b
7
+ data.tar.gz: 30eae7e9f41f2b216be4dd8d16ce583f5a8e2392d3b05b3ad15fcd4ba40645441c05c39a643cca2bf01876ee28aec2fa668a7ffe2a474e27c69b46edc341dbc6
@@ -113,7 +113,12 @@ class Dash::Cli::Doctor::HostChecks
113
113
  elsif version.nil?
114
114
  result :proxy_version, :ok, "not running (will be started on deploy)"
115
115
  elsif Dash::Utils.older_version?(version, minimum)
116
- result :proxy_version, :fail, "#{version} is older than the minimum #{minimum}, run `dash proxy reboot` to update"
116
+ if deploy_reboots_proxy?
117
+ result :proxy_version, :ok,
118
+ "#{version} is older than the minimum #{minimum}; the next deploy reboots the proxy to update it"
119
+ else
120
+ result :proxy_version, :fail, "#{version} is older than the minimum #{minimum}, run `dash proxy reboot` to update"
121
+ end
117
122
  else
118
123
  result :proxy_version, :ok, "#{version} (minimum #{minimum})"
119
124
  end
@@ -121,6 +126,18 @@ class Dash::Cli::Doctor::HostChecks
121
126
  result :proxy_version, :warn, "running image tag #{version} is not a version number"
122
127
  end
123
128
 
129
+ # Mirrors `proxy boot`: with reboot_on_deploy enabled it reboots a drifted
130
+ # proxy on its own, and a MINIMUM_VERSION bump moves the expected config
131
+ # digest, so a merely-stale proxy is converged by the very deploy this
132
+ # doctor gates. Only a version the deploy would not touch — pinned in the
133
+ # config, or with automatic reboots disabled — is a real failure. Any error
134
+ # probing drift falls back to the conservative answer.
135
+ def deploy_reboots_proxy?
136
+ DASH.config.proxy.reboot_on_deploy? && Dash::Cli::Proxy::Drift.new(host, sshkit).drifted?
137
+ rescue StandardError
138
+ false
139
+ end
140
+
124
141
  # What a container path has to look like to count as a container runtime
125
142
  # socket when the config no longer names one.
126
143
  DOCKER_SOCKET_PATTERN = %r{docker\.sock\z}
@@ -4,6 +4,7 @@ class Dash::Configuration::Registry
4
4
  def initialize(config:, secrets:, context: "registry")
5
5
  @registry_config = config["registry"] || {}
6
6
  @secrets = secrets
7
+ @context = context
7
8
  validate! registry_config, context: context, with: Dash::Configuration::Validator::Registry
8
9
  end
9
10
 
@@ -28,13 +29,33 @@ class Dash::Configuration::Registry
28
29
  end
29
30
 
30
31
  private
31
- attr_reader :registry_config, :secrets
32
+ attr_reader :registry_config, :secrets, :context
32
33
 
34
+ # A blank credential would reach the remote host as an empty `docker login -p`,
35
+ # where docker falls back to prompting and dies with the opaque "Cannot perform
36
+ # an interactive login from a non TTY device" — fail locally instead.
33
37
  def lookup(key)
38
+ value =
39
+ if registry_config[key].is_a?(Array)
40
+ secrets[registry_config[key].first]
41
+ else
42
+ registry_config[key]
43
+ end
44
+
45
+ validate_present! key, value unless local?
46
+ value
47
+ end
48
+
49
+ def validate_present!(key, value)
50
+ return if value.present?
51
+
34
52
  if registry_config[key].is_a?(Array)
35
- secrets[registry_config[key].first]
53
+ secret = registry_config[key].first
54
+ raise Dash::ConfigurationError,
55
+ "#{context}/#{key}: secret '#{secret}' resolved to an empty value — " \
56
+ "if your secrets file forwards it from the environment (#{secret}=$#{secret}), export the variable before running dash"
36
57
  else
37
- registry_config[key]
58
+ raise Dash::ConfigurationError, "#{context}/#{key}: is blank"
38
59
  end
39
60
  end
40
61
  end
data/lib/dash/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Dash
2
- VERSION = "4.0.5"
2
+ VERSION = "4.0.7"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dash
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.5
4
+ version: 4.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mikael Henriksson