coral_cloud 0.1.3 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile.lock +1 -1
- data/coral_cloud.gemspec +9 -31
- metadata +29 -181
- data/lib/coral_cloud.rb +0 -82
- data/lib/coral_cloud/base.rb +0 -236
- data/lib/coral_cloud/event/puppet_event.rb +0 -99
- data/lib/coral_cloud/server.rb +0 -254
- data/lib/coral_cloud/share.rb +0 -44
- data/spec/coral_test_kernel.rb +0 -22
- data/spec/spec_helper.rb +0 -14
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 6f6af63f71d9b81f130a2fdf8ae3d51140c7f6b1
|
4
|
+
data.tar.gz: 0dd3eca463119b45c47968882967824850ff1391
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5f11d4d0749ff693040fa960671d4c89b95a36d4ca8c1ff3d19cd06e62cda334054f347fca0226540425e2cef3a83fb89c0085627a50fda6aa81ea4e3c00ee8a
|
7
|
+
data.tar.gz: ad1d033cd31bca85b5f3ec645f00a81f84f180a4ed22dd0a9108180edabb613f7c89879745d463dcabbec6b49124b9d753d1082cf7eb51ae5df9f89d30b7da8a
|
data/Gemfile.lock
CHANGED
data/coral_cloud.gemspec
CHANGED
@@ -5,12 +5,12 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "coral_cloud"
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.2.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Adrian Webb"]
|
12
|
-
s.date = "
|
13
|
-
s.description = "
|
12
|
+
s.date = "2015-02-16"
|
13
|
+
s.description = "This gem has been depreciated in favor of corl (https://github.com/coralnexus/corl). Do not use. No further development."
|
14
14
|
s.email = "adrian.webb@coraltech.net"
|
15
15
|
s.extra_rdoc_files = [
|
16
16
|
"LICENSE.txt",
|
@@ -24,49 +24,27 @@ Gem::Specification.new do |s|
|
|
24
24
|
"README.rdoc",
|
25
25
|
"Rakefile",
|
26
26
|
"VERSION",
|
27
|
-
"coral_cloud.gemspec"
|
28
|
-
"lib/coral_cloud.rb",
|
29
|
-
"lib/coral_cloud/base.rb",
|
30
|
-
"lib/coral_cloud/event/puppet_event.rb",
|
31
|
-
"lib/coral_cloud/server.rb",
|
32
|
-
"lib/coral_cloud/share.rb",
|
33
|
-
"spec/coral_test_kernel.rb",
|
34
|
-
"spec/spec_helper.rb"
|
27
|
+
"coral_cloud.gemspec"
|
35
28
|
]
|
36
|
-
s.homepage = "
|
29
|
+
s.homepage = ""
|
37
30
|
s.licenses = ["GPLv3"]
|
38
31
|
s.rdoc_options = ["--title", "Coral Cloud library", "--main", "README.rdoc", "--line-numbers"]
|
39
32
|
s.require_paths = ["lib"]
|
40
33
|
s.required_ruby_version = Gem::Requirement.new(">= 1.8.1")
|
41
34
|
s.rubyforge_project = "coral_cloud"
|
42
35
|
s.rubygems_version = "1.8.15"
|
43
|
-
s.summary = "
|
36
|
+
s.summary = "This gem has been depreciated in favor of corl (https://github.com/coralnexus/corl). Do not use. No further development."
|
44
37
|
|
45
38
|
if s.respond_to? :specification_version then
|
46
39
|
s.specification_version = 3
|
47
40
|
|
48
41
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
49
|
-
|
50
|
-
s.add_development_dependency(%q<bundler>, ["~> 1.2"])
|
51
|
-
s.add_development_dependency(%q<jeweler>, ["~> 1.8"])
|
52
|
-
s.add_development_dependency(%q<rspec>, ["~> 2.10"])
|
53
|
-
s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
|
54
|
-
s.add_development_dependency(%q<yard>, ["~> 0.8"])
|
42
|
+
|
55
43
|
else
|
56
|
-
|
57
|
-
s.add_dependency(%q<bundler>, ["~> 1.2"])
|
58
|
-
s.add_dependency(%q<jeweler>, ["~> 1.8"])
|
59
|
-
s.add_dependency(%q<rspec>, ["~> 2.10"])
|
60
|
-
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
61
|
-
s.add_dependency(%q<yard>, ["~> 0.8"])
|
44
|
+
|
62
45
|
end
|
63
46
|
else
|
64
|
-
|
65
|
-
s.add_dependency(%q<bundler>, ["~> 1.2"])
|
66
|
-
s.add_dependency(%q<jeweler>, ["~> 1.8"])
|
67
|
-
s.add_dependency(%q<rspec>, ["~> 2.10"])
|
68
|
-
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
69
|
-
s.add_dependency(%q<yard>, ["~> 0.8"])
|
47
|
+
|
70
48
|
end
|
71
49
|
end
|
72
50
|
|
metadata
CHANGED
@@ -1,159 +1,25 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: coral_cloud
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 1
|
9
|
-
- 3
|
10
|
-
version: 0.1.3
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.0
|
11
5
|
platform: ruby
|
12
|
-
authors:
|
6
|
+
authors:
|
13
7
|
- Adrian Webb
|
14
8
|
autorequire:
|
15
9
|
bindir: bin
|
16
10
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
name: coral_core
|
22
|
-
prerelease: false
|
23
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
-
none: false
|
25
|
-
requirements:
|
26
|
-
- - ~>
|
27
|
-
- !ruby/object:Gem::Version
|
28
|
-
hash: 9
|
29
|
-
segments:
|
30
|
-
- 0
|
31
|
-
- 1
|
32
|
-
version: "0.1"
|
33
|
-
type: :runtime
|
34
|
-
version_requirements: *id001
|
35
|
-
- !ruby/object:Gem::Dependency
|
36
|
-
name: bundler
|
37
|
-
prerelease: false
|
38
|
-
requirement: &id002 !ruby/object:Gem::Requirement
|
39
|
-
none: false
|
40
|
-
requirements:
|
41
|
-
- - ~>
|
42
|
-
- !ruby/object:Gem::Version
|
43
|
-
hash: 11
|
44
|
-
segments:
|
45
|
-
- 1
|
46
|
-
- 2
|
47
|
-
version: "1.2"
|
48
|
-
type: :development
|
49
|
-
version_requirements: *id002
|
50
|
-
- !ruby/object:Gem::Dependency
|
51
|
-
name: jeweler
|
52
|
-
prerelease: false
|
53
|
-
requirement: &id003 !ruby/object:Gem::Requirement
|
54
|
-
none: false
|
55
|
-
requirements:
|
56
|
-
- - ~>
|
57
|
-
- !ruby/object:Gem::Version
|
58
|
-
hash: 31
|
59
|
-
segments:
|
60
|
-
- 1
|
61
|
-
- 8
|
62
|
-
version: "1.8"
|
63
|
-
type: :development
|
64
|
-
version_requirements: *id003
|
65
|
-
- !ruby/object:Gem::Dependency
|
66
|
-
name: rspec
|
67
|
-
prerelease: false
|
68
|
-
requirement: &id004 !ruby/object:Gem::Requirement
|
69
|
-
none: false
|
70
|
-
requirements:
|
71
|
-
- - ~>
|
72
|
-
- !ruby/object:Gem::Version
|
73
|
-
hash: 23
|
74
|
-
segments:
|
75
|
-
- 2
|
76
|
-
- 10
|
77
|
-
version: "2.10"
|
78
|
-
type: :development
|
79
|
-
version_requirements: *id004
|
80
|
-
- !ruby/object:Gem::Dependency
|
81
|
-
name: rdoc
|
82
|
-
prerelease: false
|
83
|
-
requirement: &id005 !ruby/object:Gem::Requirement
|
84
|
-
none: false
|
85
|
-
requirements:
|
86
|
-
- - ~>
|
87
|
-
- !ruby/object:Gem::Version
|
88
|
-
hash: 31
|
89
|
-
segments:
|
90
|
-
- 3
|
91
|
-
- 12
|
92
|
-
version: "3.12"
|
93
|
-
type: :development
|
94
|
-
version_requirements: *id005
|
95
|
-
- !ruby/object:Gem::Dependency
|
96
|
-
name: yard
|
97
|
-
prerelease: false
|
98
|
-
requirement: &id006 !ruby/object:Gem::Requirement
|
99
|
-
none: false
|
100
|
-
requirements:
|
101
|
-
- - ~>
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
hash: 27
|
104
|
-
segments:
|
105
|
-
- 0
|
106
|
-
- 8
|
107
|
-
version: "0.8"
|
108
|
-
type: :development
|
109
|
-
version_requirements: *id006
|
110
|
-
description: |-
|
111
|
-
= coral_cloud
|
112
|
-
|
113
|
-
This library provides the ability to define and manage servers. These servers
|
114
|
-
can be local virtual machines (interfaced by Vagrant) or (in the near future)
|
115
|
-
remote servers on various IAAS providers, such as Rackspace and Amazon.
|
116
|
-
|
117
|
-
This library utilizes the Puppet provisioner to build servers and Vagrant
|
118
|
-
to run them locally. Eventually a cohesive API will be developed that will
|
119
|
-
allow for easily switching and performing the same operations on different
|
120
|
-
providers. For now this library focuses on integration with Vagrant.
|
121
|
-
|
122
|
-
More to come soon...
|
123
|
-
|
124
|
-
Note: This library is still very early in development!
|
125
|
-
|
126
|
-
== Contributing to coral_cloud
|
127
|
-
|
128
|
-
* Check out the latest {major}.{minor} branch to make sure the feature hasn't
|
129
|
-
been implemented or the bug hasn't been fixed yet.
|
130
|
-
* Check out the issue tracker to make sure someone already hasn't requested
|
131
|
-
it and/or contributed it.
|
132
|
-
* Fork the project.
|
133
|
-
* Start a feature/bugfix branch.
|
134
|
-
* Commit and push until you are happy with your contribution.
|
135
|
-
* Make sure to add tests for it. This is important so I don't break it in a
|
136
|
-
future version unintentionally.
|
137
|
-
* Please try not to mess with the Rakefile, version, or history. If you want
|
138
|
-
to have your own version, or is otherwise necessary, that is fine, but
|
139
|
-
please isolate to its own commit so I can cherry-pick around it.
|
140
|
-
|
141
|
-
== Copyright
|
142
|
-
|
143
|
-
Licensed under GPLv3. See LICENSE.txt for further details.
|
144
|
-
|
145
|
-
Copyright (c) 2013 Adrian Webb <adrian.webb@coraltech.net>
|
146
|
-
Coral Technology Group LLC
|
11
|
+
date: 2015-02-16 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: This gem has been depreciated in favor of corl (https://github.com/coralnexus/corl). Do
|
14
|
+
not use. No further development.
|
147
15
|
email: adrian.webb@coraltech.net
|
148
16
|
executables: []
|
149
|
-
|
150
17
|
extensions: []
|
151
|
-
|
152
|
-
extra_rdoc_files:
|
18
|
+
extra_rdoc_files:
|
153
19
|
- LICENSE.txt
|
154
20
|
- README.rdoc
|
155
|
-
files:
|
156
|
-
- .document
|
21
|
+
files:
|
22
|
+
- ".document"
|
157
23
|
- Gemfile
|
158
24
|
- Gemfile.lock
|
159
25
|
- LICENSE.txt
|
@@ -161,52 +27,34 @@ files:
|
|
161
27
|
- Rakefile
|
162
28
|
- VERSION
|
163
29
|
- coral_cloud.gemspec
|
164
|
-
|
165
|
-
|
166
|
-
- lib/coral_cloud/event/puppet_event.rb
|
167
|
-
- lib/coral_cloud/server.rb
|
168
|
-
- lib/coral_cloud/share.rb
|
169
|
-
- spec/coral_test_kernel.rb
|
170
|
-
- spec/spec_helper.rb
|
171
|
-
homepage: http://github.com/coraltech/ruby-coral_cloud
|
172
|
-
licenses:
|
30
|
+
homepage: ''
|
31
|
+
licenses:
|
173
32
|
- GPLv3
|
33
|
+
metadata: {}
|
174
34
|
post_install_message:
|
175
|
-
rdoc_options:
|
176
|
-
- --title
|
35
|
+
rdoc_options:
|
36
|
+
- "--title"
|
177
37
|
- Coral Cloud library
|
178
|
-
- --main
|
38
|
+
- "--main"
|
179
39
|
- README.rdoc
|
180
|
-
- --line-numbers
|
181
|
-
require_paths:
|
40
|
+
- "--line-numbers"
|
41
|
+
require_paths:
|
182
42
|
- lib
|
183
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
184
|
-
|
185
|
-
requirements:
|
43
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
186
45
|
- - ">="
|
187
|
-
- !ruby/object:Gem::Version
|
188
|
-
hash: 53
|
189
|
-
segments:
|
190
|
-
- 1
|
191
|
-
- 8
|
192
|
-
- 1
|
46
|
+
- !ruby/object:Gem::Version
|
193
47
|
version: 1.8.1
|
194
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
195
|
-
|
196
|
-
requirements:
|
48
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
49
|
+
requirements:
|
197
50
|
- - ">="
|
198
|
-
- !ruby/object:Gem::Version
|
199
|
-
|
200
|
-
segments:
|
201
|
-
- 0
|
202
|
-
version: "0"
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: '0'
|
203
53
|
requirements: []
|
204
|
-
|
205
54
|
rubyforge_project: coral_cloud
|
206
|
-
rubygems_version:
|
55
|
+
rubygems_version: 2.4.5
|
207
56
|
signing_key:
|
208
57
|
specification_version: 3
|
209
|
-
summary:
|
58
|
+
summary: This gem has been depreciated in favor of corl (https://github.com/coralnexus/corl). Do
|
59
|
+
not use. No further development.
|
210
60
|
test_files: []
|
211
|
-
|
212
|
-
has_rdoc:
|
data/lib/coral_cloud.rb
DELETED
@@ -1,82 +0,0 @@
|
|
1
|
-
|
2
|
-
home = File.dirname(__FILE__)
|
3
|
-
|
4
|
-
$:.unshift(home) unless
|
5
|
-
$:.include?(home) || $:.include?(File.expand_path(home))
|
6
|
-
|
7
|
-
#-------------------------------------------------------------------------------
|
8
|
-
|
9
|
-
require 'rubygems'
|
10
|
-
require 'coral_core'
|
11
|
-
|
12
|
-
#---
|
13
|
-
|
14
|
-
# Include data model
|
15
|
-
[ :share, :server, :base ].each do |name|
|
16
|
-
require File.join('coral_cloud', name.to_s + '.rb')
|
17
|
-
end
|
18
|
-
|
19
|
-
# Include specialized events
|
20
|
-
Dir.glob(File.join(home, 'coral_cloud', 'event', '*.rb')).each do |file|
|
21
|
-
require file
|
22
|
-
end
|
23
|
-
|
24
|
-
#*******************************************************************************
|
25
|
-
# Coral Cloud / Virtual Machine Management Library
|
26
|
-
#
|
27
|
-
# This provides the ability to manage a cloud of servers and sync them with
|
28
|
-
# associated VMs running on the local machine...
|
29
|
-
# (most of this is currently TODO!)
|
30
|
-
#
|
31
|
-
# Author:: Adrian Webb (mailto:adrian.webb@coraltech.net)
|
32
|
-
# License:: GPLv3
|
33
|
-
module Coral
|
34
|
-
|
35
|
-
#-----------------------------------------------------------------------------
|
36
|
-
# Constructor / Destructor
|
37
|
-
|
38
|
-
def self.create_cloud(name, options = {})
|
39
|
-
return Coral::Cloud.create(name, options)
|
40
|
-
end
|
41
|
-
|
42
|
-
#---
|
43
|
-
|
44
|
-
def self.delete_cloud(name)
|
45
|
-
return Coral::Cloud.delete(name)
|
46
|
-
end
|
47
|
-
|
48
|
-
#-----------------------------------------------------------------------------
|
49
|
-
# Accessors / Modifiers
|
50
|
-
|
51
|
-
def self.cloud(name)
|
52
|
-
return Coral::Cloud[name]
|
53
|
-
end
|
54
|
-
|
55
|
-
#*******************************************************************************
|
56
|
-
#*******************************************************************************
|
57
|
-
|
58
|
-
module Cloud
|
59
|
-
|
60
|
-
VERSION = File.read(File.join(File.dirname(__FILE__), '..', 'VERSION'))
|
61
|
-
|
62
|
-
#-----------------------------------------------------------------------------
|
63
|
-
# Constructor / Destructor
|
64
|
-
|
65
|
-
def self.create(name, options = {})
|
66
|
-
return Coral::Cloud::Base.create(name, options)
|
67
|
-
end
|
68
|
-
|
69
|
-
#---
|
70
|
-
|
71
|
-
def self.delete(name)
|
72
|
-
return Coral::Cloud::Base.delete(name)
|
73
|
-
end
|
74
|
-
|
75
|
-
#-----------------------------------------------------------------------------
|
76
|
-
# Accessors / Modifiers
|
77
|
-
|
78
|
-
def self.[](name)
|
79
|
-
return Coral::Cloud::Base[name]
|
80
|
-
end
|
81
|
-
end
|
82
|
-
end
|
data/lib/coral_cloud/base.rb
DELETED
@@ -1,236 +0,0 @@
|
|
1
|
-
|
2
|
-
module Coral
|
3
|
-
module Cloud
|
4
|
-
class Base < Memory
|
5
|
-
|
6
|
-
#-----------------------------------------------------------------------------
|
7
|
-
# Properties
|
8
|
-
|
9
|
-
@@instances = {}
|
10
|
-
|
11
|
-
#-----------------------------------------------------------------------------
|
12
|
-
# Constructor / Destructor
|
13
|
-
|
14
|
-
def self.create(name, options = {})
|
15
|
-
options[:name] = name unless options.has_key?(:name)
|
16
|
-
@@instances[name] = new(options)
|
17
|
-
return @@instances[name]
|
18
|
-
end
|
19
|
-
|
20
|
-
#---
|
21
|
-
|
22
|
-
def self.delete(name)
|
23
|
-
if @@instances.has_key?(name) && @@instances[name]
|
24
|
-
@@instances.delete(name)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
#-----------------------------------------------------------------------------
|
29
|
-
|
30
|
-
def self.[](name)
|
31
|
-
if ! @@instances.has_key?(name) || ! @@instances[name]
|
32
|
-
@@instances[name] = new({ :name => name })
|
33
|
-
end
|
34
|
-
return @@instances[name]
|
35
|
-
end
|
36
|
-
|
37
|
-
#-----------------------------------------------------------------------------
|
38
|
-
|
39
|
-
def initialize(options = {})
|
40
|
-
super(options)
|
41
|
-
|
42
|
-
@repositories = {}
|
43
|
-
@shares = {}
|
44
|
-
@servers = {}
|
45
|
-
end
|
46
|
-
|
47
|
-
#-----------------------------------------------------------------------------
|
48
|
-
# Property accessors / modifiers
|
49
|
-
|
50
|
-
def repositories(reset = false)
|
51
|
-
if reset || @repositories.empty?
|
52
|
-
@repositories = {}
|
53
|
-
get('repositories', {}, :hash).each do |submodule, remote_dir|
|
54
|
-
@repositories[submodule] = Coral::Repository.new({
|
55
|
-
:name => submodule,
|
56
|
-
:directory => @directory,
|
57
|
-
:submodule => submodule,
|
58
|
-
:remote_dir => remote_dir,
|
59
|
-
})
|
60
|
-
end
|
61
|
-
end
|
62
|
-
return @repositories
|
63
|
-
end
|
64
|
-
|
65
|
-
#---
|
66
|
-
|
67
|
-
def set_repositories(values = {})
|
68
|
-
return set('repositories', values)
|
69
|
-
end
|
70
|
-
|
71
|
-
#---
|
72
|
-
|
73
|
-
def repository(local_repo, default = '', format = false)
|
74
|
-
return get_group('repositories', local_repo, nil, default, format)
|
75
|
-
end
|
76
|
-
|
77
|
-
#---
|
78
|
-
|
79
|
-
def set_repository(local_repo, remote_repo)
|
80
|
-
return set_group('repositories', local_repo, nil, remote_repo)
|
81
|
-
end
|
82
|
-
|
83
|
-
#---
|
84
|
-
|
85
|
-
def delete_repository(local_repo)
|
86
|
-
return delete_group('repositories', local_repo, nil)
|
87
|
-
end
|
88
|
-
|
89
|
-
#-----------------------------------------------------------------------------
|
90
|
-
|
91
|
-
def settings(group)
|
92
|
-
return get_group('settings', group, nil, {}, :hash)
|
93
|
-
end
|
94
|
-
|
95
|
-
#---
|
96
|
-
|
97
|
-
def set_settings(group, values = {})
|
98
|
-
return set_group('settings', group, nil, values)
|
99
|
-
end
|
100
|
-
|
101
|
-
#---
|
102
|
-
|
103
|
-
def delete_settings(group)
|
104
|
-
return delete_group('settings', group, nil)
|
105
|
-
end
|
106
|
-
|
107
|
-
#---
|
108
|
-
|
109
|
-
def setting(group, key, default = '', format = false)
|
110
|
-
return get_group('settings', group, key, default, format)
|
111
|
-
end
|
112
|
-
|
113
|
-
#---
|
114
|
-
|
115
|
-
def set_setting(group, key, value = '')
|
116
|
-
return set_group('settings', group, key, value)
|
117
|
-
end
|
118
|
-
|
119
|
-
#---
|
120
|
-
|
121
|
-
def delete_setting(group, key)
|
122
|
-
return delete_group('settings', group, key)
|
123
|
-
end
|
124
|
-
|
125
|
-
#-----------------------------------------------------------------------------
|
126
|
-
|
127
|
-
def shares(reset = false)
|
128
|
-
if reset || @shares.empty?
|
129
|
-
@shares = {}
|
130
|
-
get('shares', {}, :hash).each do |name, share_info|
|
131
|
-
share_info = Coral::Util::Data.merge([ {
|
132
|
-
:name => name,
|
133
|
-
:directory => File.join(@directory, share_info['local_dir']),
|
134
|
-
}, symbol_map(share_info) ])
|
135
|
-
|
136
|
-
@shares[name] = Coral::Cloud::Share.new(share_info)
|
137
|
-
end
|
138
|
-
end
|
139
|
-
return @shares
|
140
|
-
end
|
141
|
-
|
142
|
-
#---
|
143
|
-
|
144
|
-
def set_shares(values = {})
|
145
|
-
return set('shares', values)
|
146
|
-
end
|
147
|
-
|
148
|
-
#---
|
149
|
-
|
150
|
-
def share(name, key = nil, default = {}, format = false)
|
151
|
-
return get_group('shares', name, key, default, format)
|
152
|
-
end
|
153
|
-
|
154
|
-
#---
|
155
|
-
|
156
|
-
def set_share(name, key = nil, value = {})
|
157
|
-
return set_group('shares', name, key, value)
|
158
|
-
end
|
159
|
-
|
160
|
-
#---
|
161
|
-
|
162
|
-
def delete_share(name, key = nil)
|
163
|
-
return delete_group('shares', name, key)
|
164
|
-
end
|
165
|
-
|
166
|
-
#-----------------------------------------------------------------------------
|
167
|
-
|
168
|
-
def servers(reset = false)
|
169
|
-
if reset || @servers.empty?
|
170
|
-
@servers = {}
|
171
|
-
get('servers', {}, :hash).each do |name, server_info|
|
172
|
-
server_info = Coral::Util::Data.merge([ {
|
173
|
-
:cloud => self,
|
174
|
-
:machine => name,
|
175
|
-
}, symbol_map(server_info) ])
|
176
|
-
|
177
|
-
@servers[name] = Coral::Cloud::Server.new(server_info)
|
178
|
-
end
|
179
|
-
end
|
180
|
-
return @servers
|
181
|
-
end
|
182
|
-
|
183
|
-
#---
|
184
|
-
|
185
|
-
def set_servers(values = {})
|
186
|
-
return set('servers', values)
|
187
|
-
end
|
188
|
-
|
189
|
-
#---
|
190
|
-
|
191
|
-
def server(name, key = nil, default = {}, format = false)
|
192
|
-
return get_group('servers', name, key, default, format)
|
193
|
-
end
|
194
|
-
|
195
|
-
#---
|
196
|
-
|
197
|
-
def set_server(name, key = nil, value = {})
|
198
|
-
return set_group('servers', name, key, value)
|
199
|
-
end
|
200
|
-
|
201
|
-
#---
|
202
|
-
|
203
|
-
def delete_server(name, key = nil)
|
204
|
-
return delete_group('servers', name, key)
|
205
|
-
end
|
206
|
-
|
207
|
-
#-----------------------------------------------------------------------------
|
208
|
-
|
209
|
-
def search(server, key, default = '', format = false)
|
210
|
-
value = default
|
211
|
-
server_info = server(server)
|
212
|
-
|
213
|
-
if server_info[key]
|
214
|
-
value = server_info[key]
|
215
|
-
else
|
216
|
-
settings = {}
|
217
|
-
if server_info.has_key?('settings')
|
218
|
-
array(server_info['settings']).each do |group|
|
219
|
-
settings = settings(group)
|
220
|
-
|
221
|
-
if settings.has_key?(key)
|
222
|
-
if value.is_a?(Array) && settings[key].is_a?(Array)
|
223
|
-
value = value | settings[key]
|
224
|
-
else
|
225
|
-
value = settings[key]
|
226
|
-
end
|
227
|
-
break
|
228
|
-
end
|
229
|
-
end
|
230
|
-
end
|
231
|
-
end
|
232
|
-
return filter(value, format)
|
233
|
-
end
|
234
|
-
end
|
235
|
-
end
|
236
|
-
end
|
@@ -1,99 +0,0 @@
|
|
1
|
-
|
2
|
-
module Coral
|
3
|
-
class PuppetEvent < Event
|
4
|
-
|
5
|
-
#-----------------------------------------------------------------------------
|
6
|
-
# Properties
|
7
|
-
|
8
|
-
TYPE = :puppet
|
9
|
-
|
10
|
-
#-----------------------------------------------------------------------------
|
11
|
-
# Constructor / Destructor
|
12
|
-
|
13
|
-
def initialize(options = {})
|
14
|
-
options[:type] = TYPE
|
15
|
-
|
16
|
-
super(options)
|
17
|
-
|
18
|
-
if options.has_key?(:string)
|
19
|
-
items = options[:string].split(':')
|
20
|
-
self.element = items[0]
|
21
|
-
self.operation = items[1]
|
22
|
-
self.message = items[2]
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
#-----------------------------------------------------------------------------
|
27
|
-
# Property accessors / modifiers
|
28
|
-
|
29
|
-
def element
|
30
|
-
return property(:element, '', :string)
|
31
|
-
end
|
32
|
-
|
33
|
-
#---
|
34
|
-
|
35
|
-
def element=element
|
36
|
-
set_property(:element, string(element))
|
37
|
-
end
|
38
|
-
|
39
|
-
#---
|
40
|
-
|
41
|
-
def operation
|
42
|
-
return property(:operation, '', :string)
|
43
|
-
end
|
44
|
-
|
45
|
-
#---
|
46
|
-
|
47
|
-
def operation=operation
|
48
|
-
set_property(:operation, string(operation))
|
49
|
-
end
|
50
|
-
|
51
|
-
#--
|
52
|
-
|
53
|
-
def message
|
54
|
-
return property(:message, '', :string)
|
55
|
-
end
|
56
|
-
|
57
|
-
#---
|
58
|
-
|
59
|
-
def message=message
|
60
|
-
set_property(:message, string(message))
|
61
|
-
end
|
62
|
-
|
63
|
-
#-----------------------------------------------------------------------------
|
64
|
-
# Import / Export
|
65
|
-
|
66
|
-
def export
|
67
|
-
return "#{type}:#{element}:#{operation}:#{message}"
|
68
|
-
end
|
69
|
-
|
70
|
-
#-----------------------------------------------------------------------------
|
71
|
-
# Event handling
|
72
|
-
|
73
|
-
def check(source)
|
74
|
-
if source.match(/notice:\s+(.+?):\s+(.+)\s*/)
|
75
|
-
source_element = $1
|
76
|
-
source_operation = ''
|
77
|
-
source_message = $2
|
78
|
-
|
79
|
-
source_elements = source_element.split('/')
|
80
|
-
source_operation = source_elements.pop.strip unless source_elements.last.match(/[\[\]]/)
|
81
|
-
|
82
|
-
if source_operation
|
83
|
-
source_element = source_elements.join('/').strip
|
84
|
-
|
85
|
-
logger.debug("#{source_element} includes: #{element} -- " + ( source_element.include?(element) ? 'true' : 'false' ))
|
86
|
-
logger.debug("#{source_operation} is: #{operation} -- " + ( source_operation == operation ? 'true' : 'false' ))
|
87
|
-
logger.debug("#{source_message} includes: #{message} -- " + ( source_message.include?(message) ? 'true' : 'false' ))
|
88
|
-
|
89
|
-
if source_element.include?(element) && source_operation == operation && source_message.include?(message)
|
90
|
-
logger.debug("MATCH! -> #{element} - #{operation} - #{message}")
|
91
|
-
return true
|
92
|
-
end
|
93
|
-
end
|
94
|
-
end
|
95
|
-
logger.debug("nothing -> #{element} - #{operation} - #{message}")
|
96
|
-
return false
|
97
|
-
end
|
98
|
-
end
|
99
|
-
end
|
data/lib/coral_cloud/server.rb
DELETED
@@ -1,254 +0,0 @@
|
|
1
|
-
|
2
|
-
module Coral
|
3
|
-
module Cloud
|
4
|
-
class Server < Core
|
5
|
-
|
6
|
-
#-----------------------------------------------------------------------------
|
7
|
-
# Constructor / Destructor
|
8
|
-
|
9
|
-
def initialize(options = {})
|
10
|
-
super(options)
|
11
|
-
|
12
|
-
self.machine = ( options.has_key?(:machine) ? options[:machine] : '' )
|
13
|
-
@cloud = ( options.has_key?(:cloud) ? options[:cloud] : Coral.create_cloud(@name, options) )
|
14
|
-
end
|
15
|
-
|
16
|
-
#-----------------------------------------------------------------------------
|
17
|
-
# Property accessors / modifiers
|
18
|
-
|
19
|
-
attr_reader :machine, :name, :cloud
|
20
|
-
|
21
|
-
#---
|
22
|
-
|
23
|
-
def machine=machine
|
24
|
-
@name = ''
|
25
|
-
if machine.is_a?(String)
|
26
|
-
@machine = nil
|
27
|
-
@name = machine
|
28
|
-
else
|
29
|
-
@machine = machine
|
30
|
-
@name = @machine.name if @machine
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
#---
|
35
|
-
|
36
|
-
def hostname
|
37
|
-
return @cloud.server(@name, 'hostname', '', :string)
|
38
|
-
end
|
39
|
-
|
40
|
-
#---
|
41
|
-
|
42
|
-
def hostname=hostname
|
43
|
-
@cloud.set_server(@name, 'hostname', hostname)
|
44
|
-
end
|
45
|
-
|
46
|
-
#---
|
47
|
-
|
48
|
-
def public_ip
|
49
|
-
return @cloud.server(@name, 'public_ip', '', :string)
|
50
|
-
end
|
51
|
-
|
52
|
-
#---
|
53
|
-
|
54
|
-
def public_ip=public_ip
|
55
|
-
@cloud.set_server(@name, 'public_ip', public_ip)
|
56
|
-
end
|
57
|
-
|
58
|
-
#---
|
59
|
-
|
60
|
-
def internal_ip
|
61
|
-
return @cloud.server(@name, 'internal_ip', '', :string)
|
62
|
-
end
|
63
|
-
|
64
|
-
#---
|
65
|
-
|
66
|
-
def internal_ip=internal_ip
|
67
|
-
@cloud.set_server(@name, 'internal_ip', internal_ip)
|
68
|
-
end
|
69
|
-
|
70
|
-
#---
|
71
|
-
|
72
|
-
def virtual_hostname
|
73
|
-
return @cloud.search(@name, 'virtual_hostname', '', :string)
|
74
|
-
end
|
75
|
-
|
76
|
-
#---
|
77
|
-
|
78
|
-
def virtual_hostname=virtual_hostname
|
79
|
-
@cloud.set_server(@name, 'virtual_hostname', virtual_hostname)
|
80
|
-
end
|
81
|
-
|
82
|
-
#---
|
83
|
-
|
84
|
-
def virtual_ip
|
85
|
-
return @cloud.search(@name, 'virtual_ip', '', :string)
|
86
|
-
end
|
87
|
-
|
88
|
-
#---
|
89
|
-
|
90
|
-
def virtual_ip=virtual_ip
|
91
|
-
@cloud.set_server(@name, 'virtual_ip', virtual_ip)
|
92
|
-
end
|
93
|
-
|
94
|
-
#-----------------------------------------------------------------------------
|
95
|
-
|
96
|
-
def repositories(options = {}, return_objects = true)
|
97
|
-
repositories = array(options[:repos], @cloud.repositories.keys, true)
|
98
|
-
results = ( return_objects ? {} : [] )
|
99
|
-
|
100
|
-
return results unless repositories.is_a?(Array)
|
101
|
-
|
102
|
-
repositories.each do |repo_name|
|
103
|
-
if @cloud.repositories.has_key?(repo_name)
|
104
|
-
if return_objects
|
105
|
-
results[repo_name] = @cloud.repositories[repo_name]
|
106
|
-
else
|
107
|
-
results << repo_name
|
108
|
-
end
|
109
|
-
end
|
110
|
-
end
|
111
|
-
return results
|
112
|
-
end
|
113
|
-
|
114
|
-
#---
|
115
|
-
|
116
|
-
def shares(options = {}, return_objects = true)
|
117
|
-
shares = array(options[:shares], @cloud.shares.keys, true)
|
118
|
-
results = ( return_objects ? {} : [] )
|
119
|
-
|
120
|
-
return results unless shares.is_a?(Array)
|
121
|
-
|
122
|
-
shares.each do |share_name|
|
123
|
-
if @cloud.shares.has_key?(share_name)
|
124
|
-
if return_objects
|
125
|
-
results[share_name] = @cloud.shares[share_name]
|
126
|
-
else
|
127
|
-
results << share_name
|
128
|
-
end
|
129
|
-
end
|
130
|
-
end
|
131
|
-
return results
|
132
|
-
end
|
133
|
-
|
134
|
-
#-----------------------------------------------------------------------------
|
135
|
-
# Management
|
136
|
-
|
137
|
-
def start(options = {})
|
138
|
-
sync_remotes(options)
|
139
|
-
|
140
|
-
return true if ! @machine
|
141
|
-
|
142
|
-
options["provision.enabled"] = false
|
143
|
-
|
144
|
-
if @machine.created?
|
145
|
-
@machine.start(options)
|
146
|
-
else
|
147
|
-
@machine.up(options)
|
148
|
-
end
|
149
|
-
return true
|
150
|
-
end
|
151
|
-
|
152
|
-
#-----------------------------------------------------------------------------
|
153
|
-
|
154
|
-
def update(options = {})
|
155
|
-
sync_remotes(options)
|
156
|
-
|
157
|
-
success = true
|
158
|
-
return success if ! @machine
|
159
|
-
|
160
|
-
if @machine.created?
|
161
|
-
if @machine.state == :running
|
162
|
-
success = Coral::Command.new("vagrant provision #{@name}").exec!(options) do |line|
|
163
|
-
process_puppet_message(line)
|
164
|
-
end
|
165
|
-
end
|
166
|
-
end
|
167
|
-
return success
|
168
|
-
end
|
169
|
-
|
170
|
-
#-----------------------------------------------------------------------------
|
171
|
-
|
172
|
-
def destroy(options = {})
|
173
|
-
return true if ! @machine
|
174
|
-
|
175
|
-
if @machine.created?
|
176
|
-
do_destroy = false
|
177
|
-
|
178
|
-
if options[:force]
|
179
|
-
do_destroy = true
|
180
|
-
else
|
181
|
-
choice = nil
|
182
|
-
begin
|
183
|
-
choice = ui.ask("Are you sure you want to remove: #{@name}?")
|
184
|
-
rescue Errors::UIExpectsTTY
|
185
|
-
end
|
186
|
-
do_destroy = choice.upcase == "Y"
|
187
|
-
end
|
188
|
-
|
189
|
-
if do_destroy
|
190
|
-
@machine.destroy
|
191
|
-
end
|
192
|
-
end
|
193
|
-
return true
|
194
|
-
end
|
195
|
-
|
196
|
-
#-----------------------------------------------------------------------------
|
197
|
-
# Repository operations
|
198
|
-
|
199
|
-
def sync_remotes(options = {})
|
200
|
-
repositories(options).each do |repo_name, repo|
|
201
|
-
if repo.can_persist?
|
202
|
-
if @name != 'all'
|
203
|
-
repo.set_remote(@name, public_ip, options)
|
204
|
-
end
|
205
|
-
|
206
|
-
server_ips = []
|
207
|
-
@cloud.servers.each do |server_name, server|
|
208
|
-
server_ips << server.public_ip
|
209
|
-
end
|
210
|
-
|
211
|
-
options[:add] = true
|
212
|
-
repo.set_remote('all', server_ips, options)
|
213
|
-
end
|
214
|
-
end
|
215
|
-
return true
|
216
|
-
end
|
217
|
-
|
218
|
-
#-----------------------------------------------------------------------------
|
219
|
-
|
220
|
-
def commit(options = {})
|
221
|
-
repositories(options).each do |name, repo|
|
222
|
-
if repo.can_persist?
|
223
|
-
repo.commit('.', options)
|
224
|
-
end
|
225
|
-
end
|
226
|
-
return true
|
227
|
-
end
|
228
|
-
|
229
|
-
#-----------------------------------------------------------------------------
|
230
|
-
|
231
|
-
def push(options = {})
|
232
|
-
sync_remotes(options)
|
233
|
-
|
234
|
-
success = true
|
235
|
-
repositories(options).each do |name, repo|
|
236
|
-
if repo.can_persist?
|
237
|
-
success = repo.push!(@name, options) do |line|
|
238
|
-
process_puppet_message(line)
|
239
|
-
end
|
240
|
-
break unless success
|
241
|
-
end
|
242
|
-
end
|
243
|
-
return success
|
244
|
-
end
|
245
|
-
|
246
|
-
#-----------------------------------------------------------------------------
|
247
|
-
# Utilities
|
248
|
-
|
249
|
-
def process_puppet_message(line)
|
250
|
-
return line.match(/err:\s+/) ? { :success => false, :prefix => 'FAIL' } : true
|
251
|
-
end
|
252
|
-
end
|
253
|
-
end
|
254
|
-
end
|
data/lib/coral_cloud/share.rb
DELETED
@@ -1,44 +0,0 @@
|
|
1
|
-
|
2
|
-
module Coral
|
3
|
-
module Cloud
|
4
|
-
class Share < Core
|
5
|
-
|
6
|
-
#-----------------------------------------------------------------------------
|
7
|
-
# Constructor / Destructor
|
8
|
-
|
9
|
-
def initialize(options = {})
|
10
|
-
super(options)
|
11
|
-
|
12
|
-
@name = ( options.has_key?(:name) ? string(options[:name]) : '' )
|
13
|
-
@remote_dir = ( options.has_key?(:remote_dir) ? string(options[:remote_dir]) : '' )
|
14
|
-
|
15
|
-
self.directory = ( options.has_key?(:directory) ? string(options[:directory]) : '' )
|
16
|
-
end
|
17
|
-
|
18
|
-
#-----------------------------------------------------------------------------
|
19
|
-
# Property accessors / modifiers
|
20
|
-
|
21
|
-
attr_accessor :name, :remote_dir
|
22
|
-
attr_reader :directory
|
23
|
-
|
24
|
-
#---
|
25
|
-
|
26
|
-
def directory=directory
|
27
|
-
@directory = string(directory)
|
28
|
-
ensure_directory
|
29
|
-
end
|
30
|
-
|
31
|
-
#-----------------------------------------------------------------------------
|
32
|
-
|
33
|
-
def ensure_directory
|
34
|
-
unless @directory.empty?
|
35
|
-
# @TODO: This is not OS agnostic.
|
36
|
-
if ! File.directory?(@directory) && system("which mkdir 2>1 1>/dev/null")
|
37
|
-
system("sudo mkdir -p #{@directory}")
|
38
|
-
end
|
39
|
-
end
|
40
|
-
return self
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
data/spec/coral_test_kernel.rb
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
|
2
|
-
module Kernel
|
3
|
-
|
4
|
-
#-----------------------------------------------------------------------------
|
5
|
-
# Utilities
|
6
|
-
|
7
|
-
def capture
|
8
|
-
out = StringIO.new
|
9
|
-
$stdout = out
|
10
|
-
|
11
|
-
error = StringIO.new
|
12
|
-
$stderr = error
|
13
|
-
|
14
|
-
# Go do stuff!
|
15
|
-
yield
|
16
|
-
return out, error
|
17
|
-
|
18
|
-
ensure
|
19
|
-
$stdout = STDOUT
|
20
|
-
$stderr = STDERR
|
21
|
-
end
|
22
|
-
end
|
data/spec/spec_helper.rb
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
|
2
|
-
require 'rspec'
|
3
|
-
require 'stringio'
|
4
|
-
require 'coral_cloud'
|
5
|
-
|
6
|
-
require 'coral_test_kernel'
|
7
|
-
|
8
|
-
#-------------------------------------------------------------------------------
|
9
|
-
|
10
|
-
RSpec.configure do |config|
|
11
|
-
config.mock_framework = :rspec
|
12
|
-
config.color_enabled = true
|
13
|
-
config.formatter = 'documentation'
|
14
|
-
end
|