marionetta 0.4.5 → 0.4.6
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.
- data/README.md +10 -0
- data/lib/marionetta/group.rb +9 -4
- data/lib/marionetta/manipulators/deployer.rb +12 -1
- data/lib/marionetta/manipulators/puppet_manipulator.rb +2 -2
- data/lib/marionetta/manipulators.rb +2 -2
- data/lib/marionetta/rake_helper.rb +22 -1
- data/lib/marionetta.rb +5 -2
- data/spec/puppet_manipulator_spec.rb +2 -2
- data/spec/rake_helper_spec.rb +14 -2
- metadata +2 -2
data/README.md
CHANGED
@@ -164,6 +164,16 @@ Oh and you can rollback to the last release too!
|
|
164
164
|
staging.manipulate_each_server(:deployer, :rollback)
|
165
165
|
```
|
166
166
|
|
167
|
+
## Upcoming
|
168
|
+
|
169
|
+
- Remove rollback feature... we don't need rollbacks IMO. (v0.5.x)
|
170
|
+
- Remove Marionetta::Manipulators::Debloyer (v0.5.x)
|
171
|
+
- Output deploy excludes to tmp file for use with rsync --exclude-from (v0.4.x)
|
172
|
+
- Add clean up for deployments (v0.4.x)
|
173
|
+
- Add puppet safe-upgrade ability (v0.4.x)
|
174
|
+
- Use rye for commands (https://github.com/delano/rye) (v0.5.x)
|
175
|
+
- Use a single SSH connection per task (v0.5.x)
|
176
|
+
|
167
177
|
## Author
|
168
178
|
|
169
179
|
Luke Morton a.k.a. DrPheltRight
|
data/lib/marionetta/group.rb
CHANGED
@@ -65,7 +65,8 @@ module Marionetta
|
|
65
65
|
# Get servers in this group and all descendant groups.
|
66
66
|
#
|
67
67
|
def servers()
|
68
|
-
servers
|
68
|
+
servers = []
|
69
|
+
servers.concat(@servers)
|
69
70
|
|
70
71
|
@groups.each do |g|
|
71
72
|
servers.concat(g.servers)
|
@@ -113,16 +114,20 @@ module Marionetta
|
|
113
114
|
# If block passed in then the server and return value for
|
114
115
|
# each server will be passed in when complete.
|
115
116
|
#
|
116
|
-
def manipulate_each_server(
|
117
|
+
def manipulate_each_server(manipulator_class, method_name)
|
117
118
|
each_server do |s|
|
118
|
-
|
119
|
+
if manipulator_class.is_a? Symbol
|
120
|
+
manipulator_class = Manipulators[manipulator_class]
|
121
|
+
end
|
122
|
+
|
123
|
+
manipulator = manipulator_class.new(s)
|
119
124
|
|
120
125
|
if manipulator.can?
|
121
126
|
return_val = manipulator.method(method_name).call()
|
122
127
|
yield s, return_val if block_given?
|
123
128
|
else
|
124
129
|
s[:logger].warn(
|
125
|
-
"Could not Manipulators[:#{
|
130
|
+
"Could not Manipulators[:#{manipulator.class.name}].#{method_name}()")
|
126
131
|
end
|
127
132
|
end
|
128
133
|
end
|
@@ -172,7 +172,18 @@ module Marionetta
|
|
172
172
|
end
|
173
173
|
|
174
174
|
def create_release_name()
|
175
|
-
timestamp
|
175
|
+
name = timestamp
|
176
|
+
|
177
|
+
if server[:deployer].has_key?(:version)
|
178
|
+
version_cmd = server[:deployer][:version][:command]
|
179
|
+
|
180
|
+
cmd.system("cd #{from_dir} && #{version_cmd}") do |stdout|
|
181
|
+
version = stdout.read.strip
|
182
|
+
name << "_#{version}" unless version.empty?
|
183
|
+
end
|
184
|
+
end
|
185
|
+
|
186
|
+
return name
|
176
187
|
end
|
177
188
|
|
178
189
|
def rsync_exclude_flags(exclude_files)
|
@@ -22,6 +22,27 @@ module Marionetta
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
+
def install_group_task(group, manipulation, task_deps = [])
|
26
|
+
groups = [group]
|
27
|
+
|
28
|
+
group.groups.each do |g|
|
29
|
+
groups << g
|
30
|
+
end
|
31
|
+
|
32
|
+
manipulator, method_name = manipulation
|
33
|
+
|
34
|
+
groups.each do |g|
|
35
|
+
class_name = manipulator.name.split('::').last.downcase
|
36
|
+
task_desc = task_desc(g, class_name, method_name)
|
37
|
+
task_name = task_name(g, class_name, method_name)
|
38
|
+
|
39
|
+
desc(task_desc)
|
40
|
+
task(task_name => task_deps) do
|
41
|
+
g.manipulate_each_server(manipulator, method_name)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
25
46
|
private
|
26
47
|
|
27
48
|
def install_group_tasks_for(group)
|
@@ -47,4 +68,4 @@ module Marionetta
|
|
47
68
|
"#{method_name} #{manipulator_name} on #{group.name} (marionetta)"
|
48
69
|
end
|
49
70
|
end
|
50
|
-
end
|
71
|
+
end
|
data/lib/marionetta.rb
CHANGED
@@ -27,7 +27,7 @@
|
|
27
27
|
#
|
28
28
|
module Marionetta
|
29
29
|
|
30
|
-
VERSION = '0.4.
|
30
|
+
VERSION = '0.4.6'
|
31
31
|
|
32
32
|
### Defining Servers
|
33
33
|
|
@@ -75,7 +75,10 @@ module Marionetta
|
|
75
75
|
:puppet => {},
|
76
76
|
|
77
77
|
:deployer => {
|
78
|
-
:tmp => '/tmp'
|
78
|
+
:tmp => '/tmp',
|
79
|
+
:version => {
|
80
|
+
:command => "git log --pretty=format:'%h' -n 1",
|
81
|
+
}
|
79
82
|
},
|
80
83
|
|
81
84
|
:debloyer => {
|
@@ -1,8 +1,8 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
require_relative '../lib/marionetta/manipulators/puppet_manipulator'
|
3
3
|
|
4
|
-
describe Marionetta::Manipulators::
|
4
|
+
describe Marionetta::Manipulators::Puppet do
|
5
5
|
it 'should manipulate one server map' do
|
6
|
-
Marionetta::Manipulators::
|
6
|
+
Marionetta::Manipulators::Puppet.new(server).update
|
7
7
|
end
|
8
8
|
end
|
data/spec/rake_helper_spec.rb
CHANGED
@@ -7,11 +7,23 @@ describe Marionetta::RakeHelper do
|
|
7
7
|
vagrant = Marionetta::Group.new(:vagrant)
|
8
8
|
vagrant.add_server(server)
|
9
9
|
|
10
|
-
Marionetta::RakeHelper.install_group_tasks(vagrant)
|
10
|
+
# Marionetta::RakeHelper.install_group_tasks(vagrant)
|
11
|
+
|
12
|
+
task(:help) do; p 'ey'; end
|
13
|
+
|
14
|
+
Marionetta::RakeHelper.install_group_task(
|
15
|
+
vagrant,
|
16
|
+
[Marionetta::Manipulators::Deployer, :deploy],
|
17
|
+
[:help])
|
18
|
+
|
19
|
+
Marionetta::RakeHelper.install_group_task(
|
20
|
+
vagrant,
|
21
|
+
[Marionetta::Manipulators::Puppet, :update])
|
22
|
+
|
11
23
|
Rake::Task.tasks.count.should > 0
|
12
24
|
|
13
25
|
Rake::Task['puppet:vagrant:update'].invoke
|
14
26
|
Rake::Task['deployer:vagrant:deploy'].invoke
|
15
|
-
Rake::Task['deployer:vagrant:rollback'].invoke
|
27
|
+
# Rake::Task['deployer:vagrant:rollback'].invoke
|
16
28
|
end
|
17
29
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: marionetta
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-02-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: open4
|