aether 0.0.4 → 0.0.5

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 1ee8c6e6ee1b73062554844d29c67941a3d0ef31
4
+ data.tar.gz: c835460e7b5da9aefc8b1612f3ab77a6d649f6aa
5
+ SHA512:
6
+ metadata.gz: ab1bb6be9cc862d4109cc0ef009c626a07d9b7f3978325f409fdc672831aa6df4ca40b72622bd0b61fb0258c4436fb6293787049cd91a89eab14c5ff2011cdf1
7
+ data.tar.gz: d261406ad10e3fd1e07cf18190d07cb4fa67e482ba905d5afc391ede008885a7618750d6fa3bca9ae5e053aa9dfbb2a69b6c1cdb018205d1b8f368549c738dcd
File without changes
data/README.md CHANGED
@@ -1,15 +1,14 @@
1
1
  # Aether
2
2
 
3
3
  Aether is a simple wrapper over the [Ridley Rubygem](http://rubygems.org/gems/ridley) that returns
4
- server information from a Hosted Chef Server.
4
+ server information from a Chef Server.
5
5
 
6
6
  The `Aether::Chef` class is mainly used in Capistrano recipes.
7
7
 
8
8
 
9
9
  ## Disclaimer
10
10
 
11
- This was built when the Ridley interface was in flux and we needed a consistent way to access node attributes.
12
- Ridley has since added most of the same node related methods so you should probably use Ridley directly.
11
+ This is a thin wrapper over the Ridley interface that adds some Node level convenience methods.
13
12
 
14
13
 
15
14
  ## Usage
@@ -4,12 +4,6 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
  require 'aether/version'
5
5
 
6
6
  Gem::Specification.new do |gem|
7
- gem.add_development_dependency('rake', '>= 0.8')
8
- gem.add_development_dependency('rspec', '~> 2.11')
9
- gem.add_development_dependency('hashie', '~> 1.2')
10
-
11
- gem.add_dependency('ridley', '= 0.6.3')
12
-
13
7
  gem.name = "aether"
14
8
  gem.version = Aether::VERSION
15
9
  gem.authors = ["Bitium, Inc"]
@@ -22,4 +16,10 @@ Gem::Specification.new do |gem|
22
16
  gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
23
17
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
24
18
  gem.require_paths = ["lib"]
19
+
20
+ gem.add_development_dependency('rake', '>= 0.8')
21
+ gem.add_development_dependency('rspec', '~> 2.14')
22
+ gem.add_development_dependency('hashie', '~> 2.0')
23
+
24
+ gem.add_dependency('ridley', '~> 2.4')
25
25
  end
@@ -2,4 +2,5 @@ require 'ridley'
2
2
 
3
3
  require 'aether/version'
4
4
  require 'aether/node'
5
+ require 'aether/data_bag_item'
5
6
  require 'aether/chef'
@@ -3,15 +3,14 @@ module Aether
3
3
 
4
4
  attr_reader :connection, :environment
5
5
 
6
- def initialize(options = {})
7
- @connection = Ridley::Connection.new(
8
- :server_url => options[:server_url],
9
- :client_name => options[:client_name],
10
- :client_key => options[:client_key],
11
- :organization => options[:organization]
6
+ def initialize(opts = {})
7
+ @connection = Ridley.new(
8
+ server_url: opts[:server_url],
9
+ client_name: opts[:client_name],
10
+ client_key: opts[:client_key]
12
11
  )
13
12
 
14
- @environment = options[:environment]
13
+ @environment = opts[:environment]
15
14
  end
16
15
 
17
16
  def find_nodes(options = {}, include_environment = true)
@@ -27,7 +26,8 @@ module Aether
27
26
  end
28
27
 
29
28
  def find_data_bag_item(bag_name, item_name)
30
- connection.data_bag.all.find{ |bag| bag.name == bag_name }.item.find(item_name).attributes
29
+ data_bag_item = connection.data_bag.all.find{ |bag| bag.name == bag_name }.item.find(item_name)
30
+ Aether::DataBagItem.new(data_bag_item)
31
31
  end
32
32
 
33
33
  def build_search_query(options = {})
@@ -0,0 +1,11 @@
1
+ module Aether
2
+ class DataBagItem
3
+
4
+ attr_reader :attributes
5
+
6
+ def initialize(data_bag_item)
7
+ @attributes = data_bag_item.attributes
8
+ end
9
+
10
+ end
11
+ end
@@ -1,21 +1,20 @@
1
1
  module Aether
2
2
  class Node
3
3
 
4
- attr_reader :name, :attributes, :raw
4
+ attr_reader :name, :attributes
5
5
 
6
6
  def initialize(node)
7
7
  @name = node.name
8
- @attributes = node.attributes
9
- @raw = node
8
+ @attributes = node.chef_attributes
10
9
  end
11
10
 
12
11
  def ipaddress
13
- @ipaddress ||= attributes[:automatic][:ipaddress]
12
+ @ipaddress ||= attributes.ipaddress
14
13
  end
15
14
  alias_method :local_ipv4, :ipaddress
16
15
 
17
16
  def hostname
18
- @hostname ||= attributes[:automatic][:fqdn]
17
+ @hostname ||= attributes.fqdn
19
18
  end
20
19
  alias_method :fqdn, :hostname
21
20
 
@@ -1,3 +1,3 @@
1
1
  module Aether
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
@@ -7,7 +7,7 @@ describe Aether::Chef do
7
7
  let(:chef_server) { Aether::Chef.new(chef_server_info) }
8
8
 
9
9
  it "sets the connection" do
10
- expect(chef_server.connection).to be_an_instance_of(Ridley::Connection)
10
+ expect(chef_server.connection).to be_an_instance_of(Ridley::Client)
11
11
  end
12
12
 
13
13
  it "sets the environment" do
@@ -50,11 +50,10 @@ describe Aether::Chef do
50
50
  describe "#find_nodes" do
51
51
  let(:chef_server) { Aether::Chef.new(chef_server_info) }
52
52
 
53
- it "returns an array of Chef::Server" do
53
+ it "returns an array of Aether::Node" do
54
54
  results = chef_server.find_nodes(:roles => ['web-server'])
55
55
  expect(results).to be_an_instance_of(Array)
56
56
  expect(results.first).to be_an_instance_of(Aether::Node)
57
57
  end
58
58
  end
59
-
60
59
  end
@@ -0,0 +1,11 @@
1
+ require 'spec_helper'
2
+
3
+ describe Aether::DataBagItem do
4
+ let(:data_bag_item) { Aether::DataBagItem.new(mock_data_bag_item) }
5
+
6
+ describe "#attributes" do
7
+ it "returns the data bag item attributes" do
8
+ expect(data_bag_item.attributes.primary_hostname.integration).to eq(mock_data_bag_item.attributes.primary_hostname.integration)
9
+ end
10
+ end
11
+ end
@@ -6,28 +6,28 @@ describe Aether::Node do
6
6
  describe "#ipaddress" do
7
7
  it "returns the ip address" do
8
8
  expect(node.ipaddress).to_not be_blank
9
- expect(node.ipaddress).to eq(mock_node.attributes.automatic.ipaddress)
9
+ expect(node.ipaddress).to eq(mock_node.chef_attributes.ipaddress)
10
10
  end
11
11
  end
12
12
 
13
13
  describe "#local_ipv4" do
14
14
  it "returns the ip address" do
15
15
  expect(node.local_ipv4).to_not be_blank
16
- expect(node.local_ipv4).to eq(mock_node.attributes.automatic.ipaddress)
16
+ expect(node.local_ipv4).to eq(mock_node.chef_attributes.ipaddress)
17
17
  end
18
18
  end
19
19
 
20
20
  describe "#hostname" do
21
21
  it "returns the fqdn" do
22
22
  expect(node.hostname).to_not be_blank
23
- expect(node.hostname).to eq(mock_node.attributes.automatic.fqdn)
23
+ expect(node.hostname).to eq(mock_node.chef_attributes.fqdn)
24
24
  end
25
25
  end
26
26
 
27
27
  describe "#fqdn" do
28
28
  it "returns the fqdn" do
29
29
  expect(node.fqdn).to_not be_blank
30
- expect(node.fqdn).to eq(mock_node.attributes.automatic.fqdn)
30
+ expect(node.fqdn).to eq(mock_node.chef_attributes.fqdn)
31
31
  end
32
32
  end
33
33
  end
@@ -25,11 +25,18 @@ end
25
25
  def mock_node
26
26
  @mock_node ||= Hashie::Mash.new(
27
27
  :name => 'web01.staging.foo.com',
28
+ :public_hostname => 'web01.staging.foo.com',
29
+ :chef_attributes => {
30
+ :fqdn => 'web01.staging.foo.com',
31
+ :ipaddress => '10.0.10.15'
32
+ }
33
+ )
34
+ end
35
+
36
+ def mock_data_bag_item
37
+ @mock_data_bag_item ||= Hashie::Mash.new(
28
38
  :attributes => {
29
- :automatic => {
30
- :fqdn => 'web01.staging.foo.com',
31
- :ipaddress => '10.0.10.15'
32
- }
39
+ :primary_hostname => Hashie::Mash.new(:integration => 'integration.foo.com', :staging => 'staging.foo.com')
33
40
  }
34
41
  )
35
42
  end
metadata CHANGED
@@ -1,80 +1,71 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aether
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
5
- prerelease:
4
+ version: 0.0.5
6
5
  platform: ruby
7
6
  authors:
8
7
  - Bitium, Inc
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-02-28 00:00:00.000000000 Z
11
+ date: 2014-01-22 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: rake
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - '>='
20
18
  - !ruby/object:Gem::Version
21
19
  version: '0.8'
22
20
  type: :development
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - '>='
28
25
  - !ruby/object:Gem::Version
29
26
  version: '0.8'
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: rspec
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
31
  - - ~>
36
32
  - !ruby/object:Gem::Version
37
- version: '2.11'
33
+ version: '2.14'
38
34
  type: :development
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
38
  - - ~>
44
39
  - !ruby/object:Gem::Version
45
- version: '2.11'
40
+ version: '2.14'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: hashie
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
45
  - - ~>
52
46
  - !ruby/object:Gem::Version
53
- version: '1.2'
47
+ version: '2.0'
54
48
  type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
52
  - - ~>
60
53
  - !ruby/object:Gem::Version
61
- version: '1.2'
54
+ version: '2.0'
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: ridley
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - '='
59
+ - - ~>
68
60
  - !ruby/object:Gem::Version
69
- version: 0.6.3
61
+ version: '2.4'
70
62
  type: :runtime
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - '='
66
+ - - ~>
76
67
  - !ruby/object:Gem::Version
77
- version: 0.6.3
68
+ version: '2.4'
78
69
  description: Simple wrapper over Ridley gem (a Chef API client)
79
70
  email:
80
71
  - devops@bitium.com
@@ -85,51 +76,47 @@ files:
85
76
  - .gitignore
86
77
  - .rspec
87
78
  - Gemfile
88
- - LICENSE.txt
79
+ - MIT-LICENSE
89
80
  - README.md
90
81
  - Rakefile
91
82
  - aether.gemspec
92
83
  - lib/aether.rb
93
84
  - lib/aether/chef.rb
85
+ - lib/aether/data_bag_item.rb
94
86
  - lib/aether/node.rb
95
87
  - lib/aether/version.rb
96
88
  - spec/aether/chef_spec.rb
89
+ - spec/aether/data_bag_item_spec.rb
97
90
  - spec/aether/node_spec.rb
98
91
  - spec/chef_server.yml.example
99
92
  - spec/spec_helper.rb
100
93
  homepage: https://github.com/bitium/aether
101
94
  licenses: []
95
+ metadata: {}
102
96
  post_install_message:
103
97
  rdoc_options: []
104
98
  require_paths:
105
99
  - lib
106
100
  required_ruby_version: !ruby/object:Gem::Requirement
107
- none: false
108
101
  requirements:
109
- - - ! '>='
102
+ - - '>='
110
103
  - !ruby/object:Gem::Version
111
104
  version: '0'
112
- segments:
113
- - 0
114
- hash: -4399038687224913869
115
105
  required_rubygems_version: !ruby/object:Gem::Requirement
116
- none: false
117
106
  requirements:
118
- - - ! '>='
107
+ - - '>='
119
108
  - !ruby/object:Gem::Version
120
109
  version: '0'
121
- segments:
122
- - 0
123
- hash: -4399038687224913869
124
110
  requirements: []
125
111
  rubyforge_project:
126
- rubygems_version: 1.8.24
112
+ rubygems_version: 2.1.11
127
113
  signing_key:
128
- specification_version: 3
114
+ specification_version: 4
129
115
  summary: Provides helper methods to be used in Capistrano recipes to retrieve server
130
116
  info from a Chef Server
131
117
  test_files:
132
118
  - spec/aether/chef_spec.rb
119
+ - spec/aether/data_bag_item_spec.rb
133
120
  - spec/aether/node_spec.rb
134
121
  - spec/chef_server.yml.example
135
122
  - spec/spec_helper.rb