sous-chef 0.0.0 → 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile.lock CHANGED
@@ -1,8 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sous-chef (0.0.1)
4
+ sous-chef (0.0.0)
5
5
  knife-solo (~> 0.1.0)
6
+ rake (~> 10.0.3)
6
7
 
7
8
  GEM
8
9
  remote: http://rubygems.org/
@@ -27,6 +28,7 @@ GEM
27
28
  treetop (~> 1.4.9)
28
29
  uuidtools
29
30
  yajl-ruby (~> 1.1)
31
+ diff-lcs (1.1.3)
30
32
  erubis (2.7.0)
31
33
  highline (1.6.15)
32
34
  ipaddress (0.8.0)
@@ -63,8 +65,17 @@ GEM
63
65
  systemu
64
66
  yajl-ruby
65
67
  polyglot (0.3.3)
68
+ rake (10.0.3)
66
69
  rest-client (1.6.7)
67
70
  mime-types (>= 1.16)
71
+ rspec (2.12.0)
72
+ rspec-core (~> 2.12.0)
73
+ rspec-expectations (~> 2.12.0)
74
+ rspec-mocks (~> 2.12.0)
75
+ rspec-core (2.12.2)
76
+ rspec-expectations (2.12.1)
77
+ diff-lcs (~> 1.1.3)
78
+ rspec-mocks (2.12.1)
68
79
  systemu (2.5.2)
69
80
  thor (0.16.0)
70
81
  treetop (1.4.12)
@@ -77,4 +88,7 @@ PLATFORMS
77
88
  ruby
78
89
 
79
90
  DEPENDENCIES
91
+ bundler (~> 1.1)
92
+ rake (~> 10.0.3)
93
+ rspec (~> 2.12.0)
80
94
  sous-chef!
data/README.md ADDED
@@ -0,0 +1,18 @@
1
+ # SousChef
2
+
3
+ Manage knife-solo nodes.
4
+
5
+ ## Install
6
+
7
+ ```ruby
8
+ require 'sous-chef'
9
+ ```
10
+
11
+ ## Configure
12
+
13
+ agents.yml
14
+
15
+ ## Usage
16
+
17
+ `rake -T` for a full list of tasks provided:
18
+
@@ -0,0 +1,2 @@
1
+ require File.expand_path(File.join(File.dirname(__FILE__), '../sous-chef', 'tasks'))
2
+
@@ -0,0 +1,104 @@
1
+ require 'tempfile'
2
+ require 'yaml'
3
+
4
+ def run(command)
5
+ puts "Running: #{command}"
6
+ system command
7
+ raise "Failure! #{$?}" if $? != 0
8
+ end
9
+
10
+ def run_knife(command, node)
11
+ run "knife solo #{command} -F #{agents_ssh_config_path} #{node} -N #{node} nodes/buildAgent.json"
12
+ end
13
+
14
+ def agents
15
+ agents_path = File.join(Dir.pwd, "agents.yml")
16
+ unless File.exists? agents_path
17
+ puts "Can't find #{agents_path}"
18
+ exit 1
19
+ end
20
+ YAML.load_file(agents_path)
21
+ end
22
+
23
+ def agents_ssh_config_path
24
+ @agents_ssh_config_path ||= begin
25
+ ssh_config_file = Tempfile.new('agent_ssh_config')
26
+ agents.each do |node, attrs|
27
+ ssh_config_file.write("Host #{node}\n")
28
+ attrs.each do |key, value|
29
+ ssh_config_file.write(" #{key} #{value}\n")
30
+ end
31
+ end
32
+ ssh_config_file.close
33
+ at_exit { ssh_config_file.delete }
34
+ ssh_config_file.path
35
+ end
36
+ end
37
+
38
+ def agent_names
39
+ agents.map { |key, value| key }
40
+ end
41
+
42
+ agent_names.each do |node|
43
+ namespace node do
44
+ desc "Run knife solo prepare for #{node}"
45
+ task :prepare do
46
+ run_knife 'prepare', node
47
+ end
48
+
49
+ desc "Run knife solo cook for #{node}"
50
+ task :cook do
51
+ run_knife 'cook', node
52
+ end
53
+
54
+ desc "Run knife solo bootstrap for #{node}"
55
+ task :bootstrap do
56
+ run_knife 'bootstrap', node
57
+ end
58
+ end
59
+ end
60
+
61
+ namespace :vagrant do
62
+ def vagrant_ssh_config_path
63
+ @vagrant_ssh_config_paths ||= begin
64
+ ssh_config_file = Tempfile.new('vagrant-ssh-config')
65
+ ssh_config_file.write(`vagrant ssh-config`)
66
+ ssh_config_file.write(' LogLevel quiet')
67
+ ssh_config_file.close
68
+ ssh_config_file.path
69
+ end
70
+ end
71
+
72
+ def run_knife_vagrant(command)
73
+ run "knife solo #{command} -F #{vagrant_ssh_config_path} default nodes/buildAgent.json"
74
+ end
75
+
76
+ desc "Start the VM for the Vagrant Utility box"
77
+ task :up do
78
+ run "vagrant up"
79
+ end
80
+
81
+ desc "Prepare the Vagrant Utility box for provisioning"
82
+ task :prepare => [:up] do
83
+ run_knife_vagrant 'prepare'
84
+ end
85
+
86
+ desc "Provision the Vagrant Utility box"
87
+ task :cook do
88
+ run_knife_vagrant 'cook'
89
+ end
90
+
91
+ desc "Bootstrap (prepare & cook) the Vagrant Utility box"
92
+ task :bootstrap => [:up] do
93
+ run_knife_vagrant 'bootstrap'
94
+ end
95
+
96
+ desc "Destroy Vagrant Utility box"
97
+ task :destroy do
98
+ run "vagrant destroy -f"
99
+ end
100
+
101
+ desc "Cleans Vagrant Utility box, creating a fresh box"
102
+ task :clean => [:destroy, :up]
103
+ end
104
+
data/lib/sous-chef.rb ADDED
@@ -0,0 +1,10 @@
1
+ require 'rake'
2
+
3
+ load 'sous-chef/tasks.rb'
4
+
5
+ module SousChef
6
+ class << self
7
+ attr_accessor :agents
8
+ end
9
+ end
10
+
data/sous-chef.gemspec CHANGED
@@ -2,21 +2,27 @@
2
2
  $:.push File.expand_path("../lib", __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
- s.name = 'sous-chef'
6
- s.version = "0.0.0"
7
- s.summary = "Manage nodes"
8
- s.description = "Handles configuration and management of chef nodes"
9
-
10
5
  s.authors = "Shaun Dern"
11
6
  s.email = "shaun@substantail.com"
12
7
 
8
+ s.name = 'sous-chef'
9
+ s.version = "0.0.1"
10
+ s.description = %q{Manage knife-solo nodes}
11
+ s.summary = %q{Manage knife-solo nodes}
12
+ s.homepage = %q{http://github.com/substantial/sous-chef}
13
13
  s.rubyforge_project = "sous-chef"
14
14
 
15
+ s.license = "MIT"
16
+
15
17
  s.files = `git ls-files`.split("\n")
16
18
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
17
19
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
18
20
  s.require_paths = ["lib"]
19
21
 
22
+ s.add_runtime_dependency "rake", "~> 10.0.3"
23
+ s.add_development_dependency "rspec", "~> 2.12.0"
24
+ s.add_development_dependency "rake", "~> 10.0.3"
25
+ s.add_development_dependency "bundler", "~> 1.1"
20
26
  s.add_dependency "knife-solo", "~> 0.1.0"
21
27
 
22
28
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sous-chef
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0
4
+ version: 0.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,8 +9,72 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-23 00:00:00.000000000 Z
12
+ date: 2013-01-24 00:00:00.000000000 Z
13
13
  dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: rake
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: 10.0.3
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: 10.0.3
30
+ - !ruby/object:Gem::Dependency
31
+ name: rspec
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ~>
36
+ - !ruby/object:Gem::Version
37
+ version: 2.12.0
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: 2.12.0
46
+ - !ruby/object:Gem::Dependency
47
+ name: rake
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
53
+ version: 10.0.3
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: 10.0.3
62
+ - !ruby/object:Gem::Dependency
63
+ name: bundler
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ~>
68
+ - !ruby/object:Gem::Version
69
+ version: '1.1'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: '1.1'
14
78
  - !ruby/object:Gem::Dependency
15
79
  name: knife-solo
16
80
  requirement: !ruby/object:Gem::Requirement
@@ -27,7 +91,7 @@ dependencies:
27
91
  - - ~>
28
92
  - !ruby/object:Gem::Version
29
93
  version: 0.1.0
30
- description: Handles configuration and management of chef nodes
94
+ description: Manage knife-solo nodes
31
95
  email: shaun@substantail.com
32
96
  executables: []
33
97
  extensions: []
@@ -36,9 +100,14 @@ files:
36
100
  - .gitignore
37
101
  - Gemfile
38
102
  - Gemfile.lock
103
+ - README.md
104
+ - lib/sous-chef.rb
105
+ - lib/sous-chef/tasks.rb
106
+ - lib/sous-chef/tasks/sous-chef.rake
39
107
  - sous-chef.gemspec
40
- homepage:
41
- licenses: []
108
+ homepage: http://github.com/substantial/sous-chef
109
+ licenses:
110
+ - MIT
42
111
  post_install_message:
43
112
  rdoc_options: []
44
113
  require_paths:
@@ -60,5 +129,5 @@ rubyforge_project: sous-chef
60
129
  rubygems_version: 1.8.24
61
130
  signing_key:
62
131
  specification_version: 3
63
- summary: Manage nodes
132
+ summary: Manage knife-solo nodes
64
133
  test_files: []