foreman_templates 2.0.3 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/foreman_templates/version.rb +1 -1
- data/lib/templates.rake +17 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b3bd9ea7c7b68c51790a87d66ab47d73f8c8a732
|
4
|
+
data.tar.gz: 9a9a5b69cbe4c1a1c46c9657eec4c25bdf7d03c8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c00161195df295c0366d2eeb1d82526f50402e7d9bb01e7f1a149976dc297b12395df399e5b8233a5f428a81e61c41f5c4807dccc7f8f1dbee4c8066203c01d9
|
7
|
+
data.tar.gz: 3a9876e223051b8ed1f3e1f5389558da85e0ab8ea389f10827d77ad3cee24d2bb6c413312fc191e42e1b37882bb0794966652c8b749618c31defb6d8ba4a2ab2
|
data/lib/templates.rake
CHANGED
@@ -26,6 +26,21 @@ def map_oses
|
|
26
26
|
return oses
|
27
27
|
end
|
28
28
|
|
29
|
+
def update_job_template
|
30
|
+
return {:status => false, :result => 'Skipping job template import, remote execution plugin is not installed.'} unless defined?(JobTemplate)
|
31
|
+
template = JobTemplate.import(@text.sub(/^name: .*$/, "name: #{@name}"), :update => true)
|
32
|
+
|
33
|
+
string = template.new_record? ? 'Created' : 'Updated'
|
34
|
+
|
35
|
+
if template.template != template.template_was
|
36
|
+
diff = Diffy::Diff.new(template.template_was, template.template, :include_diff_info => true).to_s(:color)
|
37
|
+
end
|
38
|
+
|
39
|
+
result = " #{string} Template #{ 'id' + template.id rescue ''}:#{@name}"
|
40
|
+
|
41
|
+
{:diff => diff, :status => template.save, :result => result}
|
42
|
+
end
|
43
|
+
|
29
44
|
def update_template
|
30
45
|
# Get template type
|
31
46
|
unless kind = TemplateKind.find_by_name(@metadata['kind'])
|
@@ -174,6 +189,8 @@ namespace :templates do
|
|
174
189
|
data = update_ptable
|
175
190
|
when 'snippet'
|
176
191
|
data = update_snippet
|
192
|
+
when 'job_template'
|
193
|
+
data = update_job_template
|
177
194
|
else
|
178
195
|
data = update_template
|
179
196
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreman_templates
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Greg Sutcliffe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-05-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: diffy
|
@@ -73,7 +73,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
73
73
|
version: '0'
|
74
74
|
requirements: []
|
75
75
|
rubyforge_project:
|
76
|
-
rubygems_version: 2.
|
76
|
+
rubygems_version: 2.5.1
|
77
77
|
signing_key:
|
78
78
|
specification_version: 4
|
79
79
|
summary: Template-syncing engine for Foreman
|