alpha_omega 1.1.7 → 1.1.9
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/alpha_omega/deploy.rb +4 -2
- data/lib/alpha_omega/utils.rb +29 -10
- data/libexec/ao-activate +1 -0
- data/libexec/ao-build +1 -0
- data/libexec/ao-check +1 -0
- data/libexec/ao-compare +1 -0
- data/libexec/ao-cook +1 -0
- data/libexec/ao-debug +28 -0
- data/libexec/ao-deploy +1 -0
- data/libexec/ao-dist +1 -0
- data/libexec/ao-dna +29 -0
- data/libexec/ao-hosts +28 -0
- data/libexec/ao-lock +2 -0
- data/libexec/ao-migrate +1 -0
- data/libexec/ao-plan +1 -0
- data/libexec/ao-release +1 -0
- data/libexec/ao-restart +1 -0
- data/libexec/ao-rollback +1 -0
- data/libexec/ao-shell +1 -0
- data/libexec/ao-stage +1 -0
- data/libexec/ao-task +1 -0
- data/libexec/ao-unlock +2 -0
- metadata +4 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.1.
|
1
|
+
1.1.9
|
data/lib/alpha_omega/deploy.rb
CHANGED
@@ -649,8 +649,10 @@ Capistrano::Configuration.instance(:must_exist).load do |config|
|
|
649
649
|
after "deploy:build", "assets:build"
|
650
650
|
|
651
651
|
on :exit do
|
652
|
-
|
653
|
-
|
652
|
+
unless ENV['LOCAL_ONLY'] && !ENV['LOCAL_ONLY'].empty?
|
653
|
+
logger.important "uploading deploy logs: #{log_path}/#{application}-#{ENV["AO_USER"]}.log-#{Time.now.strftime('%Y%m%d-%H%M')}"
|
654
|
+
put full_log, "#{log_path}/#{application}-#{ENV["AO_USER"]}.log-#{Time.now.strftime('%Y%m%d-%H%M')}"
|
655
|
+
end
|
654
656
|
end
|
655
657
|
|
656
658
|
end # Capistrano::Configuratioy
|
data/lib/alpha_omega/utils.rb
CHANGED
@@ -6,6 +6,7 @@ $this_pod = nil
|
|
6
6
|
$this_host = nil
|
7
7
|
$opsdb = nil
|
8
8
|
$pods_config = nil
|
9
|
+
$magic_prefix = "eea914aaa8dde6fdae29242b1084a2b0415eefaf"
|
9
10
|
|
10
11
|
module AlphaOmega
|
11
12
|
def self.node_defaults(node, env_pod, node_name)
|
@@ -60,8 +61,11 @@ module AlphaOmega
|
|
60
61
|
|
61
62
|
def self.default_pods_tasks
|
62
63
|
Proc.new do |config, pod_name, pod, this_node, &node_filter|
|
63
|
-
|
64
|
-
|
64
|
+
%w(app echo yaml).each do |tsuffix|
|
65
|
+
# each pod task sets the pod context for host/group tasks
|
66
|
+
config.task "#{pod_name}.#{tsuffix}" do # task pod1
|
67
|
+
set :current_pod, pod_name
|
68
|
+
end
|
65
69
|
end
|
66
70
|
|
67
71
|
node_dna = { }
|
@@ -75,7 +79,7 @@ module AlphaOmega
|
|
75
79
|
next nil unless cap_roles
|
76
80
|
config.set :dna, node_dna[remote_name]
|
77
81
|
|
78
|
-
config.task "#{task_name}.#{pod_name}" do # task host.pod1
|
82
|
+
config.task "#{task_name}.#{pod_name}.app" do # task host.pod1.app
|
79
83
|
cap_roles.each do |cap_role, cap_preds|
|
80
84
|
if $this_host["local_pods"] && $this_host["local_pods"].member?(node["env_pod"])
|
81
85
|
role cap_role, node["node_name"], cap_preds
|
@@ -85,20 +89,35 @@ module AlphaOmega
|
|
85
89
|
end
|
86
90
|
end
|
87
91
|
|
88
|
-
config.task "#{task_name}" do # task host
|
89
|
-
|
92
|
+
config.task "#{task_name}.#{pod_name}.echo" do # task host.pod1.echo
|
93
|
+
puts "#{$magic_prefix} #{remote_name}"
|
94
|
+
end
|
95
|
+
|
96
|
+
config.task "#{task_name}.#{pod_name}.yaml" do # task host.pod1.yaml
|
97
|
+
StringIO.new({ remote_name => n }.to_yaml).lines.to_a[1..-1].each {|l| puts "#{$magic_prefix} #{l}" }
|
98
|
+
end
|
99
|
+
|
100
|
+
%w(app echo yaml).each do |tsuffix|
|
101
|
+
config.task "#{task_name}.#{tsuffix}" do # task host -> host.current_pod
|
102
|
+
config.after "#{task_name}.#{tsuffix}", "#{task_name}.#{current_pod}.#{tsuffix}"
|
103
|
+
end
|
90
104
|
end
|
91
105
|
|
92
106
|
n
|
93
107
|
end
|
94
108
|
|
95
109
|
self.what_groups hosts do |task_name, nodes|
|
96
|
-
|
97
|
-
config.
|
98
|
-
|
110
|
+
%w(app echo yaml).each do |tsuffix|
|
111
|
+
config.task "#{task_name}.#{pod_name}.#{tsuffix}" do
|
112
|
+
end
|
99
113
|
|
100
|
-
|
101
|
-
|
114
|
+
nodes.keys.sort.each do |remote_name|
|
115
|
+
config.after "#{task_name}.#{pod_name}.#{tsuffix}", "#{remote_name}.#{tsuffix}"
|
116
|
+
end
|
117
|
+
|
118
|
+
config.task "#{task_name}.#{tsuffix}" do
|
119
|
+
config.after "#{task_name}.#{tsuffix}", "#{task_name}.#{current_pod}.#{tsuffix}"
|
120
|
+
end
|
102
121
|
end
|
103
122
|
end
|
104
123
|
end
|
data/libexec/ao-activate
CHANGED
data/libexec/ao-build
CHANGED
data/libexec/ao-check
CHANGED
data/libexec/ao-compare
CHANGED
data/libexec/ao-cook
CHANGED
data/libexec/ao-debug
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
#/ NAME
|
4
|
+
#/ ao-debug -- same as ao-hosts with debugging left on
|
5
|
+
#/
|
6
|
+
#/ SYNOPSIS
|
7
|
+
#/ ao debug [deploy_set...]
|
8
|
+
|
9
|
+
# figure out the project root under which bin, lib live
|
10
|
+
shome="$(cd -P -- "$(dirname -- "$BASH_SOURCE")/.." && pwd -P)"
|
11
|
+
|
12
|
+
# load a jason bourne library
|
13
|
+
source "$shome/sbin/_treadstone"
|
14
|
+
|
15
|
+
# parse the command-line
|
16
|
+
|
17
|
+
# entry point
|
18
|
+
function main {
|
19
|
+
export LOCAL_ONLY=true
|
20
|
+
{
|
21
|
+
if [[ -n $1 ]]; then
|
22
|
+
set -- $(for a in "$@"; do echo $a.echo; done)
|
23
|
+
cap "$@"
|
24
|
+
fi
|
25
|
+
} 2>&1 | grep eea914aaa8dde6fdae29242b1084a2b0415eefaf | awk '{print $NF}' | sort -u
|
26
|
+
}
|
27
|
+
|
28
|
+
require 'sub' "$BASH_SOURCE" "$@"
|
data/libexec/ao-deploy
CHANGED
data/libexec/ao-dist
CHANGED
data/libexec/ao-dna
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
#/ NAME
|
4
|
+
#/ ao-dna -- dumps opsdb yaml
|
5
|
+
#/
|
6
|
+
#/ SYNOPSIS
|
7
|
+
#/ ao dna [deploy_set...]
|
8
|
+
|
9
|
+
# figure out the project root under which bin, lib live
|
10
|
+
shome="$(cd -P -- "$(dirname -- "$BASH_SOURCE")/.." && pwd -P)"
|
11
|
+
|
12
|
+
# load a jason bourne library
|
13
|
+
source "$shome/sbin/_treadstone"
|
14
|
+
|
15
|
+
# parse the command-line
|
16
|
+
|
17
|
+
# entry point
|
18
|
+
function main {
|
19
|
+
export LOCAL_ONLY=true
|
20
|
+
{
|
21
|
+
echo "eea914aaa8dde6fdae29242b1084a2b0415eefaf ---"
|
22
|
+
if [[ -n $1 ]]; then
|
23
|
+
set -- $(for a in "$@"; do echo $a.yaml; done)
|
24
|
+
cap "$@"
|
25
|
+
fi
|
26
|
+
} 2>&1 | grep eea914aaa8dde6fdae29242b1084a2b0415eefaf | sed 's#eea914aaa8dde6fdae29242b1084a2b0415eefaf ##'
|
27
|
+
}
|
28
|
+
|
29
|
+
require 'sub' "$BASH_SOURCE" "$@"
|
data/libexec/ao-hosts
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
#/ NAME
|
4
|
+
#/ ao-hosts -- list of opsdb hosts filtered through Capfile
|
5
|
+
#/
|
6
|
+
#/ SYNOPSIS
|
7
|
+
#/ ao hosts [deploy_set...]
|
8
|
+
|
9
|
+
# figure out the project root under which bin, lib live
|
10
|
+
shome="$(cd -P -- "$(dirname -- "$BASH_SOURCE")/.." && pwd -P)"
|
11
|
+
|
12
|
+
# load a jason bourne library
|
13
|
+
source "$shome/sbin/_treadstone"
|
14
|
+
|
15
|
+
# parse the command-line
|
16
|
+
|
17
|
+
# entry point
|
18
|
+
function main {
|
19
|
+
export LOCAL_ONLY=true
|
20
|
+
{
|
21
|
+
if [[ -n $1 ]]; then
|
22
|
+
set -- $(for a in "$@"; do echo $a.echo; done)
|
23
|
+
cap "$@"
|
24
|
+
fi
|
25
|
+
} 2>&1 | grep eea914aaa8dde6fdae29242b1084a2b0415eefaf | awk '{print $NF}' | sort -u
|
26
|
+
}
|
27
|
+
|
28
|
+
require 'sub' "$BASH_SOURCE" "$@"
|
data/libexec/ao-lock
CHANGED
@@ -20,9 +20,11 @@ function main {
|
|
20
20
|
case "${1}" in
|
21
21
|
compare|migrate)
|
22
22
|
nm_lock="${1}"; shift
|
23
|
+
set -- $(for a in "$@"; do echo $a.app; done)
|
23
24
|
bundle exec cap "$@" deploy:dont_unlock "deploy:lock_${nm_lock}"
|
24
25
|
;;
|
25
26
|
*)
|
27
|
+
set -- $(for a in "$@"; do echo $a.app; done)
|
26
28
|
bundle exec cap "$@" deploy:dont_unlock deploy:lock
|
27
29
|
;;
|
28
30
|
esac
|
data/libexec/ao-migrate
CHANGED
data/libexec/ao-plan
CHANGED
data/libexec/ao-release
CHANGED
data/libexec/ao-restart
CHANGED
data/libexec/ao-rollback
CHANGED
data/libexec/ao-shell
CHANGED
data/libexec/ao-stage
CHANGED
data/libexec/ao-task
CHANGED
data/libexec/ao-unlock
CHANGED
@@ -20,9 +20,11 @@ function main {
|
|
20
20
|
case "${1}" in
|
21
21
|
compare|migrate)
|
22
22
|
nm_lock="${1}"; shift
|
23
|
+
set -- $(for a in "$@"; do echo $a.app; done)
|
23
24
|
bundle exec cap "$@" "deploy:unlock_${nm_lock}"
|
24
25
|
;;
|
25
26
|
*)
|
27
|
+
set -- $(for a in "$@"; do echo $a.app; done)
|
26
28
|
bundle exec cap "$@" deploy:unlock
|
27
29
|
;;
|
28
30
|
esac
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: alpha_omega
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.9
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -110,8 +110,11 @@ files:
|
|
110
110
|
- libexec/ao-check
|
111
111
|
- libexec/ao-compare
|
112
112
|
- libexec/ao-cook
|
113
|
+
- libexec/ao-debug
|
113
114
|
- libexec/ao-deploy
|
114
115
|
- libexec/ao-dist
|
116
|
+
- libexec/ao-dna
|
117
|
+
- libexec/ao-hosts
|
115
118
|
- libexec/ao-lock
|
116
119
|
- libexec/ao-migrate
|
117
120
|
- libexec/ao-plan
|