aether 0.0.1
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/.gitignore +18 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +18 -0
- data/Rakefile +1 -0
- data/aether.gemspec +23 -0
- data/lib/aether.rb +39 -0
- data/lib/aether/version.rb +3 -0
- metadata +92 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2012 Bitium, Inc
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
Aether
|
2
|
+
======
|
3
|
+
|
4
|
+
Aether is a simple wrapper over the [Ridley Rubygem](http://rubygems.org/gems/ridley) that returns
|
5
|
+
server information from a Hosted Chef Server.
|
6
|
+
|
7
|
+
The `Ather::Chef` class is mainly used in Capistrano recipes.
|
8
|
+
|
9
|
+
|
10
|
+
Sample Usage
|
11
|
+
------------
|
12
|
+
|
13
|
+
chef_server = Ather::Chef.new(:server_url => 'https://api.opscode.com/organizations/foo', :client_name => 'foo',
|
14
|
+
:client_key => '/path/to/.chef/foo.pem', :organization => 'foo', :environment => 'production')
|
15
|
+
|
16
|
+
webservers = chef_server.find_webservers # returns an array of Ridley::Node
|
17
|
+
|
18
|
+
any_servers = chef_server.find_servers(:role => 'a-chef-role') # returns an array of Ridley::Node
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/aether.gemspec
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'aether/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |gem|
|
7
|
+
gem.add_development_dependency('rake', '>= 0.8')
|
8
|
+
|
9
|
+
gem.add_dependency('ridley', '~> 0.2')
|
10
|
+
|
11
|
+
gem.name = "aether"
|
12
|
+
gem.version = Aether::VERSION
|
13
|
+
gem.authors = ["Bitium, Inc"]
|
14
|
+
gem.email = ["devops@bitium.com"]
|
15
|
+
gem.description = %q{Simple wrapper over Ridley gem (a Chef API client)}
|
16
|
+
gem.summary = %q{Provides helper methods to be used in Capistrano recipes to retrieve server info from a Chef Server}
|
17
|
+
gem.homepage = "https://github.com/bitium/aether"
|
18
|
+
|
19
|
+
gem.files = `git ls-files`.split($/)
|
20
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
21
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
22
|
+
gem.require_paths = ["lib"]
|
23
|
+
end
|
data/lib/aether.rb
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'aether/version'
|
2
|
+
require 'ridley'
|
3
|
+
|
4
|
+
|
5
|
+
module Aether
|
6
|
+
class Chef
|
7
|
+
|
8
|
+
attr_reader :connection, :environment
|
9
|
+
|
10
|
+
def initialize(options = {})
|
11
|
+
@connection = Ridley::Connection.new(
|
12
|
+
:server_url => options[:server_url],
|
13
|
+
:client_name => options[:client_name],
|
14
|
+
:client_key => options[:client_key],
|
15
|
+
:organization => options[:organization]
|
16
|
+
)
|
17
|
+
|
18
|
+
@environment = options[:environment]
|
19
|
+
end
|
20
|
+
|
21
|
+
def find_servers(options)
|
22
|
+
role = options[:role]
|
23
|
+
connection.search(:node, "chef_environment:#{environment} AND role:#{role}")
|
24
|
+
end
|
25
|
+
|
26
|
+
def find_web_servers(role = 'web-server')
|
27
|
+
@web_servers ||= find_servers(:role => role)
|
28
|
+
end
|
29
|
+
|
30
|
+
def find_db_migration_server(role = 'db-migration-server')
|
31
|
+
@db_migration_server ||= find_servers(:role => role).first
|
32
|
+
end
|
33
|
+
|
34
|
+
def find_data_bag_item(bag_name, item_name)
|
35
|
+
@data_bag_item ||= connection.data_bag.all.find{ |bag| bag.name == bag_name }.item.find(item_name).attributes
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
end
|
metadata
ADDED
@@ -0,0 +1,92 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: aether
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Bitium, Inc
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-10-13 00:00:00.000000000 Z
|
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: '0.8'
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0.8'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: ridley
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0.2'
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0.2'
|
46
|
+
description: Simple wrapper over Ridley gem (a Chef API client)
|
47
|
+
email:
|
48
|
+
- devops@bitium.com
|
49
|
+
executables: []
|
50
|
+
extensions: []
|
51
|
+
extra_rdoc_files: []
|
52
|
+
files:
|
53
|
+
- .gitignore
|
54
|
+
- Gemfile
|
55
|
+
- LICENSE.txt
|
56
|
+
- README.md
|
57
|
+
- Rakefile
|
58
|
+
- aether.gemspec
|
59
|
+
- lib/aether.rb
|
60
|
+
- lib/aether/version.rb
|
61
|
+
homepage: https://github.com/bitium/aether
|
62
|
+
licenses: []
|
63
|
+
post_install_message:
|
64
|
+
rdoc_options: []
|
65
|
+
require_paths:
|
66
|
+
- lib
|
67
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
68
|
+
none: false
|
69
|
+
requirements:
|
70
|
+
- - ! '>='
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '0'
|
73
|
+
segments:
|
74
|
+
- 0
|
75
|
+
hash: 57900475441158562
|
76
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
77
|
+
none: false
|
78
|
+
requirements:
|
79
|
+
- - ! '>='
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '0'
|
82
|
+
segments:
|
83
|
+
- 0
|
84
|
+
hash: 57900475441158562
|
85
|
+
requirements: []
|
86
|
+
rubyforge_project:
|
87
|
+
rubygems_version: 1.8.24
|
88
|
+
signing_key:
|
89
|
+
specification_version: 3
|
90
|
+
summary: Provides helper methods to be used in Capistrano recipes to retrieve server
|
91
|
+
info from a Chef Server
|
92
|
+
test_files: []
|