chef_instance 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data.tar.gz.sig +0 -0
- data/.gitignore +1 -0
- data/chef_instance.gemspec +2 -1
- data/lib/chef_instance/provider_instance.rb +1 -3
- data/lib/chef_instance/version.rb +1 -1
- data/test/convergence/Vagrantfile +42 -0
- data/test/convergence/cookbooks/exercise/libraries/exercise_provider.rb +12 -0
- data/test/convergence/cookbooks/exercise/libraries/exercise_resource.rb +14 -0
- data/test/convergence/cookbooks/exercise/metadata.rb +6 -0
- data/test/convergence/cookbooks/exercise/recipes/aerobics.rb +4 -0
- data/test/convergence/cookbooks/exercise/recipes/existing_runit.rb +7 -0
- data/test/convergence/cookbooks/exercise/recipes/existing_service.rb +7 -0
- data/test/convergence/cookbooks/exercise/recipes/package_runit.rb +7 -0
- data/test/convergence/cookbooks/exercise/recipes/package_service.rb +7 -0
- metadata +21 -93
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c6de492e79f481d20b71d57ff7569c8e3f43e44d
|
4
|
+
data.tar.gz: 978812a107552cf7dec8a5aba66fcedebf170628
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d032245fde3d21920e8c4528a713e73b2d9da30f6a075667db5e30f3e26e97d80783f3783cfbcfa9d243a0331ed51a00f9d10db8c187bcceb3de20ce905dab4a
|
7
|
+
data.tar.gz: b3d1ebcc1515504e3c0d123d00e2d0acf4ecd83f3983965f5e84c375ef8ad54a00ac2dda9c7c80ff06b7c29488d344ed32cb39cf0a5732eb585113b35757415f
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data.tar.gz.sig
CHANGED
Binary file
|
data/.gitignore
CHANGED
data/chef_instance.gemspec
CHANGED
@@ -6,7 +6,8 @@ Gem::Specification.new do |spec|
|
|
6
6
|
spec.version = ChefInstance::VERSION
|
7
7
|
spec.authors = ['Miah Johnson']
|
8
8
|
spec.email = %w(miah@chia-pet.org)
|
9
|
-
spec.description =
|
9
|
+
spec.description = 'A super class and utility objects to create' \
|
10
|
+
' stand-alone instances of software.'
|
10
11
|
spec.summary = 'Chef Resource & Provider Super Classes for' \
|
11
12
|
'building stand-alone instances of software.'
|
12
13
|
spec.homepage = 'https://gitlab.com/viscera/chef_instance'
|
@@ -20,10 +20,8 @@ module ChefInstance
|
|
20
20
|
end
|
21
21
|
|
22
22
|
# Determines the state of the resource _currently_
|
23
|
-
# @return [
|
23
|
+
# @return [TrueClass] This must be overridden in subclasses.
|
24
24
|
def load_current_resource
|
25
|
-
@current_resource = Chef::Resource::Instance.new(
|
26
|
-
@new_resource, @run_context)
|
27
25
|
end
|
28
26
|
|
29
27
|
# Installs the `install_type`
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# -*- mode: ruby -*-
|
2
|
+
# vi: set ft=ruby :
|
3
|
+
|
4
|
+
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
|
5
|
+
VAGRANTFILE_API_VERSION = '2'
|
6
|
+
ENV.delete('SSH_AUTH_SOCK')
|
7
|
+
|
8
|
+
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
|
9
|
+
# All Vagrant configuration is done here. The most common configuration
|
10
|
+
# options are documented and commented below. For a complete reference,
|
11
|
+
# please see the online documentation at vagrantup.com.
|
12
|
+
|
13
|
+
# Every Vagrant virtual environment requires a box to build off of.
|
14
|
+
config.vm.box = 'opscode-ubuntu-14.04'
|
15
|
+
|
16
|
+
# Provider-specific configuration so you can fine-tune various
|
17
|
+
# backing providers for Vagrant. These expose provider-specific options.
|
18
|
+
# Example for VirtualBox:
|
19
|
+
#
|
20
|
+
config.vm.provider 'virtualbox' do |vb|
|
21
|
+
vb.customize ['modifyvm', :id, '--memory', '1024']
|
22
|
+
end
|
23
|
+
|
24
|
+
config.vm.provision :shell,
|
25
|
+
inline: 'sudo apt-get -qqy update'
|
26
|
+
|
27
|
+
config.vm.provision :shell,
|
28
|
+
inline: 'sudo apt-get -qqy install curl'
|
29
|
+
|
30
|
+
config.vm.provision :shell,
|
31
|
+
inline: 'curl -sL' \
|
32
|
+
' https://www.getchef.com/chef/install.sh' \
|
33
|
+
' | sudo bash'
|
34
|
+
config.vm.provision :shell,
|
35
|
+
inline: 'sudo /opt/chef/embedded/bin/gem' \
|
36
|
+
' install chef_instance'
|
37
|
+
|
38
|
+
config.vm.provision :chef_solo do |chef|
|
39
|
+
chef.cookbooks_path = './cookbooks'
|
40
|
+
chef.add_recipe 'exercise::aerobics'
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'chef_instance/resource_instance'
|
2
|
+
|
3
|
+
class Chef
|
4
|
+
class Resource
|
5
|
+
# A simple exercise resource.
|
6
|
+
class ExerciseInstance < ChefInstance::Resource::Instance
|
7
|
+
def initialize(new_resource, run_context = nil)
|
8
|
+
super
|
9
|
+
@resource_name = :exercise_instance
|
10
|
+
@provider = Chef::Provider::ExerciseProvider
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chef_instance
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miah Johnson
|
@@ -130,98 +130,8 @@ dependencies:
|
|
130
130
|
- - "~>"
|
131
131
|
- !ruby/object:Gem::Version
|
132
132
|
version: 0.8.7.3
|
133
|
-
description:
|
134
|
-
|
135
|
-
|
136
|
-
## Why
|
137
|
-
|
138
|
-
What is our goal when we install a piece of daemonized software? Why does the
|
139
|
-
minutia of configuration concern us so greatly? Do we really want to emulate
|
140
|
-
shell scripts in a recipe and end up with hundreds of random resources on our node?
|
141
|
-
Why do I even care about resources on my node?
|
142
|
-
|
143
|
-
Before I answer those questions lets get back to our goal, which was?
|
144
|
-
|
145
|
-
Goal: A unique instance of a daemon with our supplied configuration.
|
146
|
-
|
147
|
-
## Usage
|
148
|
-
|
149
|
-
```
|
150
|
-
# In this hypothetical instance we have a 'pie' daemon named 'pumpkin' that stores
|
151
|
-
# pies recieved on port 314. We may want to run another instance called 'pecan' on
|
152
|
-
# a different port that receives different types of pies.
|
153
|
-
# htce::default.rb
|
154
|
-
pie_instance 'pumpkin' do
|
155
|
-
# File owner and group.
|
156
|
-
# Daemon user and group.
|
157
|
-
user 'pumpkin'
|
158
|
-
group 'pies'
|
159
|
-
# creates `/opt/pies/pumpkins` then stores all config and runtime data.
|
160
|
-
root_path '/opt/pies'
|
161
|
-
service_options({
|
162
|
-
port: 314,
|
163
|
-
store_pies: true,
|
164
|
-
daemon_args: %w(-Tsteaming -Sdelicious)
|
165
|
-
})
|
166
|
-
end
|
167
|
-
```
|
168
|
-
|
169
|
-
## How it works
|
170
|
-
|
171
|
-
Provides resource provider super classes for building instances of software.
|
172
|
-
|
173
|
-
```
|
174
|
-
class Chef
|
175
|
-
class Resource
|
176
|
-
class Daemon < Chef::Resource::Instance
|
177
|
-
end
|
178
|
-
end
|
179
|
-
end
|
180
|
-
```
|
181
|
-
|
182
|
-
Ignores system defaults (configuration, initscripts, etc).
|
183
|
-
|
184
|
-
## Installation
|
185
|
-
|
186
|
-
Because of Ruby library load race conditions with Chef and Gems you need to ensure that `chef_instance` is
|
187
|
-
installed before you execute Chef.
|
188
|
-
|
189
|
-
This can be achieved by:
|
190
|
-
|
191
|
-
- Install the Chef (through the Omnibus, or however you do it).
|
192
|
-
- Install `chef_instance` into the Ruby system used by Chef. If you used Omnibus you'll need to use the `gem`
|
193
|
-
command provided in `/opt/chef/embedded/bin`
|
194
|
-
|
195
|
-
## Code Style
|
196
|
-
|
197
|
-
This code follows the [Ruby Style Guide](https://github.com/bbatsov/ruby-style-guide) and all contributions should as well.
|
198
|
-
|
199
|
-
The code style is checked by [Rubocop](http://batsov.com/rubocop/) and can be checked by executing `rake test:rubocop` or `rubocop`.
|
200
|
-
|
201
|
-
[![Build Status](https://travis-ci.org/miah/chef_instance.png?branch=master)](https://travis-ci.org/miah/chef_instance)
|
202
|
-
[![Code Climate](https://codeclimate.com/github/miah/chef_instance.png)](https://codeclimate.com/github/miah/chef_instance)
|
203
|
-
[![Code Climate Coverage](https://codeclimate.com/github/miah/chef_instance/coverage.png)](https://codeclimate.com/github/miah/chef_instance)
|
204
|
-
[![Dependency Status](https://gemnasium.com/miah/chef_instance.svg)](https://gemnasium.com/miah/chef_instance)
|
205
|
-
|
206
|
-
# Author
|
207
|
-
|
208
|
-
Author:: Miah Johnson (<miah@chia-pet.org>)
|
209
|
-
|
210
|
-
# License
|
211
|
-
|
212
|
-
Copyright 2013 Miah Johnson
|
213
|
-
|
214
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
215
|
-
you may not use this file except in compliance with the License.
|
216
|
-
You may obtain a copy of the License at
|
217
|
-
|
218
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
219
|
-
|
220
|
-
Unless required by applicable law or agreed to in writing, software
|
221
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
222
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
223
|
-
See the License for the specific language governing permissions and
|
224
|
-
limitations under the License.
|
133
|
+
description: A super class and utility objects to create stand-alone instances of
|
134
|
+
software.
|
225
135
|
email:
|
226
136
|
- miah@chia-pet.org
|
227
137
|
executables: []
|
@@ -247,6 +157,15 @@ files:
|
|
247
157
|
- lib/chef_instance/service/init.rb
|
248
158
|
- lib/chef_instance/service/runit.rb
|
249
159
|
- lib/chef_instance/version.rb
|
160
|
+
- test/convergence/Vagrantfile
|
161
|
+
- test/convergence/cookbooks/exercise/libraries/exercise_provider.rb
|
162
|
+
- test/convergence/cookbooks/exercise/libraries/exercise_resource.rb
|
163
|
+
- test/convergence/cookbooks/exercise/metadata.rb
|
164
|
+
- test/convergence/cookbooks/exercise/recipes/aerobics.rb
|
165
|
+
- test/convergence/cookbooks/exercise/recipes/existing_runit.rb
|
166
|
+
- test/convergence/cookbooks/exercise/recipes/existing_service.rb
|
167
|
+
- test/convergence/cookbooks/exercise/recipes/package_runit.rb
|
168
|
+
- test/convergence/cookbooks/exercise/recipes/package_service.rb
|
250
169
|
- test/spec/install/existing_spec.rb
|
251
170
|
- test/spec/install/package_spec.rb
|
252
171
|
- test/spec/install_spec.rb
|
@@ -282,6 +201,15 @@ specification_version: 4
|
|
282
201
|
summary: Chef Resource & Provider Super Classes forbuilding stand-alone instances
|
283
202
|
of software.
|
284
203
|
test_files:
|
204
|
+
- test/convergence/Vagrantfile
|
205
|
+
- test/convergence/cookbooks/exercise/libraries/exercise_provider.rb
|
206
|
+
- test/convergence/cookbooks/exercise/libraries/exercise_resource.rb
|
207
|
+
- test/convergence/cookbooks/exercise/metadata.rb
|
208
|
+
- test/convergence/cookbooks/exercise/recipes/aerobics.rb
|
209
|
+
- test/convergence/cookbooks/exercise/recipes/existing_runit.rb
|
210
|
+
- test/convergence/cookbooks/exercise/recipes/existing_service.rb
|
211
|
+
- test/convergence/cookbooks/exercise/recipes/package_runit.rb
|
212
|
+
- test/convergence/cookbooks/exercise/recipes/package_service.rb
|
285
213
|
- test/spec/install/existing_spec.rb
|
286
214
|
- test/spec/install/package_spec.rb
|
287
215
|
- test/spec/install_spec.rb
|
metadata.gz.sig
CHANGED
Binary file
|