chef-sugar-rackspace 0.1.0 → 0.2.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0a6820d1392d7a9e7f808613c22489c866dfe7cd
4
- data.tar.gz: 5a2c7437d3f1add57ef36f2fadb14f9525259e2e
3
+ metadata.gz: 0283047c23349f14f045529d7f6c3ef9a63c8c02
4
+ data.tar.gz: 43f6d7037c2e4bb5d25205c28a1c37711b431179
5
5
  SHA512:
6
- metadata.gz: 497b4c6687531ec350df7b22964914743300bc104fc99acb3ba0af02951f6d53c4778fa09bbecfdfb3a577764e70603287805f10ebd43c83a5af974412493fe7
7
- data.tar.gz: 571569be3abefa333f5ed53acf06110f7e3ceb1ec62a0f91914a8a26fc9e5b14a6049240f1d64f4266a27c5a876f8a58584564e5dce861d36f6dcb6d4dbf5411
6
+ metadata.gz: 4c3b2319fa418958f59f8a87625acd5369c27843156a4f579ea54a37003e23fbc5a797b6b886e268145b8f9d27759a5948f33852f5f7eef042b370f47de54a42
7
+ data.tar.gz: b38250b16635c73386bcde1592434644d21f27afcd5a6883d08637fdf8ef938928215eb994e9321255ed1d8a4d64c7f54ccc4fbc08eb79ceda65c4152eeb1982
data/.gitignore CHANGED
@@ -26,7 +26,7 @@ build/
26
26
 
27
27
  # for a library or gem, you might want to ignore these files since the code is
28
28
  # intended to run in multiple environments; otherwise, check them in:
29
- # Gemfile.lock
29
+ Gemfile.lock
30
30
  # .ruby-version
31
31
  # .ruby-gemset
32
32
 
data/.travis.yml ADDED
@@ -0,0 +1,6 @@
1
+ language: ruby
2
+ sudo: false
3
+ rvm:
4
+ - 2.1.0
5
+
6
+ script: bundle exec rake
data/CHANGELOG.md CHANGED
@@ -1,6 +1,10 @@
1
1
  chef-sugar-rackspace CHANGELOG
2
2
  ==============================
3
3
 
4
+ 0.2.0
5
+ -----
6
+ - [jarosser06] - Added rackconnected? sugar method
7
+
4
8
  0.1.0
5
9
  -----
6
10
  - [jarosser06] - Initial release of chef-sugar-rackspace
data/README.md CHANGED
@@ -1,3 +1,83 @@
1
1
  chef-sugar-rackspace
2
2
  ====================
3
+ [![Gem Version](https://badge.fury.io/rb/chef-sugar-rackspace.svg)](http://badge.fury.io/rb/chef-sugar-rackspace)
4
+
3
5
  Chef Sugar Extensions useful if you use Rackspace as a provider
6
+
7
+ Usage
8
+ -----
9
+ Include it in your Chef recipes:
10
+
11
+ ```ruby
12
+ include_recipe 'chef-sugar-rackspace::default'
13
+ ```
14
+
15
+ ### Rackconnect
16
+ Rackconnect helpers require the [Rackconnect Ohai plugin](https://github.com/jarosser06/ohai-rackconnect) to be installed.
17
+
18
+ - `rackconnected?` - return true if the node is rackconnected
19
+
20
+ #### rackconnected?
21
+ ```ruby
22
+ unless rackconnected?
23
+ include_recipes 'firewall'
24
+ end
25
+ ```
26
+
27
+ ### IP
28
+ - `cloud_network_ip` - return the node's ip from a Rackspace cloud network
29
+ - `best_rackspace_ip_for` - determine the best IP address for a given node, preferring a cloud network IP address
30
+ - `cloud_networks` - return Rackspace cloud networks as a Hash with each key being a cloud network label
31
+
32
+ #### cloud_network_ip
33
+ ```ruby
34
+ node.set['redis']['bind'] = cloud_network_ip
35
+ ```
36
+
37
+ cloud_network_ip takes an optional argument of the Cloud Network Label
38
+ ```ruby
39
+ node.set['redis']['bind'] = cloud_network_ip('mycloudnetwork')
40
+ ```
41
+
42
+ #### best_rackspace_ip_for
43
+ Prefers a connected Rackspace cloud network IP but falls through to using the
44
+ default Chef Sugar best_ip_for() method if one does not exist.
45
+
46
+ ```ruby
47
+ memcached = search('node', 'tags:memcached').first
48
+
49
+ memcahed_ip = best_rackspace_ip_for(memcached)
50
+ ```
51
+
52
+ #### cloud_networks
53
+ ```ruby
54
+ private_networks = cloud_networks
55
+ ```
56
+
57
+ License & Authors
58
+ -----------------
59
+ - Author: Jim Rosser (jarosser06@gmail.com)
60
+
61
+ ```text
62
+ copyright (C) 2015 Jim Rosser
63
+
64
+ Permission is hereby granted, free of charge, to any person
65
+ obtaining a copy of this software and associated documentation
66
+ files (the “Software”), to deal in the Software without restriction,
67
+ including without limitation the rights to use, copy, modify, merge,
68
+ publish, distribute, sublicense, and/or sell copies of the Software,
69
+ and to permit persons to whom the Software is furnished to do so,
70
+ subject to the following conditions:
71
+
72
+ The above copyright notice and this permission notice shall be
73
+ included in all copies or substantial portions of the Software.
74
+
75
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
76
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
77
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
78
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
79
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
80
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
81
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
82
+ OTHER DEALINGS IN THE SOFTWARE.
83
+ ```
@@ -1,6 +1,7 @@
1
1
  class Chef
2
2
  module Sugar
3
3
  require_relative 'rackspace/ip'
4
+ require_relative 'rackspace/rackconnect'
4
5
  end
5
6
  end
6
7
 
@@ -0,0 +1,24 @@
1
+ require 'chef/sugar'
2
+
3
+ class Chef
4
+ module Sugar
5
+ module Rackconnect
6
+ extend self
7
+
8
+ def rackconnected?(node)
9
+ return false unless node.has_key? 'rackspace'
10
+ if node['rackspace'].has_key? 'rackconnect'
11
+ return node['rackspace']['rackconnect']['enabled']
12
+ else
13
+ fail 'must have rackconnect ohai plugin installed'
14
+ end
15
+ end
16
+ end
17
+
18
+ module DSL
19
+ def rackconnected?
20
+ Chef::Sugar::Rackconnect.rackconnected?(node)
21
+ end
22
+ end
23
+ end
24
+ end
@@ -1,7 +1,7 @@
1
1
  class Chef
2
2
  module Sugar
3
3
  module Rackspace
4
- VERSION = '0.1.0'
4
+ VERSION = '0.2.0'
5
5
  end
6
6
  end
7
7
  end
@@ -0,0 +1,42 @@
1
+ require 'spec_helper'
2
+
3
+ describe Chef::Sugar::Rackconnect do
4
+
5
+ fake_node = {
6
+ 'rackspace' => {}
7
+ }
8
+
9
+ let(:node) { fake_node }
10
+
11
+ context 'when the ohai plugin is not found' do
12
+ it '#rackconnected? raises an error' do
13
+ expect{described_class.rackconnected?(node)}.to raise_error(RuntimeError)
14
+ end
15
+ end
16
+
17
+ context 'when rackconnected' do
18
+ before do
19
+ node['rackspace'] = {
20
+ 'rackconnect' => {
21
+ 'enabled' => true
22
+ }
23
+ }
24
+ end
25
+ it '#rackconnected? returns true' do
26
+ expect(described_class.rackconnected?(node)).to eq(true)
27
+ end
28
+ end
29
+
30
+ context 'when not rackconnected' do
31
+ before do
32
+ node['rackspace'] = {
33
+ 'rackconnect' => {
34
+ 'enabled' => false
35
+ }
36
+ }
37
+ end
38
+ it '#rackconnected? returns false' do
39
+ expect(described_class.rackconnected?(node)).to eq(false)
40
+ end
41
+ end
42
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef-sugar-rackspace
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jim Rosser
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-14 00:00:00.000000000 Z
11
+ date: 2015-04-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chef-sugar
@@ -103,21 +103,23 @@ extra_rdoc_files: []
103
103
  files:
104
104
  - ".gitignore"
105
105
  - ".kitchen.yml"
106
+ - ".travis.yml"
106
107
  - Berksfile
107
108
  - CHANGELOG.md
108
109
  - Gemfile
109
- - Gemfile.lock
110
110
  - LICENSE
111
111
  - README.md
112
112
  - Rakefile
113
113
  - chef-sugar-rackspace.gemspec
114
114
  - lib/chef/sugar/rackspace.rb
115
115
  - lib/chef/sugar/rackspace/ip.rb
116
+ - lib/chef/sugar/rackspace/rackconnect.rb
116
117
  - lib/chef/sugar/rackspace/version.rb
117
118
  - metadata.rb
118
119
  - recipes/default.rb
119
120
  - spec/spec_helper.rb
120
121
  - spec/unit/chef/sugar/rackspace/ip_spec.rb
122
+ - spec/unit/chef/sugar/rackspace/rackconnect_spec.rb
121
123
  homepage: https://github.com/jarosser06/chef-sugar-rackspace
122
124
  licenses:
123
125
  - MIT
@@ -146,4 +148,5 @@ summary: A collection of helper methods and modules, extending the helper method
146
148
  test_files:
147
149
  - spec/spec_helper.rb
148
150
  - spec/unit/chef/sugar/rackspace/ip_spec.rb
151
+ - spec/unit/chef/sugar/rackspace/rackconnect_spec.rb
149
152
  has_rdoc:
data/Gemfile.lock DELETED
@@ -1,125 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- chef-sugar-rackspace (0.0.1)
5
- chef-sugar (~> 2.0)
6
-
7
- GEM
8
- remote: https://rubygems.org/
9
- specs:
10
- chef (12.0.3)
11
- chef-zero (~> 3.2)
12
- diff-lcs (~> 1.2, >= 1.2.4)
13
- erubis (~> 2.7)
14
- ffi-yajl (~> 1.2)
15
- highline (~> 1.6, >= 1.6.9)
16
- mixlib-authentication (~> 1.3)
17
- mixlib-cli (~> 1.4)
18
- mixlib-config (~> 2.0)
19
- mixlib-log (~> 1.3)
20
- mixlib-shellout (>= 2.0.0.rc.0, < 3.0)
21
- net-ssh (~> 2.6)
22
- net-ssh-multi (~> 1.1)
23
- ohai (~> 8.0)
24
- plist (~> 3.1.0)
25
- pry (~> 0.9)
26
- chef-sugar (2.5.0)
27
- chef-zero (3.2.1)
28
- ffi-yajl (~> 1.1)
29
- hashie (~> 2.0)
30
- mixlib-log (~> 1.3)
31
- rack
32
- uuidtools (~> 2.1)
33
- chefspec (4.2.0)
34
- chef (>= 11.14)
35
- fauxhai (~> 2.0)
36
- rspec (~> 3.0)
37
- coderay (1.1.0)
38
- diff-lcs (1.2.5)
39
- erubis (2.7.0)
40
- fauxhai (2.3.0)
41
- net-ssh
42
- ohai
43
- ffi (1.9.6)
44
- ffi-yajl (1.3.1)
45
- ffi (~> 1.5)
46
- libyajl2 (~> 1.2)
47
- hashie (2.1.2)
48
- highline (1.6.21)
49
- ipaddress (0.8.0)
50
- kitchen-vagrant (0.15.0)
51
- test-kitchen (~> 1.0)
52
- libyajl2 (1.2.0)
53
- method_source (0.8.2)
54
- mime-types (1.25.1)
55
- mixlib-authentication (1.3.0)
56
- mixlib-log
57
- mixlib-cli (1.5.0)
58
- mixlib-config (2.1.0)
59
- mixlib-log (1.6.0)
60
- mixlib-shellout (2.0.1)
61
- net-dhcp (1.3.2)
62
- net-scp (1.2.1)
63
- net-ssh (>= 2.6.5)
64
- net-ssh (2.9.2)
65
- net-ssh-gateway (1.2.0)
66
- net-ssh (>= 2.6.5)
67
- net-ssh-multi (1.2.0)
68
- net-ssh (>= 2.6.5)
69
- net-ssh-gateway (>= 1.2.0)
70
- ohai (8.0.1)
71
- ffi (~> 1.9)
72
- ffi-yajl (~> 1.1)
73
- ipaddress
74
- mime-types (~> 1.16)
75
- mixlib-cli
76
- mixlib-config (~> 2.0)
77
- mixlib-log
78
- mixlib-shellout (~> 2.0)
79
- net-dhcp
80
- rake (~> 10.1)
81
- systemu (~> 2.6.4)
82
- wmi-lite (~> 1.0)
83
- plist (3.1.0)
84
- pry (0.10.1)
85
- coderay (~> 1.1.0)
86
- method_source (~> 0.8.1)
87
- slop (~> 3.4)
88
- rack (1.6.0)
89
- rake (10.4.2)
90
- rspec (3.2.0)
91
- rspec-core (~> 3.2.0)
92
- rspec-expectations (~> 3.2.0)
93
- rspec-mocks (~> 3.2.0)
94
- rspec-core (3.2.0)
95
- rspec-support (~> 3.2.0)
96
- rspec-expectations (3.2.0)
97
- diff-lcs (>= 1.2.0, < 2.0)
98
- rspec-support (~> 3.2.0)
99
- rspec-mocks (3.2.0)
100
- diff-lcs (>= 1.2.0, < 2.0)
101
- rspec-support (~> 3.2.0)
102
- rspec-support (3.2.1)
103
- safe_yaml (1.0.4)
104
- slop (3.6.0)
105
- systemu (2.6.4)
106
- test-kitchen (1.3.1)
107
- mixlib-shellout (>= 1.2, < 3.0)
108
- net-scp (~> 1.1)
109
- net-ssh (~> 2.7)
110
- safe_yaml (~> 1.0)
111
- thor (~> 0.18)
112
- thor (0.19.1)
113
- uuidtools (2.1.5)
114
- wmi-lite (1.0.0)
115
-
116
- PLATFORMS
117
- ruby
118
-
119
- DEPENDENCIES
120
- bundler (~> 1.3)
121
- chef-sugar-rackspace!
122
- chefspec (~> 4.2)
123
- kitchen-vagrant (~> 0.15)
124
- rake
125
- test-kitchen (~> 1.3)