spaux 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/spaux/chef/client.rb +7 -15
- data/lib/spaux/chef/default/client.rb +8 -0
- data/lib/spaux/{defaults → chef/default}/knife.rb +0 -0
- data/lib/spaux/chef/key.rb +7 -8
- data/lib/spaux/chef/knife.rb +1 -1
- data/lib/spaux/chef/{monkey_patches.rb → monkey_patches/client.rb} +0 -0
- data/lib/spaux/chef/{knife_monkey_patches.rb → monkey_patches/knife.rb} +1 -1
- data/lib/spaux/cli.rb +1 -10
- data/lib/spaux/config.rb +6 -0
- data/lib/spaux/version.rb +1 -1
- data/lib/spaux.rb +27 -3
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 98ef4d4b5b2c48f5bc4eb185a96c9ae636653482
|
4
|
+
data.tar.gz: cfd56cada6b0dc2cc3f082add195dfe014c7380a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 312b7fdb2479fdd59c6de22b2aab1ebe1b1aec0aae5edfd3bf7066ddfe54b9d1eea7317981d6e0804e1e8a0d70029ea96993288fec0d9caa40f74786d24c9a4d
|
7
|
+
data.tar.gz: bb268b6677d3403d947ae482efaa6d345b42b05b18dc7fa5d2a28e4159eaf6966e1501c75aeafba67b2ca6ba4b3b0ce05d2ccba6056b2fb25b84143042f8e918
|
data/lib/spaux/chef/client.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
require 'spaux/chef/key'
|
2
|
-
require 'spaux/chef/monkey_patches'
|
2
|
+
require 'spaux/chef/monkey_patches/client'
|
3
3
|
|
4
4
|
class Spaux
|
5
5
|
class Chef
|
@@ -7,27 +7,19 @@ class Spaux
|
|
7
7
|
attr_accessor :work_dir
|
8
8
|
attr_accessor :spaux_config
|
9
9
|
|
10
|
-
DEFAULT_CHEF_CONFIG = {
|
11
|
-
config_file: ::File.join('@work_dir', 'client.rb'),
|
12
|
-
cache_path: ::File.join('@work_dir', '.chef'),
|
13
|
-
client_key: ::File.join('@work_dir', 'client.pem'),
|
14
|
-
json_attribs: ::File.join('@work_dir', 'attributes.json'),
|
15
|
-
chef_server_url: 'https://api.opscode.com/organizations/spaux',
|
16
|
-
ssl_verify_mode: :verify_peer,
|
17
|
-
node_name: 'spaux',
|
18
|
-
override_runlist: ["recipe[spaux::machine]"]
|
19
|
-
}
|
20
|
-
|
21
10
|
def initialize(work_dir, *args)
|
22
11
|
@work_dir = work_dir
|
23
12
|
chef_config = args.shift || {}
|
24
13
|
spaux_config = args.shift || {}
|
25
14
|
super()
|
26
15
|
|
27
|
-
|
28
|
-
|
16
|
+
default_chef_config = Spaux::default_chef_config(:client)
|
17
|
+
|
18
|
+
default_chef_config.each { |_,v| v.is_a?(String) && v.gsub!(/@work_dir/, @work_dir) }
|
19
|
+
@config.merge! default_chef_config.merge(chef_config)
|
20
|
+
|
21
|
+
default_spaux_config = Spaux::default_spaux_config
|
29
22
|
|
30
|
-
default_spaux_config = Spaux::Chef::Key::DEFAULT_SPAUX_CONFIG
|
31
23
|
@spaux_config = default_spaux_config.merge(spaux_config)
|
32
24
|
#if !@spaux_config.eql?(default_spaux_config)
|
33
25
|
#trigger a reevalutation of the private key
|
@@ -0,0 +1,8 @@
|
|
1
|
+
config_file ::File.join('@work_dir', 'client.rb')
|
2
|
+
cache_path ::File.join('@work_dir', '.chef')
|
3
|
+
client_key ::File.join('@work_dir', 'client.pem')
|
4
|
+
json_attribs ::File.join('@work_dir', 'attributes.json')
|
5
|
+
chef_server_url 'https://api.opscode.com/organizations/spaux'
|
6
|
+
ssl_verify_mode :verify_peer
|
7
|
+
node_name 'spaux'
|
8
|
+
override_runlist ["recipe[spaux::machine]"]
|
File without changes
|
data/lib/spaux/chef/key.rb
CHANGED
@@ -8,20 +8,19 @@ class Spaux
|
|
8
8
|
attr_accessor :raw_key
|
9
9
|
attr_accessor :config
|
10
10
|
|
11
|
-
DEFAULT_SPAUX_CONFIG = {
|
12
|
-
chef_private_key_gist_id: '16b65a73953427ce9c40',
|
13
|
-
private_key: '~/.ssh/id_rsa',
|
14
|
-
aes_key_size: 256,
|
15
|
-
aes_cipher_mode: :CBC
|
16
|
-
}
|
17
|
-
|
18
11
|
def initialize(config={})
|
19
12
|
@work_dir = ::File.join(ENV['PWD'], 'current')
|
20
|
-
@config = config.merge(
|
13
|
+
@config = config.merge(default_spaux_config)
|
21
14
|
@raw_key ||= get_raw_key
|
22
15
|
end
|
23
16
|
|
24
17
|
private
|
18
|
+
# this is wrong, this should in Spaux class
|
19
|
+
def default_spaux_config
|
20
|
+
spaux_dir = ::File.expand_path(::File::join(__FILE__, '..', '..'))
|
21
|
+
config_file = ::File.join(spaux_dir, 'config.rb')
|
22
|
+
configuration = eval(::File.read(config_file))
|
23
|
+
end
|
25
24
|
def get_raw_key
|
26
25
|
key_filename = 'encrypted.rb'
|
27
26
|
key_file = ::File.join(@work_dir, key_filename)
|
data/lib/spaux/chef/knife.rb
CHANGED
File without changes
|
data/lib/spaux/cli.rb
CHANGED
@@ -10,16 +10,7 @@ class Spaux
|
|
10
10
|
option :current, :type => :boolean, :default => true,
|
11
11
|
:desc => 'Create and/or use a working directory in the current directory'
|
12
12
|
def converge
|
13
|
-
work_dir = options
|
14
|
-
if not work_dir
|
15
|
-
if ENV['SPAUX_HOME']
|
16
|
-
work_dir = ENV['SPAUX_HOME']
|
17
|
-
elsif options[:current]
|
18
|
-
work_dir = ::File.join(ENV['PWD'], 'current')
|
19
|
-
else
|
20
|
-
work_dir = Dir.mktmpdir
|
21
|
-
end
|
22
|
-
end
|
13
|
+
work_dir = get_work_dir(options)
|
23
14
|
FileUtils.mkdir_p work_dir
|
24
15
|
|
25
16
|
client = Spaux::Chef::Client.new(work_dir)
|
data/lib/spaux/config.rb
ADDED
data/lib/spaux/version.rb
CHANGED
data/lib/spaux.rb
CHANGED
@@ -4,10 +4,34 @@ require 'spaux/chef/client'
|
|
4
4
|
require 'spaux/chef/knife'
|
5
5
|
|
6
6
|
class Spaux
|
7
|
-
def self.
|
7
|
+
def self.default_config_dir(component)
|
8
8
|
lib_dir = ::File.expand_path(::File::join(__FILE__, '..'))
|
9
|
-
|
10
|
-
|
9
|
+
dir = case component
|
10
|
+
when :chef
|
11
|
+
chef_conf_dir = ::File::join(lib_dir, 'spaux', 'chef', 'default')
|
12
|
+
when :spaux
|
13
|
+
spaux_conf_dir = ::File::join(lib_dir, 'spaux')
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def self.default_chef_config(component)
|
18
|
+
filename = case component
|
19
|
+
when :client
|
20
|
+
'client.rb'
|
21
|
+
when :knife
|
22
|
+
'knife.rb'
|
23
|
+
else
|
24
|
+
raise 'Unknown component'
|
25
|
+
end
|
26
|
+
|
27
|
+
config_file = ::File.join(default_config_dir(:chef), filename)
|
28
|
+
::Chef::Config.from_string(::File.read(config_file), config_file)
|
11
29
|
::Chef::Config.configuration
|
12
30
|
end
|
31
|
+
|
32
|
+
def self.default_spaux_config
|
33
|
+
config_dir = default_config_dir(:spaux)
|
34
|
+
config_file = ::File.join(config_dir, 'config.rb')
|
35
|
+
configuration = eval(::File.read(config_file))
|
36
|
+
end
|
13
37
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spaux
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miguel Landaeta
|
@@ -183,12 +183,14 @@ files:
|
|
183
183
|
- examples/knife_minimal.rb
|
184
184
|
- lib/spaux.rb
|
185
185
|
- lib/spaux/chef/client.rb
|
186
|
+
- lib/spaux/chef/default/client.rb
|
187
|
+
- lib/spaux/chef/default/knife.rb
|
186
188
|
- lib/spaux/chef/key.rb
|
187
189
|
- lib/spaux/chef/knife.rb
|
188
|
-
- lib/spaux/chef/
|
189
|
-
- lib/spaux/chef/monkey_patches.rb
|
190
|
+
- lib/spaux/chef/monkey_patches/client.rb
|
191
|
+
- lib/spaux/chef/monkey_patches/knife.rb
|
190
192
|
- lib/spaux/cli.rb
|
191
|
-
- lib/spaux/
|
193
|
+
- lib/spaux/config.rb
|
192
194
|
- lib/spaux/version.rb
|
193
195
|
- spaux.gemspec
|
194
196
|
- spec/spaux_spec.rb
|