choria-mcorpc-support 2.20.5 → 2.20.6
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 +4 -4
- data/lib/mcollective.rb +1 -1
- data/lib/mcollective/application/plugin.rb +19 -7
- data/lib/mcollective/ddl/agentddl.rb +4 -0
- data/lib/mcollective/ddl/base.rb +14 -1
- data/lib/mcollective/pluginpackager/agent_definition.rb +11 -7
- data/lib/mcollective/pluginpackager/{puppet_module_packager.rb → forge_packager.rb} +3 -3
- data/lib/mcollective/pluginpackager/standard_definition.rb +23 -12
- data/lib/mcollective/pluginpackager/templates/{puppet_module → forge}/README.md.erb +1 -1
- data/lib/mcollective/pluginpackager/templates/{puppet_module → forge}/data/defaults.yaml.erb +0 -0
- data/lib/mcollective/pluginpackager/templates/{puppet_module → forge}/data/plugin.yaml.erb +0 -0
- data/lib/mcollective/pluginpackager/templates/{puppet_module → forge}/hiera.yaml.erb +0 -0
- data/lib/mcollective/pluginpackager/templates/{puppet_module → forge}/manifests/init.pp.erb +0 -0
- data/lib/mcollective/pluginpackager/templates/{puppet_module → forge}/metadata.json.erb +2 -2
- metadata +9 -23
- data/lib/mcollective/pluginpackager/debpackage_packager.rb +0 -237
- data/lib/mcollective/pluginpackager/modulepackage_packager.rb +0 -127
- data/lib/mcollective/pluginpackager/ospackage_packager.rb +0 -59
- data/lib/mcollective/pluginpackager/rpmpackage_packager.rb +0 -180
- data/lib/mcollective/pluginpackager/templates/debian/Makefile.erb +0 -7
- data/lib/mcollective/pluginpackager/templates/debian/changelog.erb +0 -5
- data/lib/mcollective/pluginpackager/templates/debian/compat.erb +0 -1
- data/lib/mcollective/pluginpackager/templates/debian/control.erb +0 -15
- data/lib/mcollective/pluginpackager/templates/debian/copyright.erb +0 -8
- data/lib/mcollective/pluginpackager/templates/debian/rules.erb +0 -6
- data/lib/mcollective/pluginpackager/templates/module/Modulefile.erb +0 -5
- data/lib/mcollective/pluginpackager/templates/module/README.md.erb +0 -37
- data/lib/mcollective/pluginpackager/templates/module/_manifest.pp.erb +0 -9
- data/lib/mcollective/pluginpackager/templates/redhat/rpm_spec.erb +0 -63
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 29d095eecde9726e77979a330ff4ed2a27ac7912
|
4
|
+
data.tar.gz: a6aa7aa304f84aa576e711e40184d492c245295e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: da30c83fef47986f8acb747d284ace2ecc736cfd9f7045b938c51684c801837080b346dbcdde7ca27a692e00181bb4b616af1d172457312217d26bd0d113bc92
|
7
|
+
data.tar.gz: ad9ca3e3fc6e99bad8eafd7a97764519d0e490644d9b80c39933b020d26c1f307ba4891e34d63bf8d79ac207533981dfa6a2a1bc201a99bb9ce9c4798747758c
|
data/lib/mcollective.rb
CHANGED
@@ -213,7 +213,7 @@ mco plugin package [options] <directory>
|
|
213
213
|
def load_plugin_ddl(plugin, type)
|
214
214
|
[plugin, "#{plugin}_#{type}"].each do |p|
|
215
215
|
ddl = DDL.new(p, type, false)
|
216
|
-
if ddl.findddlfile(p, type)
|
216
|
+
if ddl.client_activated? && ddl.findddlfile(p, type)
|
217
217
|
ddl.loadddlfile
|
218
218
|
return ddl
|
219
219
|
end
|
@@ -224,9 +224,14 @@ mco plugin package [options] <directory>
|
|
224
224
|
|
225
225
|
# Show application list and plugin help
|
226
226
|
def doc_command
|
227
|
-
known_plugin_types = [
|
228
|
-
|
229
|
-
|
227
|
+
known_plugin_types = [
|
228
|
+
["Agents", :agent],
|
229
|
+
["Aggregate", :aggregate],
|
230
|
+
["Connectors", :connector],
|
231
|
+
["Data Queries", :data],
|
232
|
+
["Discovery Methods", :discovery],
|
233
|
+
["Validator Plugins", :validator]
|
234
|
+
]
|
230
235
|
|
231
236
|
if configuration.include?(:target) && configuration[:target] != "."
|
232
237
|
if configuration[:target] =~ /^(.+?)\/(.+)$/
|
@@ -265,7 +270,11 @@ mco plugin package [options] <directory>
|
|
265
270
|
|
266
271
|
PluginManager.find(plugin_type[1], "ddl").each do |ddl|
|
267
272
|
begin
|
268
|
-
help = DDL.new(ddl, plugin_type[1])
|
273
|
+
help = DDL.new(ddl, plugin_type[1], false)
|
274
|
+
|
275
|
+
next unless help.client_activated?
|
276
|
+
|
277
|
+
help.loadddlfile
|
269
278
|
pluginname = ddl.gsub(/_#{plugin_type[1]}$/, "")
|
270
279
|
puts " %-25s %s" % [pluginname, help.meta[:description]]
|
271
280
|
rescue => e
|
@@ -289,7 +298,7 @@ mco plugin package [options] <directory>
|
|
289
298
|
# Creates the correct package plugin object.
|
290
299
|
def prepare_plugin
|
291
300
|
plugintype = set_plugin_type unless configuration[:plugintype]
|
292
|
-
configuration[:format] = "
|
301
|
+
configuration[:format] = "forge" unless configuration[:format]
|
293
302
|
PluginPackager.load_packagers
|
294
303
|
plugin_class = PluginPackager[configuration[:plugintype]]
|
295
304
|
|
@@ -299,7 +308,10 @@ mco plugin package [options] <directory>
|
|
299
308
|
configuration[:dependency].map!{|dep| {:name => dep, :version => nil}}
|
300
309
|
end
|
301
310
|
|
302
|
-
mcdependency = {
|
311
|
+
mcdependency = {
|
312
|
+
:mcname => configuration[:mcname],
|
313
|
+
:mcversion => configuration[:mcversion]
|
314
|
+
}
|
303
315
|
|
304
316
|
# Deprecation warning for --iteration
|
305
317
|
if configuration[:iteration]
|
@@ -44,6 +44,10 @@ module MCollective
|
|
44
44
|
super
|
45
45
|
end
|
46
46
|
|
47
|
+
def client_activated?
|
48
|
+
Util.str_to_bool(@config.pluginconf.fetch("%s.activate_client" % @pluginname, ACTIVATION_DEFAULT.to_s))
|
49
|
+
end
|
50
|
+
|
47
51
|
def input(argument, properties)
|
48
52
|
raise "Input needs a :optional property" unless properties.include?(:optional)
|
49
53
|
|
data/lib/mcollective/ddl/base.rb
CHANGED
@@ -19,6 +19,8 @@ module MCollective
|
|
19
19
|
class Base
|
20
20
|
attr_reader :meta, :entities, :pluginname, :plugintype, :usage, :requirements
|
21
21
|
|
22
|
+
ACTIVATION_DEFAULT = true
|
23
|
+
|
22
24
|
def initialize(plugin, plugintype=:agent, loadddl=true)
|
23
25
|
@entities = {}
|
24
26
|
@meta = {}
|
@@ -77,6 +79,10 @@ module MCollective
|
|
77
79
|
end
|
78
80
|
|
79
81
|
def loadddlfile
|
82
|
+
if @config.mode == :client && !client_activated?
|
83
|
+
raise("%s/%s is disabled, cannot load DDL file" % [@plugintype, @pluginname])
|
84
|
+
end
|
85
|
+
|
80
86
|
if ddlfile = findddlfile
|
81
87
|
instance_eval(File.read(ddlfile), ddlfile, 1)
|
82
88
|
else
|
@@ -95,7 +101,12 @@ module MCollective
|
|
95
101
|
return ddlfile
|
96
102
|
end
|
97
103
|
end
|
98
|
-
|
104
|
+
|
105
|
+
false
|
106
|
+
end
|
107
|
+
|
108
|
+
def client_activated?
|
109
|
+
ACTIVATION_DEFAULT
|
99
110
|
end
|
100
111
|
|
101
112
|
def validate_requirements
|
@@ -186,6 +197,8 @@ module MCollective
|
|
186
197
|
@entities[action][:output][argument] = {:description => properties[:description],
|
187
198
|
:display_as => properties[:display_as],
|
188
199
|
:default => properties[:default]}
|
200
|
+
|
201
|
+
@entities[action][:output][argument][:type] = properties[:type] if properties[:type]
|
189
202
|
end
|
190
203
|
|
191
204
|
def requires(requirement)
|
@@ -12,7 +12,7 @@ module MCollective
|
|
12
12
|
@revision = configuration[:revision] || 1
|
13
13
|
@preinstall = configuration[:preinstall]
|
14
14
|
@postinstall = configuration[:postinstall]
|
15
|
-
@vendor = configuration[:vendor] || "
|
15
|
+
@vendor = configuration[:vendor] || "Choria.IO User"
|
16
16
|
@dependencies = configuration[:dependency] || []
|
17
17
|
@target_path = File.expand_path(@path)
|
18
18
|
@metadata, mcversion = PluginPackager.get_metadata(@path, "agent")
|
@@ -36,9 +36,11 @@ module MCollective
|
|
36
36
|
|
37
37
|
# Obtain Agent package files and dependencies.
|
38
38
|
def agent
|
39
|
-
agent = {
|
40
|
-
|
41
|
-
|
39
|
+
agent = {
|
40
|
+
:files => [],
|
41
|
+
:dependencies => @dependencies.clone,
|
42
|
+
:description => "Agent plugin for #{@metadata[:name]}"
|
43
|
+
}
|
42
44
|
|
43
45
|
agentdir = File.join(@path, "agent")
|
44
46
|
|
@@ -69,9 +71,11 @@ module MCollective
|
|
69
71
|
|
70
72
|
# Obtain common package files and dependencies.
|
71
73
|
def common
|
72
|
-
common = {
|
73
|
-
|
74
|
-
|
74
|
+
common = {
|
75
|
+
:files =>[],
|
76
|
+
:dependencies => @dependencies.clone,
|
77
|
+
:description => "Common libraries for #{@metadata[:name]}"
|
78
|
+
}
|
75
79
|
|
76
80
|
datadir = File.join(@path, "data", "**")
|
77
81
|
utildir = File.join(@path, "util", "**", "**")
|
@@ -2,12 +2,12 @@ require "yaml"
|
|
2
2
|
|
3
3
|
module MCollective
|
4
4
|
module PluginPackager
|
5
|
-
class
|
5
|
+
class ForgePackager
|
6
6
|
def initialize(plugin, pluginpath = nil, signature = nil, verbose = false, keep_artifacts = nil, module_template = nil)
|
7
7
|
@plugin = plugin
|
8
8
|
@verbose = verbose
|
9
9
|
@keep_artifacts = keep_artifacts
|
10
|
-
@module_template = module_template || File.join(File.dirname(__FILE__), 'templates', '
|
10
|
+
@module_template = module_template || File.join(File.dirname(__FILE__), 'templates', 'forge')
|
11
11
|
end
|
12
12
|
|
13
13
|
def which(cmd)
|
@@ -214,7 +214,7 @@ module MCollective
|
|
214
214
|
begin
|
215
215
|
PluginPackager.execute_verbosely(@verbose) do
|
216
216
|
Dir.chdir(@tmpdir) do
|
217
|
-
PluginPackager.safe_system('
|
217
|
+
PluginPackager.safe_system('pdk build --force')
|
218
218
|
end
|
219
219
|
end
|
220
220
|
rescue
|
@@ -11,7 +11,7 @@ module MCollective
|
|
11
11
|
@revision = configuration[:revision] || 1
|
12
12
|
@preinstall = configuration[:preinstall]
|
13
13
|
@postinstall = configuration[:postinstall]
|
14
|
-
@vendor = configuration[:vendor] || "
|
14
|
+
@vendor = configuration[:vendor] || "Choria.IO User"
|
15
15
|
@dependencies = configuration[:dependency] || []
|
16
16
|
@target_path = File.expand_path(@path)
|
17
17
|
@metadata, mcversion = PluginPackager.get_metadata(@path, @plugintype)
|
@@ -20,6 +20,7 @@ module MCollective
|
|
20
20
|
@dependencies << {:name => "#{mcname}-common", :version => @mcversion}
|
21
21
|
@metadata[:name] = (configuration[:pluginname] || @metadata[:name]).downcase.gsub(/\s+|_/, "-")
|
22
22
|
@metadata[:version] = (configuration[:version] || @metadata[:version])
|
23
|
+
|
23
24
|
identify_packages
|
24
25
|
end
|
25
26
|
|
@@ -33,9 +34,11 @@ module MCollective
|
|
33
34
|
|
34
35
|
# Obtain standard plugin files and dependencies
|
35
36
|
def plugin
|
36
|
-
plugindata = {
|
37
|
-
|
38
|
-
|
37
|
+
plugindata = {
|
38
|
+
:files => [],
|
39
|
+
:dependencies => @dependencies.clone,
|
40
|
+
:description => "#{@name} #{@plugintype} plugin for the Choria Orchestrator."
|
41
|
+
}
|
39
42
|
|
40
43
|
plugindir = File.join(@path, @plugintype.to_s)
|
41
44
|
if PluginPackager.check_dir_present plugindir
|
@@ -44,25 +47,33 @@ module MCollective
|
|
44
47
|
return nil
|
45
48
|
end
|
46
49
|
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
+
if @packagedata[:common]
|
51
|
+
plugindata[:plugindependency] = {
|
52
|
+
:name => "#{@mcname}-#{@metadata[:name]}-common",
|
53
|
+
:version => @metadata[:version],
|
54
|
+
:revision => @revision
|
55
|
+
}
|
56
|
+
end
|
57
|
+
|
50
58
|
plugindata
|
51
59
|
end
|
52
60
|
|
53
61
|
# Obtain list of common files
|
54
62
|
def common
|
55
|
-
common = {
|
56
|
-
|
57
|
-
|
63
|
+
common = {
|
64
|
+
:files => [],
|
65
|
+
:dependencies => @dependencies.clone,
|
66
|
+
:description => "Common libraries for #{@name} connector plugin"
|
67
|
+
}
|
58
68
|
|
59
69
|
commondir = File.join(@path, "util")
|
60
70
|
if PluginPackager.check_dir_present commondir
|
61
71
|
common[:files] = Dir.glob(File.join(commondir, "*"))
|
72
|
+
|
62
73
|
return common
|
63
|
-
else
|
64
|
-
return nil
|
65
74
|
end
|
75
|
+
|
76
|
+
nil
|
66
77
|
end
|
67
78
|
end
|
68
79
|
end
|
@@ -67,6 +67,6 @@ For a full list of possible configuration settings see the module [source reposi
|
|
67
67
|
|
68
68
|
## Development:
|
69
69
|
|
70
|
-
To contribute to this
|
70
|
+
To contribute to this [Choria.IO](https://choria.io) plugin please visit <%= @plugin.metadata[:url] %>.
|
71
71
|
|
72
72
|
This module was generated using the Choria Plugin Packager based on templates found at the [GitHub Project](https://github.com/choria-io/).
|
data/lib/mcollective/pluginpackager/templates/{puppet_module → forge}/data/defaults.yaml.erb
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -7,12 +7,12 @@
|
|
7
7
|
"source": "<%= @plugin.metadata[:url] %>",
|
8
8
|
"project_page": "<%= @plugin.metadata[:url] %>",
|
9
9
|
"dependencies": [
|
10
|
-
{"name": "choria/mcollective", "version_requirement": ">= 0.
|
10
|
+
{"name": "choria/mcollective", "version_requirement": ">= 0.9.3 < 2.0.0"}
|
11
11
|
],
|
12
12
|
"requirements": [
|
13
13
|
{
|
14
14
|
"name": "puppet",
|
15
|
-
"version_requirement": ">=
|
15
|
+
"version_requirement": ">= 6.0.0"
|
16
16
|
}
|
17
17
|
]
|
18
18
|
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: choria-mcorpc-support
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.20.
|
4
|
+
version: 2.20.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- R.I.Pienaar
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-09-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: systemu
|
@@ -135,28 +135,14 @@ files:
|
|
135
135
|
- lib/mcollective/pluginmanager.rb
|
136
136
|
- lib/mcollective/pluginpackager.rb
|
137
137
|
- lib/mcollective/pluginpackager/agent_definition.rb
|
138
|
-
- lib/mcollective/pluginpackager/
|
139
|
-
- lib/mcollective/pluginpackager/modulepackage_packager.rb
|
140
|
-
- lib/mcollective/pluginpackager/ospackage_packager.rb
|
141
|
-
- lib/mcollective/pluginpackager/puppet_module_packager.rb
|
142
|
-
- lib/mcollective/pluginpackager/rpmpackage_packager.rb
|
138
|
+
- lib/mcollective/pluginpackager/forge_packager.rb
|
143
139
|
- lib/mcollective/pluginpackager/standard_definition.rb
|
144
|
-
- lib/mcollective/pluginpackager/templates/
|
145
|
-
- lib/mcollective/pluginpackager/templates/
|
146
|
-
- lib/mcollective/pluginpackager/templates/
|
147
|
-
- lib/mcollective/pluginpackager/templates/
|
148
|
-
- lib/mcollective/pluginpackager/templates/
|
149
|
-
- lib/mcollective/pluginpackager/templates/
|
150
|
-
- lib/mcollective/pluginpackager/templates/module/Modulefile.erb
|
151
|
-
- lib/mcollective/pluginpackager/templates/module/README.md.erb
|
152
|
-
- lib/mcollective/pluginpackager/templates/module/_manifest.pp.erb
|
153
|
-
- lib/mcollective/pluginpackager/templates/puppet_module/README.md.erb
|
154
|
-
- lib/mcollective/pluginpackager/templates/puppet_module/data/defaults.yaml.erb
|
155
|
-
- lib/mcollective/pluginpackager/templates/puppet_module/data/plugin.yaml.erb
|
156
|
-
- lib/mcollective/pluginpackager/templates/puppet_module/hiera.yaml.erb
|
157
|
-
- lib/mcollective/pluginpackager/templates/puppet_module/manifests/init.pp.erb
|
158
|
-
- lib/mcollective/pluginpackager/templates/puppet_module/metadata.json.erb
|
159
|
-
- lib/mcollective/pluginpackager/templates/redhat/rpm_spec.erb
|
140
|
+
- lib/mcollective/pluginpackager/templates/forge/README.md.erb
|
141
|
+
- lib/mcollective/pluginpackager/templates/forge/data/defaults.yaml.erb
|
142
|
+
- lib/mcollective/pluginpackager/templates/forge/data/plugin.yaml.erb
|
143
|
+
- lib/mcollective/pluginpackager/templates/forge/hiera.yaml.erb
|
144
|
+
- lib/mcollective/pluginpackager/templates/forge/manifests/init.pp.erb
|
145
|
+
- lib/mcollective/pluginpackager/templates/forge/metadata.json.erb
|
160
146
|
- lib/mcollective/registration/base.rb
|
161
147
|
- lib/mcollective/rpc.rb
|
162
148
|
- lib/mcollective/rpc/actionrunner.rb
|
@@ -1,237 +0,0 @@
|
|
1
|
-
module MCollective
|
2
|
-
module PluginPackager
|
3
|
-
class DebpackagePackager
|
4
|
-
require 'erb'
|
5
|
-
|
6
|
-
def initialize(plugin, pluginpath = nil, signature = nil, verbose = false, keep_artifacts = nil, module_template = nil)
|
7
|
-
if PluginPackager.command_available?('debuild')
|
8
|
-
@plugin = plugin
|
9
|
-
@verbose = verbose
|
10
|
-
@libdir = pluginpath || '/usr/share/mcollective/plugins/mcollective/'
|
11
|
-
@signature = signature
|
12
|
-
@package_name = "#{@plugin.mcname}-#{@plugin.metadata[:name]}"
|
13
|
-
@keep_artifacts = keep_artifacts
|
14
|
-
else
|
15
|
-
raise("Cannot build package. 'debuild' is not present on the system.")
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
# Build process :
|
20
|
-
# - create buildroot
|
21
|
-
# - craete buildroot/debian
|
22
|
-
# - create the relative directories with package contents
|
23
|
-
# - create install files for each of the plugins that are going to be built
|
24
|
-
# - create debian build files
|
25
|
-
# - create tarball
|
26
|
-
# - create pre and post install files
|
27
|
-
# - run the build script
|
28
|
-
# - move packages to cwd
|
29
|
-
# - clean up
|
30
|
-
def create_packages
|
31
|
-
begin
|
32
|
-
puts "Building packages for #{@package_name} plugin."
|
33
|
-
|
34
|
-
@tmpdir = Dir.mktmpdir('mcollective_packager')
|
35
|
-
@build_dir = File.join(@tmpdir, "#{@package_name}_#{@plugin.metadata[:version]}")
|
36
|
-
Dir.mkdir(@build_dir)
|
37
|
-
|
38
|
-
create_debian_dir
|
39
|
-
@plugin.packagedata.each do |type, data|
|
40
|
-
prepare_tmpdirs(data)
|
41
|
-
create_install_file(type, data)
|
42
|
-
create_pre_and_post_install(type)
|
43
|
-
end
|
44
|
-
create_debian_files
|
45
|
-
create_tar
|
46
|
-
run_build
|
47
|
-
move_packages
|
48
|
-
|
49
|
-
puts "Completed building all packages for #{@package_name} plugin."
|
50
|
-
ensure
|
51
|
-
if @keep_artifacts
|
52
|
-
puts 'Keeping build artifacts.'
|
53
|
-
puts "Build artifacts saved - #{@tmpdir}"
|
54
|
-
else
|
55
|
-
puts 'Removing build artifacts.'
|
56
|
-
cleanup_tmpdirs
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
60
|
-
|
61
|
-
private
|
62
|
-
|
63
|
-
def create_debian_files
|
64
|
-
['control', 'Makefile', 'compat', 'rules', 'copyright', 'changelog'].each do |f|
|
65
|
-
create_file(f)
|
66
|
-
end
|
67
|
-
end
|
68
|
-
|
69
|
-
def run_build
|
70
|
-
FileUtils.cd(@build_dir) do
|
71
|
-
PluginPackager.execute_verbosely(@verbose) do
|
72
|
-
if @signature
|
73
|
-
if @signature.is_a?(String)
|
74
|
-
PluginPackager.safe_system("debuild --no-lintian -i -k#{@signature}")
|
75
|
-
else
|
76
|
-
PluginPackager.safe_system("debuild --no-lintian -i")
|
77
|
-
end
|
78
|
-
else
|
79
|
-
PluginPackager.safe_system("debuild --no-lintian -i -us -uc")
|
80
|
-
end
|
81
|
-
end
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
# Creates a string used by the control file to specify dependencies
|
86
|
-
# Dependencies can be formatted as :
|
87
|
-
# foo (>= x.x-x)
|
88
|
-
# foo (>= x.x)
|
89
|
-
# foo
|
90
|
-
def build_dependency_string(data)
|
91
|
-
dependencies = []
|
92
|
-
PluginPackager.filter_dependencies('debian', data[:dependencies]).each do |dep|
|
93
|
-
if dep[:version] && dep[:revision]
|
94
|
-
dependencies << "#{dep[:name]} (>=#{dep[:version]}-#{dep[:revision]}) | puppet-agent"
|
95
|
-
elsif dep[:version]
|
96
|
-
dependencies << "#{dep[:name]} (>=#{dep[:version]}) | puppet-agent"
|
97
|
-
else
|
98
|
-
dependencies << "#{dep[:name]} | puppet-agent"
|
99
|
-
end
|
100
|
-
end
|
101
|
-
|
102
|
-
if data[:plugindependency]
|
103
|
-
dependencies << "#{data[:plugindependency][:name]} (= ${binary:Version})"
|
104
|
-
end
|
105
|
-
|
106
|
-
dependencies.join(', ')
|
107
|
-
end
|
108
|
-
|
109
|
-
# Creates an install file for each of the packages that are going to be created
|
110
|
-
# for the plugin
|
111
|
-
def create_install_file(type, data)
|
112
|
-
install_file = "#{@package_name}-#{type}"
|
113
|
-
begin
|
114
|
-
install_file = File.join(@build_dir, 'debian', "#{install_file}.install")
|
115
|
-
File.open(install_file, 'w') do |file|
|
116
|
-
data[:files].each do |f|
|
117
|
-
extended_filename = File.join(@libdir, File.expand_path(f).gsub(/^#{@plugin.target_path}/, ''))
|
118
|
-
file.puts "#{extended_filename} #{File.dirname(extended_filename)}"
|
119
|
-
end
|
120
|
-
end
|
121
|
-
rescue Errno::EACCES => e
|
122
|
-
puts "Could not create install file '#{install_file}'. Permission denied"
|
123
|
-
raise e
|
124
|
-
rescue => e
|
125
|
-
puts "Could not create install file '#{install_file}'."
|
126
|
-
raise e
|
127
|
-
end
|
128
|
-
end
|
129
|
-
|
130
|
-
# Move source package and debs to cwd
|
131
|
-
def move_packages
|
132
|
-
begin
|
133
|
-
files_to_copy = Dir.glob(File.join(@tmpdir, '*.{deb,dsc,diff.gz,orig.tar.gz,changes}'))
|
134
|
-
FileUtils.cp(files_to_copy, '.')
|
135
|
-
rescue => e
|
136
|
-
puts 'Could not copy packages to working directory.'
|
137
|
-
raise e
|
138
|
-
end
|
139
|
-
end
|
140
|
-
|
141
|
-
# Create pre and post install files in $buildroot/debian
|
142
|
-
# from supplied scripts.
|
143
|
-
# Note that all packages built for the plugin will invoke
|
144
|
-
# the same pre and post install scripts.
|
145
|
-
def create_pre_and_post_install(type)
|
146
|
-
if @plugin.preinstall
|
147
|
-
if !File.exists?(@plugin.preinstall)
|
148
|
-
puts "pre-install script '#{@plugin.preinstall}' not found."
|
149
|
-
raise(Errno::ENOENT, @plugin.preinstall)
|
150
|
-
else
|
151
|
-
FileUtils.cp(@plugin.preinstall, File.join(@build_dir, 'debian', "#{@package_name}-#{type}.preinst"))
|
152
|
-
end
|
153
|
-
end
|
154
|
-
|
155
|
-
if @plugin.postinstall
|
156
|
-
if !File.exists?(@plugin.postinstall)
|
157
|
-
puts "post-install script '#{@plugin.postinstall}' not found."
|
158
|
-
raise(Errno::ENOENT, @plugin.postinstall)
|
159
|
-
else
|
160
|
-
FileUtils.cp(@plugin.postinstall, File.join(@build_dir, 'debian', "#{@package_name}-#{type}.postinst"))
|
161
|
-
end
|
162
|
-
end
|
163
|
-
end
|
164
|
-
|
165
|
-
# Tar up source
|
166
|
-
# Expects directory : $mcollective-$agent_$version
|
167
|
-
# Creates file : $buildroot/$mcollective-$agent_$version.orig.tar.gz
|
168
|
-
def create_tar
|
169
|
-
name_and_version = "#{@package_name}_#{@plugin.metadata[:version]}"
|
170
|
-
tarfile = "#{name_and_version}.orig.tar.gz"
|
171
|
-
begin
|
172
|
-
PluginPackager.execute_verbosely(@verbose) do
|
173
|
-
Dir.chdir(@tmpdir) do
|
174
|
-
PluginPackager.safe_system("tar -Pcvzf #{File.join(@tmpdir, tarfile)} #{name_and_version}")
|
175
|
-
end
|
176
|
-
end
|
177
|
-
rescue Exception => e
|
178
|
-
puts "Could not create tarball - #{tarfile}"
|
179
|
-
raise e
|
180
|
-
end
|
181
|
-
end
|
182
|
-
|
183
|
-
def create_file(filename)
|
184
|
-
begin
|
185
|
-
file = ERB.new(File.read(File.join(File.dirname(__FILE__), 'templates', 'debian', "#{filename}.erb")), nil, '-')
|
186
|
-
File.open(File.join(@build_dir, 'debian', filename), 'w') do |f|
|
187
|
-
f.puts file.result(binding)
|
188
|
-
end
|
189
|
-
rescue => e
|
190
|
-
puts "Could not create file - '#{filename}'"
|
191
|
-
raise e
|
192
|
-
end
|
193
|
-
end
|
194
|
-
|
195
|
-
# Move files contained in the plugin to the correct directory
|
196
|
-
# relative to the build root.
|
197
|
-
def prepare_tmpdirs(data)
|
198
|
-
data[:files].each do |file|
|
199
|
-
begin
|
200
|
-
targetdir = File.join(@build_dir, @libdir, File.dirname(File.expand_path(file)).gsub(/^#{@plugin.target_path}/, ""))
|
201
|
-
FileUtils.mkdir_p(targetdir) unless File.directory?(targetdir)
|
202
|
-
FileUtils.cp_r(file, targetdir)
|
203
|
-
rescue Errno::EACCES => e
|
204
|
-
puts "Could not create directory '#{targetdir}'. Permission denied"
|
205
|
-
raise e
|
206
|
-
rescue Errno::ENOENT => e
|
207
|
-
puts "Could not copy file '#{file}' to '#{targetdir}'. File does not exist"
|
208
|
-
raise e
|
209
|
-
rescue => e
|
210
|
-
puts 'Could not prepare build directory'
|
211
|
-
raise e
|
212
|
-
end
|
213
|
-
end
|
214
|
-
end
|
215
|
-
|
216
|
-
# Create the $buildroot/debian directory
|
217
|
-
def create_debian_dir
|
218
|
-
deb_dir = File.join(@build_dir, 'debian')
|
219
|
-
begin
|
220
|
-
FileUtils.mkdir_p(deb_dir)
|
221
|
-
rescue => e
|
222
|
-
puts "Could not create directory '#{deb_dir}'"
|
223
|
-
raise e
|
224
|
-
end
|
225
|
-
end
|
226
|
-
|
227
|
-
def cleanup_tmpdirs
|
228
|
-
begin
|
229
|
-
FileUtils.rm_r(@tmpdir) if File.directory?(@tmpdir)
|
230
|
-
rescue => e
|
231
|
-
puts "Could not remove temporary build directory - '#{@tmpdir}'"
|
232
|
-
raise e
|
233
|
-
end
|
234
|
-
end
|
235
|
-
end
|
236
|
-
end
|
237
|
-
end
|
@@ -1,127 +0,0 @@
|
|
1
|
-
module MCollective
|
2
|
-
module PluginPackager
|
3
|
-
class ModulepackagePackager
|
4
|
-
require 'erb'
|
5
|
-
|
6
|
-
def initialize(plugin, pluginpath = nil, signature = nil, verbose = false, keep_artifacts = nil, module_template = nil)
|
7
|
-
assert_new_enough_puppet
|
8
|
-
@plugin = plugin
|
9
|
-
@package_name = "#{@plugin.mcname}_#{@plugin.metadata[:name]}".gsub(/-/, '_')
|
10
|
-
@verbose = verbose
|
11
|
-
@keep_artifacts = keep_artifacts
|
12
|
-
@module_template = module_template || File.join(File.dirname(__FILE__), 'templates', 'module')
|
13
|
-
end
|
14
|
-
|
15
|
-
# Build Process :
|
16
|
-
# - create module directory
|
17
|
-
# - run 'puppet module build'
|
18
|
-
# - move generated package back to cwd
|
19
|
-
def create_packages
|
20
|
-
begin
|
21
|
-
puts "Building module for #{@package_name} plugin."
|
22
|
-
|
23
|
-
@tmpdir = Dir.mktmpdir('mcollective_packager')
|
24
|
-
make_module
|
25
|
-
run_build
|
26
|
-
move_package
|
27
|
-
|
28
|
-
puts "Completed building module for #{@package_name} plugin."
|
29
|
-
ensure
|
30
|
-
if @keep_artifacts
|
31
|
-
puts 'Keeping build artifacts'
|
32
|
-
puts "Build artifacts saved - #{@tmpdir}"
|
33
|
-
else
|
34
|
-
cleanup_tmpdirs
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
private
|
40
|
-
|
41
|
-
def assert_new_enough_puppet
|
42
|
-
unless PluginPackager.command_available?('puppet')
|
43
|
-
raise("Cannot build package. 'puppet' is not present on the system.")
|
44
|
-
end
|
45
|
-
|
46
|
-
s = Shell.new('puppet --version')
|
47
|
-
s.runcommand
|
48
|
-
actual_version = s.stdout.chomp
|
49
|
-
|
50
|
-
required_version = '3.3.0'
|
51
|
-
if Util.versioncmp(actual_version, required_version) < 0
|
52
|
-
raise("Cannot build package. puppet #{required_version} or greater required. We have #{actual_version}.")
|
53
|
-
end
|
54
|
-
end
|
55
|
-
|
56
|
-
def make_module
|
57
|
-
targetdir = File.join(@tmpdir, 'manifests')
|
58
|
-
FileUtils.mkdir_p(targetdir) unless File.directory?(targetdir)
|
59
|
-
|
60
|
-
# for each subpackage make a subclass
|
61
|
-
@plugin.packagedata.each do |klass,data|
|
62
|
-
data[:files].each do |file|
|
63
|
-
relative_path = File.expand_path(file).gsub(/#{@plugin.target_path}|^\.\//, '')
|
64
|
-
targetdir = File.join(@tmpdir, 'files', klass.to_s, 'mcollective', File.dirname(relative_path))
|
65
|
-
FileUtils.mkdir_p(targetdir) unless File.directory?(targetdir)
|
66
|
-
FileUtils.cp_r(file, targetdir)
|
67
|
-
end
|
68
|
-
|
69
|
-
@klass = klass.to_s
|
70
|
-
render_template('_manifest.pp.erb', File.join(@tmpdir, 'manifests', "#{klass}.pp"))
|
71
|
-
end
|
72
|
-
|
73
|
-
# render all the templates we have
|
74
|
-
Dir.glob(File.join(@module_template, '*.erb')).each do |template|
|
75
|
-
filename = File.basename(template, '.erb')
|
76
|
-
next if filename =~ /^_/ # starting with underscore makes it private
|
77
|
-
render_template("#{filename}.erb", File.join(@tmpdir, filename))
|
78
|
-
end
|
79
|
-
end
|
80
|
-
|
81
|
-
def render_template(template, path)
|
82
|
-
begin
|
83
|
-
erb = ERB.new(File.read(File.join(@module_template, template)), nil, '-')
|
84
|
-
File.open(path, 'w') do |f|
|
85
|
-
f.puts erb.result(binding)
|
86
|
-
end
|
87
|
-
rescue => e
|
88
|
-
puts "Could not render template to path - '#{path}'"
|
89
|
-
raise e
|
90
|
-
end
|
91
|
-
end
|
92
|
-
|
93
|
-
def run_build
|
94
|
-
begin
|
95
|
-
PluginPackager.execute_verbosely(@verbose) do
|
96
|
-
Dir.chdir(@tmpdir) do
|
97
|
-
PluginPackager.safe_system('puppet module build')
|
98
|
-
end
|
99
|
-
end
|
100
|
-
rescue => e
|
101
|
-
puts 'Build process has failed'
|
102
|
-
raise e
|
103
|
-
end
|
104
|
-
end
|
105
|
-
|
106
|
-
# Move built package to cwd
|
107
|
-
def move_package
|
108
|
-
begin
|
109
|
-
package_file = File.join(@tmpdir, 'pkg', "#{@plugin.vendor}-#{@package_name}-#{@plugin.metadata[:version]}.tar.gz")
|
110
|
-
FileUtils.cp(package_file, '.')
|
111
|
-
rescue => e
|
112
|
-
puts 'Could not copy package to working directory'
|
113
|
-
raise e
|
114
|
-
end
|
115
|
-
end
|
116
|
-
|
117
|
-
def cleanup_tmpdirs
|
118
|
-
begin
|
119
|
-
FileUtils.rm_r(@tmpdir) if File.directory?(@tmpdir)
|
120
|
-
rescue => e
|
121
|
-
puts "Could not remove temporary build directory - '#{@tmpdir}'"
|
122
|
-
raise e
|
123
|
-
end
|
124
|
-
end
|
125
|
-
end
|
126
|
-
end
|
127
|
-
end
|
@@ -1,59 +0,0 @@
|
|
1
|
-
module MCollective
|
2
|
-
module PluginPackager
|
3
|
-
# MCollective plugin packager general OS implementation.
|
4
|
-
class OspackagePackager
|
5
|
-
|
6
|
-
attr_accessor :package, :verbose, :packager, :package_type
|
7
|
-
|
8
|
-
# Create packager object with package parameter containing list of files,
|
9
|
-
# dependencies and package metadata.
|
10
|
-
def initialize(package, pluginpath = nil, signature = nil, verbose = false, keep_artifacts = false, module_template = nil)
|
11
|
-
|
12
|
-
if File.exists?("/etc/redhat-release")
|
13
|
-
@packager = PluginPackager["RpmpackagePackager"].new(package, pluginpath, signature, verbose, keep_artifacts, module_template)
|
14
|
-
@package_type = "RPM"
|
15
|
-
elsif File.exists?("/etc/debian_version")
|
16
|
-
@packager = PluginPackager["DebpackagePackager"].new(package, pluginpath, signature, verbose, keep_artifacts, module_template)
|
17
|
-
@package_type = "Deb"
|
18
|
-
else
|
19
|
-
raise "cannot identify operating system."
|
20
|
-
end
|
21
|
-
|
22
|
-
@package = package
|
23
|
-
@verbose = verbose
|
24
|
-
end
|
25
|
-
|
26
|
-
# Hands over package creation to the detected packager implementation
|
27
|
-
# based on operating system.
|
28
|
-
def create_packages
|
29
|
-
@packager.create_packages
|
30
|
-
end
|
31
|
-
|
32
|
-
# Displays the package metadata and detected files
|
33
|
-
def package_information
|
34
|
-
puts
|
35
|
-
puts "%30s%s" % ["Plugin information : ", @package.metadata[:name]]
|
36
|
-
puts "%30s%s" % ["-" * 22, "-" * 22]
|
37
|
-
puts "%30s%s" % ["Plugin Type : ", @package.plugintype.capitalize]
|
38
|
-
puts "%30s%s" % ["Package Output Format : ", @package_type]
|
39
|
-
puts "%30s%s" % ["Version : ", @package.metadata[:version]]
|
40
|
-
puts "%30s%s" % ["Revision : ", @package.revision]
|
41
|
-
puts "%30s%s" % ["Vendor : ", @package.vendor]
|
42
|
-
puts "%30s%s" % ["Post Install Script : ", @package.postinstall] if @package.postinstall
|
43
|
-
puts "%30s%s" % ["Author : ", @package.metadata[:author]]
|
44
|
-
puts "%30s%s" % ["License : ", @package.metadata[:license]]
|
45
|
-
puts "%30s%s" % ["URL : ", @package.metadata[:url]]
|
46
|
-
|
47
|
-
if @package.packagedata.size > 0
|
48
|
-
@package.packagedata.each_with_index do |values, i|
|
49
|
-
if i == 0
|
50
|
-
puts "%30s%s" % ["Identified Packages : ", values[0]]
|
51
|
-
else
|
52
|
-
puts "%30s%s" % [" ", values[0]]
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
@@ -1,180 +0,0 @@
|
|
1
|
-
module MCollective
|
2
|
-
module PluginPackager
|
3
|
-
class RpmpackagePackager
|
4
|
-
require 'erb'
|
5
|
-
|
6
|
-
def initialize(plugin, pluginpath = nil, signature = nil, verbose = false, keep_artifacts = nil, module_template = nil)
|
7
|
-
if @buildtool = select_command
|
8
|
-
@plugin = plugin
|
9
|
-
@package_name = "#{@plugin.mcname}-#{@plugin.metadata[:name]}"
|
10
|
-
@package_name_and_version = "#{@package_name}-#{@plugin.metadata[:version]}"
|
11
|
-
@verbose = verbose
|
12
|
-
@libdir = pluginpath || '/usr/libexec/mcollective/mcollective/'
|
13
|
-
@signature = signature
|
14
|
-
@rpmdir = rpmdir
|
15
|
-
@srpmdir = srpmdir
|
16
|
-
@keep_artifacts = keep_artifacts
|
17
|
-
else
|
18
|
-
raise("Cannot build package. 'rpmbuild' or 'rpmbuild-md5' is not present on the system")
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
# Determine the build tool present on the system
|
23
|
-
def select_command
|
24
|
-
if PluginPackager.command_available?('rpmbuild-md5')
|
25
|
-
return 'rpmbuild-md5'
|
26
|
-
elsif PluginPackager.command_available?('rpmbuild')
|
27
|
-
return 'rpmbuild'
|
28
|
-
else
|
29
|
-
return nil
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
def rpmdir
|
34
|
-
`rpm --eval '%_rpmdir'`.chomp
|
35
|
-
end
|
36
|
-
|
37
|
-
def srpmdir
|
38
|
-
`rpm --eval '%_srcrpmdir'`.chomp
|
39
|
-
end
|
40
|
-
|
41
|
-
# Build Process :
|
42
|
-
# - create temporary buildroot
|
43
|
-
# - create the spec file
|
44
|
-
# - create the tarball
|
45
|
-
# - run the build script
|
46
|
-
# - move pacakges to cwd
|
47
|
-
# - clean up
|
48
|
-
def create_packages
|
49
|
-
begin
|
50
|
-
puts "Building packages for #{@package_name} plugin."
|
51
|
-
|
52
|
-
@tmpdir = Dir.mktmpdir('mcollective_packager')
|
53
|
-
prepare_tmpdirs
|
54
|
-
|
55
|
-
make_spec_file
|
56
|
-
run_build
|
57
|
-
move_packages
|
58
|
-
|
59
|
-
puts "Completed building all packages for #{@package_name} plugin."
|
60
|
-
ensure
|
61
|
-
if @keep_artifacts
|
62
|
-
puts 'Keeping build artifacts'
|
63
|
-
puts "Build artifacts saved - #{@tmpdir}"
|
64
|
-
else
|
65
|
-
cleanup_tmpdirs
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
private
|
71
|
-
|
72
|
-
def run_build
|
73
|
-
begin
|
74
|
-
tarfile = create_tar
|
75
|
-
PluginPackager.execute_verbosely(@verbose) do
|
76
|
-
PluginPackager.safe_system("#{@buildtool} -ta#{" --quiet" unless @verbose}#{" --sign" if @signature} #{tarfile}")
|
77
|
-
end
|
78
|
-
rescue => e
|
79
|
-
puts 'Build process has failed'
|
80
|
-
raise e
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
# Tar up source
|
85
|
-
# Expects directory $mcollective-$agent-$version
|
86
|
-
# Creates file : $tmpbuildroot/$mcollective-$agent-$version
|
87
|
-
def create_tar
|
88
|
-
tarfile = File.join(@tmpdir, "#{@package_name_and_version}.tgz")
|
89
|
-
begin
|
90
|
-
PluginPackager.execute_verbosely(@verbose) do
|
91
|
-
Dir.chdir(@tmpdir) do
|
92
|
-
PluginPackager.safe_system("tar -cvzf #{tarfile} #{@package_name_and_version}")
|
93
|
-
end
|
94
|
-
end
|
95
|
-
rescue => e
|
96
|
-
puts "Could not create tarball - '#{tarfile}'"
|
97
|
-
raise e
|
98
|
-
end
|
99
|
-
tarfile
|
100
|
-
end
|
101
|
-
|
102
|
-
# Move rpm's and srpm's to cwd
|
103
|
-
def move_packages
|
104
|
-
begin
|
105
|
-
files_to_copy = []
|
106
|
-
files_to_copy += Dir.glob(File.join(@rpmdir, 'noarch', "#{@package_name}-*-#{@plugin.metadata[:version]}-#{@plugin.revision}*.noarch.rpm"))
|
107
|
-
files_to_copy += Dir.glob(File.join(@srpmdir, "#{@package_name}-#{@plugin.metadata[:version]}-#{@plugin.revision}*.src.rpm"))
|
108
|
-
FileUtils.cp(files_to_copy, '.')
|
109
|
-
rescue => e
|
110
|
-
puts 'Could not copy packages to working directory'
|
111
|
-
raise e
|
112
|
-
end
|
113
|
-
end
|
114
|
-
|
115
|
-
# Create the specfile and place as $tmpbuildroot/$mcollective-$agent-$version/$mcollective-$agent-$version.spec
|
116
|
-
def make_spec_file
|
117
|
-
spec_file = File.join(@tmpdir, @package_name_and_version, "#{@package_name_and_version}.spec")
|
118
|
-
begin
|
119
|
-
spec_template = ERB.new(File.read(File.join(File.dirname(__FILE__), 'templates', 'redhat', 'rpm_spec.erb')), nil, '-')
|
120
|
-
File.open(spec_file, 'w') do |f|
|
121
|
-
f.puts spec_template.result(binding)
|
122
|
-
end
|
123
|
-
rescue => e
|
124
|
-
puts "Could not create specfile - '#{spec_file}'"
|
125
|
-
raise e
|
126
|
-
end
|
127
|
-
end
|
128
|
-
|
129
|
-
# Move files contained in the plugin to the correct directory
|
130
|
-
# relative to the build root.
|
131
|
-
def prepare_tmpdirs
|
132
|
-
plugin_files.each do |file|
|
133
|
-
begin
|
134
|
-
targetdir = File.join(@tmpdir, @package_name_and_version, @libdir, File.dirname(File.expand_path(file)).gsub(@plugin.target_path, ""))
|
135
|
-
FileUtils.mkdir_p(targetdir) unless File.directory?(targetdir)
|
136
|
-
FileUtils.cp_r(file, targetdir)
|
137
|
-
rescue Errno::EACCES => e
|
138
|
-
puts "Could not create directory '#{targetdir}'. Permission denied"
|
139
|
-
raise e
|
140
|
-
rescue Errno::ENOENT => e
|
141
|
-
puts "Could not copy file '#{file}' to '#{targetdir}'. File does not exist"
|
142
|
-
raise e
|
143
|
-
rescue => e
|
144
|
-
puts 'Could not prepare temporary build directory'
|
145
|
-
raise e
|
146
|
-
end
|
147
|
-
end
|
148
|
-
end
|
149
|
-
|
150
|
-
# Extract all the package files from the plugin's package data hash
|
151
|
-
def plugin_files
|
152
|
-
files = []
|
153
|
-
@plugin.packagedata.each do |name, data|
|
154
|
-
files += data[:files].reject{ |f| File.directory?(f) }
|
155
|
-
end
|
156
|
-
files
|
157
|
-
end
|
158
|
-
|
159
|
-
# Extract the package specific files from the file list and omits directories
|
160
|
-
def package_files(files)
|
161
|
-
package_files = []
|
162
|
-
files.each do |f|
|
163
|
-
if !File.directory?(f)
|
164
|
-
package_files << File.join(@libdir, File.expand_path(f).gsub(/#{@plugin.target_path}|\.\//, ''))
|
165
|
-
end
|
166
|
-
end
|
167
|
-
package_files
|
168
|
-
end
|
169
|
-
|
170
|
-
def cleanup_tmpdirs
|
171
|
-
begin
|
172
|
-
FileUtils.rm_r(@tmpdir) if File.directory?(@tmpdir)
|
173
|
-
rescue => e
|
174
|
-
puts "Could not remove temporary build directory - '#{@tmpdir}'"
|
175
|
-
raise e
|
176
|
-
end
|
177
|
-
end
|
178
|
-
end
|
179
|
-
end
|
180
|
-
end
|
@@ -1,5 +0,0 @@
|
|
1
|
-
<%= @package_name -%> (<%= @plugin.metadata[:version]-%>-<%= @plugin.revision-%>) unstable; urgency=low
|
2
|
-
|
3
|
-
* Automated release for <%= @package_name -%> by mco plugin packager.
|
4
|
-
|
5
|
-
-- The Marionette Collective <mcollective-dev@googlegroups.com> <%= Time.new.strftime('%a, %d %b %Y %H:%M:%S %z') %>
|
@@ -1 +0,0 @@
|
|
1
|
-
7
|
@@ -1,15 +0,0 @@
|
|
1
|
-
Source: <%= @package_name %>
|
2
|
-
Homepage: <%= @plugin.metadata[:url] %>
|
3
|
-
Section: utils
|
4
|
-
Priority: extra
|
5
|
-
Build-Depends: debhelper (>= 7), cdbs, dpatch
|
6
|
-
Maintainer: <%= @plugin.metadata[:author] %>
|
7
|
-
Standards-Version: 3.9.1
|
8
|
-
<% @plugin.packagedata.each do |type, data| %>
|
9
|
-
Package: <%= "#{@package_name}-#{type}" %>
|
10
|
-
Architecture: all
|
11
|
-
Depends: <%= build_dependency_string(data) %>
|
12
|
-
Description: <%= @plugin.metadata[:description]%>
|
13
|
-
<%= data[:description]%>
|
14
|
-
.
|
15
|
-
<% end -%>
|
@@ -1,37 +0,0 @@
|
|
1
|
-
# <%= @package_name %>
|
2
|
-
|
3
|
-
#### Table of Contents
|
4
|
-
|
5
|
-
1. [Overview](#overview)
|
6
|
-
2. [Module Description - What the module does and why it is useful](#module-description)
|
7
|
-
3. [Setup - The basics of getting started with <%= @package_name %>](#setup)
|
8
|
-
* [What the <%= @package_name %> module affects](#what-the-<%= @package_name %>-module-affects)
|
9
|
-
* [Setup requirements](#setup-requirements)
|
10
|
-
4. [Usage - Configuration options and additional functionality](#usage)
|
11
|
-
5. [Reference - An under-the-hood peek at what the module is doing and how](#reference)
|
12
|
-
|
13
|
-
|
14
|
-
## Overview
|
15
|
-
|
16
|
-
The <%= @package_name %> module is a module that wraps a source release of the
|
17
|
-
<%= @plugin.metadata[:name] %> mcollective plugin for use with the
|
18
|
-
[puppetlabs mcollective](http://forge.puppetlabs.com/puppetlabs/mcollective)
|
19
|
-
module.
|
20
|
-
|
21
|
-
## Module description
|
22
|
-
|
23
|
-
## Usage
|
24
|
-
|
25
|
-
<% @plugin.packagedata.keys.map { |x| x.to_s }.sort.each do |klass| -%>
|
26
|
-
<%# Don't document common class -%>
|
27
|
-
<% if klass != "common" -%>
|
28
|
-
### class <%= @package_name %>::<%= klass %>
|
29
|
-
|
30
|
-
Installs the <%= klass %> component of the <%= @plugin.metadata[:name] %> plugin.
|
31
|
-
|
32
|
-
```puppet
|
33
|
-
include <%= @package_name%>::<%= klass %>
|
34
|
-
```
|
35
|
-
<% end %>
|
36
|
-
<% end %>
|
37
|
-
|
@@ -1,9 +0,0 @@
|
|
1
|
-
#
|
2
|
-
class <%= @package_name %>::<%= @klass %> {
|
3
|
-
<% if @plugin.packagedata[:common] && @klass != 'common' %>
|
4
|
-
include ::<%= @package_name %>::common
|
5
|
-
<% end %>
|
6
|
-
mcollective::plugin { '<%= @package_name %>/<%= @klass %>':
|
7
|
-
source => 'puppet:///modules/<%= @package_name %>/<%= @klass %>',
|
8
|
-
}
|
9
|
-
}
|
@@ -1,63 +0,0 @@
|
|
1
|
-
Name: <%= @package_name %>
|
2
|
-
Summary: <%= @plugin.metadata[:description] %>
|
3
|
-
Version: <%= @plugin.metadata[:version] %>
|
4
|
-
Release: <%= @plugin.revision %>%{?dist}
|
5
|
-
License: <%= @plugin.metadata[:license]%>
|
6
|
-
URL: <%= @plugin.metadata[:url]%>
|
7
|
-
Vendor: <%= @plugin.vendor%>
|
8
|
-
Packager: <%= @plugin.metadata[:author]%>
|
9
|
-
BuildArch: noarch
|
10
|
-
Group: System Tools
|
11
|
-
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
12
|
-
Source0: <%= @package_name_and_version%>.tgz
|
13
|
-
|
14
|
-
%description
|
15
|
-
<%= @plugin.metadata[:description] %>
|
16
|
-
|
17
|
-
%prep
|
18
|
-
%setup
|
19
|
-
|
20
|
-
%build
|
21
|
-
<% package_files = plugin_files.map{ |f| File.join(@libdir, File.expand_path(f).gsub(/#{File.expand_path(@plugin.path)}|\.\//, '')) } -%>
|
22
|
-
<% dirs = package_files.map{ |f| File.dirname(f) }.uniq -%>
|
23
|
-
|
24
|
-
%install
|
25
|
-
rm -rf %{buildroot}
|
26
|
-
<% dirs.each do |dir| -%>
|
27
|
-
%{__install} -d -m0755 %{buildroot}<%= dir%>
|
28
|
-
<% end -%>
|
29
|
-
<% package_files.each do |file| -%>
|
30
|
-
%{__install} -m0644 -v <%= (file[0].chr == '/') ? file[1..file.size-1]: file%> %{buildroot}<%=file %>
|
31
|
-
<% end -%>
|
32
|
-
|
33
|
-
<% @plugin.packagedata.each do |type, data| %>
|
34
|
-
%package <%= type %>
|
35
|
-
Summary: <%= @plugin.metadata[:description] %>
|
36
|
-
<% if data[:plugindependency] %>
|
37
|
-
Requires: <%= data[:plugindependency][:name] -%> = <%= data[:plugindependency][:version]%>-<%= data[:plugindependency][:revision]%>%{?dist}
|
38
|
-
<% end -%>
|
39
|
-
<% PluginPackager.filter_dependencies('redhat', data[:dependencies]).each do |dep|-%>
|
40
|
-
Requires: <%= dep[:name] -%> <%= ">= #{dep[:version]}" if dep[:version]%><%="-#{dep[:revision]}" if dep[:revision]%>
|
41
|
-
<% end -%>
|
42
|
-
%description <%= type %>
|
43
|
-
<%= data[:description] %>
|
44
|
-
|
45
|
-
%files <%= type %>
|
46
|
-
%defattr(-, root, root, -)
|
47
|
-
<% package_files(data[:files]).each do |file| -%>
|
48
|
-
<%= file %>
|
49
|
-
<% end -%>
|
50
|
-
<% end -%>
|
51
|
-
|
52
|
-
<% if @plugin.preinstall -%>
|
53
|
-
%pre
|
54
|
-
<%= @plugin.preinstall %>
|
55
|
-
<% end -%>
|
56
|
-
<% if @plugin.postinstall -%>
|
57
|
-
%post
|
58
|
-
<%= @plugin.postinstall%>
|
59
|
-
<% end -%>
|
60
|
-
|
61
|
-
%changelog
|
62
|
-
* <%= Time.now.strftime("%a %b %d %Y") -%> <%= @plugin.metadata[:author]%> - <%= @plugin.metadata[:version]%>-<%= @plugin.revision %>
|
63
|
-
- Built Package <%= @plugin.metadata[:name] -%>
|