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 CHANGED
@@ -1 +1 @@
1
- 1.1.7
1
+ 1.1.9
@@ -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
- logger.important "uploading deploy logs: #{log_path}/#{application}-#{ENV["AO_USER"]}.log-#{Time.now.strftime('%Y%m%d-%H%M')}"
653
- put full_log, "#{log_path}/#{application}-#{ENV["AO_USER"]}.log-#{Time.now.strftime('%Y%m%d-%H%M')}"
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
@@ -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
- config.task "#{pod_name}" do # task pod1
64
- set :current_pod, pod_name
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 -> host.current_pod
89
- config.after "#{task_name}", "#{task_name}.#{current_pod}"
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
- nodes.keys.sort.each do |remote_name|
97
- config.after "#{task_name}.#{pod_name}", "#{remote_name}"
98
- end
110
+ %w(app echo yaml).each do |tsuffix|
111
+ config.task "#{task_name}.#{pod_name}.#{tsuffix}" do
112
+ end
99
113
 
100
- config.task "#{task_name}" do
101
- config.after "#{task_name}", "#{task_name}.#{current_pod}"
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
@@ -16,6 +16,7 @@ source "$shome/sbin/_treadstone"
16
16
 
17
17
  # entry point
18
18
  function main {
19
+ set -- $(for a in "$@"; do echo $a.app; done)
19
20
  bundle exec cap "$@" deploy:lock deploy:symlink deploy:restart
20
21
  }
21
22
 
@@ -16,6 +16,7 @@ source "$shome/sbin/_treadstone"
16
16
 
17
17
  # entry point
18
18
  function main {
19
+ set -- $(for a in "$@"; do echo $a.app; done)
19
20
  bundle exec cap "$@" deploy:lock deploy:build
20
21
  }
21
22
 
@@ -16,6 +16,7 @@ source "$shome/sbin/_treadstone"
16
16
 
17
17
  # entry point
18
18
  function main {
19
+ set -- $(for a in "$@"; do echo $a.app; done)
19
20
  bundle exec cap "$@" deploy:lock deploy:check
20
21
  }
21
22
 
@@ -16,6 +16,7 @@ source "$shome/sbin/_treadstone"
16
16
 
17
17
  # entry point
18
18
  function main {
19
+ set -- $(for a in "$@"; do echo $a.app; done)
19
20
  bundle exec cap "$@" deploy:lock_compare deploy:compare
20
21
  }
21
22
 
@@ -16,6 +16,7 @@ source "$shome/sbin/_treadstone"
16
16
 
17
17
  # entry point
18
18
  function main {
19
+ set -- $(for a in "$@"; do echo $a.app; done)
19
20
  bundle exec cap "$@" deploy:lock deploy:cook
20
21
  }
21
22
 
@@ -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" "$@"
@@ -16,6 +16,7 @@ source "$shome/sbin/_treadstone"
16
16
 
17
17
  # entry point
18
18
  function main {
19
+ set -- $(for a in "$@"; do echo $a.app; done)
19
20
  bundle exec cap "$@" deploy:lock deploy
20
21
  }
21
22
 
@@ -16,6 +16,7 @@ source "$shome/sbin/_treadstone"
16
16
 
17
17
  # entry point
18
18
  function main {
19
+ set -- $(for a in "$@"; do echo $a.app; done)
19
20
  bundle exec cap "$@" deploy:lock deploy:dist
20
21
  }
21
22
 
@@ -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" "$@"
@@ -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" "$@"
@@ -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
@@ -16,6 +16,7 @@ source "$shome/sbin/_treadstone"
16
16
 
17
17
  # entry point
18
18
  function main {
19
+ set -- $(for a in "$@"; do echo $a.app; done)
19
20
  bundle exec cap "$@" deploy:lock_migrate deploy:migrate
20
21
  }
21
22
 
@@ -16,6 +16,7 @@ source "$shome/sbin/_treadstone"
16
16
 
17
17
  # entry point
18
18
  function main {
19
+ set -- $(for a in "$@"; do echo $a.app; done)
19
20
  bundle exec cap "$@" deploy:lock deploy:plan
20
21
  }
21
22
 
@@ -16,6 +16,7 @@ source "$shome/sbin/_treadstone"
16
16
 
17
17
  # entry point
18
18
  function main {
19
+ set -- $(for a in "$@"; do echo $a.app; done)
19
20
  bundle exec cap "$@" deploy:lock deploy
20
21
  }
21
22
 
@@ -16,6 +16,7 @@ source "$shome/sbin/_treadstone"
16
16
 
17
17
  # entry point
18
18
  function main {
19
+ set -- $(for a in "$@"; do echo $a.app; done)
19
20
  bundle exec cap "$@" deploy:lock deploy:restart
20
21
  }
21
22
 
@@ -16,6 +16,7 @@ source "$shome/sbin/_treadstone"
16
16
 
17
17
  # entry point
18
18
  function main {
19
+ set -- $(for a in "$@"; do echo $a.app; done)
19
20
  bundle exec cap "$@" deploy:lock deploy:rollback
20
21
  }
21
22
 
@@ -16,6 +16,7 @@ source "$shome/sbin/_treadstone"
16
16
 
17
17
  # entry point
18
18
  function main {
19
+ set -- $(for a in "$@"; do echo $a.app; done)
19
20
  bundle exec cap "$@" shell
20
21
  }
21
22
 
@@ -16,6 +16,7 @@ source "$shome/sbin/_treadstone"
16
16
 
17
17
  # entry point
18
18
  function main {
19
+ set -- $(for a in "$@"; do echo $a.app; done)
19
20
  bundle exec cap "$@" deploy:lock deploy:update_code deploy:symlink_next
20
21
  }
21
22
 
@@ -17,6 +17,7 @@ source "$shome/sbin/_treadstone"
17
17
  # entry point
18
18
  function main {
19
19
  local nm_task=$1; shift
20
+ set -- $(for a in "$@"; do echo $a.app; done)
20
21
  bundle exec cap "$@" deploy:lock_migrate deploy:migrate "$nm_task"
21
22
  }
22
23
 
@@ -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.7
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