corl 0.5.17 → 0.5.18
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/VERSION +1 -1
- data/bootstrap/lib/shell/os.sh +43 -41
- data/bootstrap/os/ubuntu/00_base.sh +7 -2
- data/corl.gemspec +3 -3
- data/lib/CORL/machine/raspberrypi.rb +4 -1
- data/lib/CORL/node/raspberrypi.rb +0 -4
- data/lib/core/plugin/node.rb +1 -2
- data/lib/core/plugin/provisioner.rb +14 -1
- data/lib/nucleon/action/node/fact.rb +41 -41
- data/lib/nucleon/action/node/identity.rb +15 -1
- data/lib/puppet/indirector/corl.rb +7 -7
- data/lib/puppet/parser/functions/module_param.rb +5 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8361053e50647bdd9eda90cf1d701dd4e67823c4
|
4
|
+
data.tar.gz: 86bed71e62821663ea47a4209503ef228693592a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 670aa0ad353180661a50ae027714b5a50203139799269cf141b91292a9e3d438632afea20949ab4a6e726f9f25667bcb1ec6e9bd9f91969e40c621a1d1d95668
|
7
|
+
data.tar.gz: c319e39d3377b8ac4bd55ef451b27bbb3ccf34cd2912cff3f1d8c9ebc398b7a259f77aea7358e00f3abcd028cc25297da8d8af4da0042092deced8b3d838f7f7
|
data/.gitignore
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.5.
|
1
|
+
0.5.18
|
data/bootstrap/lib/shell/os.sh
CHANGED
@@ -7,61 +7,63 @@
|
|
7
7
|
# https://github.com/coto/server-easy-install/blob/master/lib/core.sh
|
8
8
|
#
|
9
9
|
#-------------------------------------------------------------------------------
|
10
|
+
# OS Information
|
10
11
|
|
11
12
|
function os_info() {
|
12
|
-
|
13
|
-
|
14
|
-
|
13
|
+
OS=`lowercase \`uname\``
|
14
|
+
KERNEL=`uname -r`
|
15
|
+
MACHINE=`uname -m`
|
15
16
|
|
16
|
-
|
17
|
+
#---
|
17
18
|
|
18
|
-
|
19
|
-
|
20
|
-
|
19
|
+
if [ "${OS}" == "windowsnt" ]
|
20
|
+
then
|
21
|
+
OS=windows
|
21
22
|
|
22
|
-
|
23
|
+
elif [ "${OS}" == "darwin" ]
|
24
|
+
then
|
25
|
+
OS=mac
|
26
|
+
else
|
27
|
+
if [ "${OS}" = "linux" ]
|
23
28
|
then
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
OS=`cat /etc/redhat-release |sed s/\ release.*//`
|
31
|
-
OS_NAME=`cat /etc/redhat-release | sed s/.*\(// | sed s/\)//`
|
32
|
-
OS_VERSION=`cat /etc/redhat-release | sed s/.*release\ // | sed s/\ .*//`
|
29
|
+
if [ -f /etc/redhat-release ]
|
30
|
+
then
|
31
|
+
OS=`cat /etc/redhat-release | sed s/\ release.*//`
|
32
|
+
OS=`lowercase "$OS"`
|
33
|
+
OS_NAME=`cat /etc/redhat-release | sed s/.*\(// | sed s/\)//`
|
34
|
+
OS_VERSION=`cat /etc/redhat-release | sed s/.*release\ // | sed s/\ .*//`
|
33
35
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
36
|
+
elif [ -f /etc/SuSE-release ]
|
37
|
+
then
|
38
|
+
OS=suse
|
39
|
+
OS_NAME=`cat /etc/SuSE-release | tr "\n" ' '| sed s/VERSION.*//`
|
40
|
+
OS_VERSION=`cat /etc/SuSE-release | tr "\n" ' ' | sed s/.*=\ //`
|
39
41
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
42
|
+
elif [ -f /etc/mandrake-release ]
|
43
|
+
then
|
44
|
+
OS=mandriva
|
45
|
+
OS_NAME=`cat /etc/mandrake-release | sed s/.*\(// | sed s/\)//`
|
46
|
+
OS_VERSION=`cat /etc/mandrake-release | sed s/.*release\ // | sed s/\ .*//`
|
45
47
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
48
|
+
elif [ -f /etc/debian_version ]
|
49
|
+
then
|
50
|
+
DIST=`cat /etc/lsb-release | grep '^DISTRIB_ID' | awk -F= '{ print $2 }'`
|
51
|
+
OS=`lowercase "$DIST"`
|
52
|
+
OS_NAME=`cat /etc/lsb-release | grep '^DISTRIB_CODENAME' | awk -F= '{ print $2 }'`
|
53
|
+
OS_VERSION=`cat /etc/lsb-release | grep '^DISTRIB_RELEASE' | awk -F= '{ print $2 }'`
|
54
|
+
|
55
|
+
elif [ -f /etc/UnitedLinux-release ]
|
56
|
+
then
|
57
|
+
DIST="${DIST}[`cat /etc/UnitedLinux-release | tr "\n" ' ' | sed s/VERSION.*//`]"
|
58
|
+
OS=`lowercase "$DIST"`
|
59
|
+
fi
|
58
60
|
fi
|
61
|
+
fi
|
59
62
|
}
|
60
63
|
|
61
64
|
#-------------------------------------------------------------------------------
|
62
65
|
# Utilities
|
63
66
|
|
64
67
|
function lowercase() {
|
65
|
-
|
68
|
+
echo "$1" | sed "y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/"
|
66
69
|
}
|
67
|
-
|
@@ -15,13 +15,18 @@ fi
|
|
15
15
|
# Set OpenDNS as our DNS lookup source
|
16
16
|
echo "3. Setting command DNS gateways"
|
17
17
|
echo "nameserver 208.67.222.222" | tee /etc/resolvconf/resolv.conf.d/base > /dev/null || exit 3
|
18
|
+
resolvconf -u || exit 4
|
19
|
+
|
20
|
+
# Force time update (for systems without a hardware clock / Raspberry Pi)
|
21
|
+
echo "4. Forcing system time update"
|
22
|
+
ntpdate -s time.nist.gov
|
18
23
|
|
19
24
|
# Update system packages
|
20
|
-
echo "
|
25
|
+
echo "5. Updating system packages"
|
21
26
|
apt-get update >/tmp/update.log 2>&1 || exit 5
|
22
27
|
|
23
28
|
# Install basic build packages.
|
24
|
-
echo "
|
29
|
+
echo "6. Ensuring basic libraries and development utilities"
|
25
30
|
apt-get -y install build-essential cmake rake bindfs libnl-dev libpopt-dev \
|
26
31
|
libssl-dev libcurl4-openssl-dev libxslt-dev libxml2-dev \
|
27
32
|
libyaml-dev libreadline-dev libncurses5-dev zlib1g-dev texinfo \
|
data/corl.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: corl 0.5.
|
5
|
+
# stub: corl 0.5.18 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "corl"
|
9
|
-
s.version = "0.5.
|
9
|
+
s.version = "0.5.18"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|
13
13
|
s.authors = ["Adrian Webb"]
|
14
|
-
s.date = "2015-
|
14
|
+
s.date = "2015-05-11"
|
15
15
|
s.description = "Framework that provides a simple foundation for growing organically in the cloud"
|
16
16
|
s.email = "adrian.webb@coralnexus.com"
|
17
17
|
s.executables = ["corl"]
|
@@ -107,7 +107,10 @@ class Raspberrypi < Nucleon.plugin_class(:CORL, :machine)
|
|
107
107
|
|
108
108
|
def reload(options = {})
|
109
109
|
super do
|
110
|
-
node.command('reboot', { :as_admin => true })
|
110
|
+
success = node.command('reboot', { :as_admin => true })
|
111
|
+
sleep 5
|
112
|
+
sleep 1 until running?
|
113
|
+
success
|
111
114
|
end
|
112
115
|
end
|
113
116
|
|
@@ -14,10 +14,6 @@ class Raspberrypi < Nucleon.plugin_class(:CORL, :node)
|
|
14
14
|
#-----------------------------------------------------------------------------
|
15
15
|
# Checks
|
16
16
|
|
17
|
-
def local?
|
18
|
-
false
|
19
|
-
end
|
20
|
-
|
21
17
|
#-----------------------------------------------------------------------------
|
22
18
|
# Property accessors / modifiers
|
23
19
|
|
data/lib/core/plugin/node.rb
CHANGED
@@ -25,11 +25,10 @@ class Node < Nucleon.plugin_class(:nucleon, :base)
|
|
25
25
|
|
26
26
|
unless reload
|
27
27
|
@cli_interface = Util::Liquid.new do |method, args, &code|
|
28
|
-
result =
|
28
|
+
result = command([ method, args ].flatten.join(' '), { :as_admin => true }) do |op, data|
|
29
29
|
code.call(op, data) if code
|
30
30
|
end
|
31
31
|
if result
|
32
|
-
result = result.first
|
33
32
|
warn(result.errors, { :i18n => false }) unless result.errors.empty?
|
34
33
|
end
|
35
34
|
result
|
@@ -222,8 +222,21 @@ class Provisioner < Nucleon.plugin_class(:nucleon, :base)
|
|
222
222
|
|
223
223
|
while config.has_key?(:extend) do
|
224
224
|
array(config.delete(:extend)).each do |parent|
|
225
|
-
parent
|
225
|
+
parent = profile_id(package, parent) unless parent.match('::')
|
226
|
+
parent_base = parent.sub(/::[^:]+$/, '')
|
226
227
|
parents << parent
|
228
|
+
|
229
|
+
if profiles[parent.to_sym].has_key?(:extend)
|
230
|
+
extends = []
|
231
|
+
array(profiles[parent.to_sym][:extend]).each do |extend|
|
232
|
+
if extend.include?('::')
|
233
|
+
extends << extend
|
234
|
+
else
|
235
|
+
extends << "#{parent_base}::#{extend}"
|
236
|
+
end
|
237
|
+
end
|
238
|
+
profiles[parent.to_sym][:extend] = extends
|
239
|
+
end
|
227
240
|
config.defaults(profiles[parent.to_sym])
|
228
241
|
end
|
229
242
|
end
|
@@ -3,43 +3,43 @@ module Nucleon
|
|
3
3
|
module Action
|
4
4
|
module Node
|
5
5
|
class Fact < Nucleon.plugin_class(:nucleon, :cloud_action)
|
6
|
-
|
6
|
+
|
7
7
|
#-----------------------------------------------------------------------------
|
8
8
|
# Info
|
9
|
-
|
9
|
+
|
10
10
|
def self.describe(action = :fact, weight = 570)
|
11
11
|
describe_base(:node, action, weight, nil, nil, :node_fact)
|
12
12
|
end
|
13
|
-
|
13
|
+
|
14
14
|
#-----------------------------------------------------------------------------
|
15
15
|
# Settings
|
16
16
|
|
17
17
|
def configure(aggregate = false)
|
18
18
|
super() do
|
19
19
|
codes :fact_save_failed
|
20
|
-
|
20
|
+
|
21
21
|
unless aggregate
|
22
22
|
register_str :name, nil
|
23
23
|
register_str :value
|
24
|
-
|
25
|
-
register_bool :delete
|
26
|
-
|
24
|
+
|
25
|
+
register_bool :delete
|
26
|
+
|
27
27
|
register_translator :input_format
|
28
28
|
end
|
29
|
-
|
29
|
+
|
30
30
|
register_translator :format, :json
|
31
31
|
end
|
32
32
|
end
|
33
|
-
|
33
|
+
|
34
34
|
#---
|
35
|
-
|
35
|
+
|
36
36
|
def arguments
|
37
37
|
[ :name, :value ]
|
38
38
|
end
|
39
39
|
|
40
40
|
#-----------------------------------------------------------------------------
|
41
41
|
# Operations
|
42
|
-
|
42
|
+
|
43
43
|
def execute
|
44
44
|
super do |node|
|
45
45
|
ensure_node(node) do
|
@@ -47,9 +47,9 @@ class Fact < Nucleon.plugin_class(:nucleon, :cloud_action)
|
|
47
47
|
render_node_facts(node)
|
48
48
|
else
|
49
49
|
if settings.delete(:delete, false)
|
50
|
-
delete_node_fact(node, settings[:name], sanitize_remote(
|
50
|
+
delete_node_fact(node, settings[:name], sanitize_remote(settings[:net_remote]))
|
51
51
|
elsif settings[:value] && ! settings[:value].empty?
|
52
|
-
set_node_fact(node, settings[:name], settings[:value], sanitize_remote(
|
52
|
+
set_node_fact(node, settings[:name], settings[:value], sanitize_remote(settings[:net_remote]))
|
53
53
|
else
|
54
54
|
render_node_fact(node, settings[:name])
|
55
55
|
end
|
@@ -57,64 +57,64 @@ class Fact < Nucleon.plugin_class(:nucleon, :cloud_action)
|
|
57
57
|
end
|
58
58
|
end
|
59
59
|
end
|
60
|
-
|
60
|
+
|
61
61
|
#-----------------------------------------------------------------------------
|
62
62
|
# Sub operations
|
63
|
-
|
63
|
+
|
64
64
|
def render_node_facts(node)
|
65
65
|
format = settings[:format]
|
66
|
-
myself.result = node.facts
|
67
|
-
render result, :format => format
|
66
|
+
myself.result = node.facts
|
67
|
+
render result, :format => format
|
68
68
|
end
|
69
|
-
|
69
|
+
|
70
70
|
#---
|
71
|
-
|
71
|
+
|
72
72
|
def render_node_fact(node, name)
|
73
73
|
format = settings[:format]
|
74
|
-
myself.result = node.fact(name)
|
75
|
-
render result, :format => format
|
74
|
+
myself.result = node.fact(name)
|
75
|
+
render result, :format => format
|
76
76
|
end
|
77
|
-
|
77
|
+
|
78
78
|
#---
|
79
|
-
|
79
|
+
|
80
80
|
def delete_node_fact(node, name, remote = nil)
|
81
81
|
remote_text = remote ? "#{remote}" : "LOCAL ONLY"
|
82
|
-
|
82
|
+
|
83
83
|
node.delete_facts(name)
|
84
|
-
|
84
|
+
|
85
85
|
if node.save({ :remote => remote, :message => "Deleting fact #{name} from #{node.plugin_provider} #{node.plugin_name}" })
|
86
86
|
success("Fact #{name} deleted (#{remote_text})", { :i18n => false })
|
87
87
|
else
|
88
88
|
error("Fact #{name} deletion could not be saved", { :i18n => false })
|
89
|
-
myself.status = code.fact_save_failed
|
90
|
-
end
|
89
|
+
myself.status = code.fact_save_failed
|
90
|
+
end
|
91
91
|
end
|
92
|
-
|
92
|
+
|
93
93
|
#---
|
94
|
-
|
94
|
+
|
95
95
|
def set_node_fact(node, name, value, remote = nil)
|
96
96
|
remote_text = remote ? "#{remote}" : "LOCAL ONLY"
|
97
97
|
input_format = settings[:input_format]
|
98
|
-
|
99
|
-
value = Util::Data.value(render(value, {
|
100
|
-
:format => input_format,
|
101
|
-
:silent => true
|
98
|
+
|
99
|
+
value = Util::Data.value(render(value, {
|
100
|
+
:format => input_format,
|
101
|
+
:silent => true
|
102
102
|
})) if input_format
|
103
|
-
|
104
|
-
myself.result = value
|
105
|
-
node.create_facts({ name => value })
|
106
|
-
|
103
|
+
|
104
|
+
myself.result = value
|
105
|
+
node.create_facts({ name => value })
|
106
|
+
|
107
107
|
if node.save({ :remote => remote, :message => "Saving fact #{name} to #{node.plugin_provider} #{node.plugin_name}" })
|
108
108
|
success("Fact #{name} saved (#{remote_text})", { :i18n => false })
|
109
109
|
else
|
110
110
|
error("New fact #{name} could not be saved", { :i18n => false })
|
111
|
-
myself.status = code.fact_save_failed
|
112
|
-
end
|
111
|
+
myself.status = code.fact_save_failed
|
112
|
+
end
|
113
113
|
end
|
114
|
-
|
114
|
+
|
115
115
|
#-----------------------------------------------------------------------------
|
116
116
|
# Output
|
117
|
-
|
117
|
+
|
118
118
|
def render_provider
|
119
119
|
:node_fact
|
120
120
|
end
|
@@ -93,12 +93,26 @@ class Identity < Nucleon.plugin_class(:nucleon, :cloud_action)
|
|
93
93
|
result = node.cli.mkdir('-p', remote_identity_base_directory)
|
94
94
|
success = false unless result.status == code.success
|
95
95
|
|
96
|
+
success = node.cli.chmod('-R', 'go-rwx', remote_config_directory) if success
|
97
|
+
|
96
98
|
if success
|
97
99
|
result = node.cli.rm('-Rf', remote_identity_directory)
|
98
100
|
success = false unless result.status == code.success
|
99
101
|
|
100
102
|
# Send identity through SCP to remote machine
|
101
|
-
|
103
|
+
if success && !settings[:delete]
|
104
|
+
if node.user == 'root'
|
105
|
+
success = node.send_files(identity_directory, remote_identity_directory, nil, '0700')
|
106
|
+
else
|
107
|
+
tmp_identity_directory = File.join('/', 'home', node.user, 'identity')
|
108
|
+
|
109
|
+
success = node.send_files(identity_directory, tmp_identity_directory, nil, '0700') if success
|
110
|
+
|
111
|
+
success = node.cli.mv(tmp_identity_directory, remote_identity_directory) if success
|
112
|
+
success = node.cli.chown('-R', 'root:root', remote_identity_directory) if success
|
113
|
+
success = node.cli.chmod('-R', 'go-rwx', remote_identity_directory) if success
|
114
|
+
end
|
115
|
+
end
|
102
116
|
end
|
103
117
|
success
|
104
118
|
end
|
@@ -2,26 +2,26 @@
|
|
2
2
|
require 'puppet/indirector/terminus'
|
3
3
|
|
4
4
|
class Puppet::Indirector::Corl < Puppet::Indirector::Terminus
|
5
|
-
|
5
|
+
|
6
6
|
def initialize(*args)
|
7
7
|
node = CORL::Provisioner::Puppetnode.node
|
8
|
-
|
8
|
+
|
9
9
|
unless node.config_initialized?
|
10
10
|
raise "CORL terminus not supported without the CORL library"
|
11
11
|
end
|
12
12
|
super
|
13
13
|
end
|
14
|
-
|
14
|
+
|
15
15
|
#---
|
16
16
|
|
17
17
|
def find(request)
|
18
18
|
node = CORL::Provisioner::Puppetnode.node
|
19
|
-
|
19
|
+
|
20
20
|
puppet_scope = request.options[:variables]
|
21
21
|
module_name = nil
|
22
22
|
module_name = puppet_scope.source.module_name if puppet_scope.source
|
23
23
|
contexts = [ :param, :data_binding, request.key ]
|
24
|
-
|
24
|
+
|
25
25
|
default_options = {
|
26
26
|
:provisioner => :puppetnode,
|
27
27
|
:hiera_scope => puppet_scope,
|
@@ -32,9 +32,9 @@ class Puppet::Indirector::Corl < Puppet::Indirector::Terminus
|
|
32
32
|
:merge => true,
|
33
33
|
:undefined_value => :undef
|
34
34
|
}
|
35
|
-
|
35
|
+
|
36
36
|
if module_name
|
37
|
-
config = CORL::Config.init({}, contexts, module_name, default_options)
|
37
|
+
config = CORL::Config.init({}, contexts, module_name, default_options)
|
38
38
|
else
|
39
39
|
config = CORL::Config.init_flat({}, contexts, default_options)
|
40
40
|
end
|
@@ -18,22 +18,22 @@ This function performs a lookup for a variable value in various locations follow
|
|
18
18
|
If no value is found in the defined sources, it returns an empty string ('')
|
19
19
|
EOS
|
20
20
|
) do |args|
|
21
|
-
|
21
|
+
|
22
22
|
value = nil
|
23
23
|
CORL.run do
|
24
24
|
raise(Puppet::ParseError, "module_param(): Define at least the variable name " +
|
25
25
|
"given (#{args.size} for 1)") if args.size < 1
|
26
|
-
|
26
|
+
|
27
27
|
var_name = args[0]
|
28
28
|
default = ( args.size > 1 ? args[1] : '' )
|
29
29
|
options = ( args.size > 2 ? args[2] : {} )
|
30
|
-
|
30
|
+
|
31
31
|
module_name = parent_module_name
|
32
32
|
node = CORL::Provisioner::Puppetnode.node
|
33
|
-
|
33
|
+
|
34
34
|
if module_name
|
35
35
|
module_var_name = "#{module_name}::#{var_name}"
|
36
|
-
|
36
|
+
|
37
37
|
config = CORL::Config.init(options, [ :param, :module_param, var_name ], module_name, {
|
38
38
|
:provisioner => :puppetnode,
|
39
39
|
:hiera_scope => self,
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: corl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.18
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adrian Webb
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-05-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nucleon
|