Skip to content

Commit a0f44d2

Browse files
committed
update
1 parent ddb1ef7 commit a0f44d2

File tree

4 files changed

+17
-13
lines changed

4 files changed

+17
-13
lines changed

Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: .
33
specs:
4-
dry-stack (0.1.42)
4+
dry-stack (0.1.43)
55

66
GEM
77
remote: https://rubygems.org/

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ This gem allows ...
66
cat simple_stack.drs | dry-stack -e to_compose | docker stack deploy -c - simple_stack
77
88
$ dry-stack
9-
Version: 0.1.42
9+
Version: 0.1.43
1010
Usage:
1111
dry-stack -s stackfile [options] COMMAND
1212
cat stackfile | dry-stack COMMAND

lib/dry-stack/command_swarm_deploy.rb

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ def run(stack, params, args, extra)
5858
exec_i "docker --context #{name} config create #{stack.name}_readme -", stack.description
5959
deploy_status = 'deployed'
6060
ensure
61-
if ENV['DEPLOY_REGISTRY'] || ENV['CI_DEPLOY_REGISTRY']
62-
deploy_registry = ENV['DEPLOY_REGISTRY'] || ENV['CI_DEPLOY_REGISTRY']
61+
if ENV['CI_DEPLOY_REGISTRY']
62+
deploy_registry = ENV['CI_DEPLOY_REGISTRY']
6363
puts "Sending deploy status to #{deploy_registry}"
6464
data = {
6565
deploy_host: endpoint,
@@ -70,16 +70,20 @@ def run(stack, params, args, extra)
7070
stack: YAML.load(yaml, aliases: true)
7171
}
7272

73-
uri = URI("#{deploy_registry}/api/v1/swarm_deploy")
74-
http = Net::HTTP.new(uri.host, uri.port)
75-
http.use_ssl = uri.scheme == 'https'
73+
begin
74+
uri = URI("#{deploy_registry}/api/v1/swarm_deploy")
75+
http = Net::HTTP.new(uri.host, uri.port)
76+
http.use_ssl = uri.scheme == 'https'
7677

77-
request = Net::HTTP::Post.new(uri)
78-
request['Content-Type'] = 'application/json'
79-
request.body = data.to_json
78+
request = Net::HTTP::Post.new(uri)
79+
request['Content-Type'] = 'application/json'
80+
request.body = data.to_json
8081

81-
response = http.request(request)
82-
puts "POST Return value: #{response.code}"
82+
response = http.request(request)
83+
puts "POST Return value: #{response.code}"
84+
rescue => e
85+
puts "Error: #{e.message}"
86+
end
8387
end
8488
end
8589
end

lib/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module Dry
22
class Stack
3-
VERSION = '0.1.42'
3+
VERSION = '0.1.43'
44
end
55
end

0 commit comments

Comments
 (0)