foreman_chef 0.9.0 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/setting/foreman_chef.rb +6 -16
- data/lib/foreman_chef/engine.rb +2 -2
- data/lib/foreman_chef/version.rb +1 -1
- data/lib/tasks/cleanup.rake +44 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 14274b12ecca910fbd4b0b36d3964f6102c870f51db7c02c00e9242117689f76
|
4
|
+
data.tar.gz: 42ebdf54c808d67ea386b9a410ee98bf1a722cca9545b5b76e985b97953a0d6a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4ee50a70a75f5459e41708179a3aebd6f05c30b427b2b67447c90f5d6cb8fbbdcd2d19346787f7d9fc83c61af42674fdc1e33bf518dd7c75b3a32bb84a2ece04
|
7
|
+
data.tar.gz: 999ffba530778ec8880a20f8c6ac0163fe4a0b4b982567d9721a55c957a36f7c59234f61dccb8992126f7915c66e81fdc63ba1e4ceba0921eccd77530c34b597
|
@@ -1,23 +1,13 @@
|
|
1
1
|
class Setting::ForemanChef < Setting
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
[
|
9
|
-
self.set('chef_interval', N_("Duration in minutes after servers reporting via Chef are classed as out of sync."), 60),
|
10
|
-
self.set('auto_deletion', N_("Enable the auto deletion of mapped objects in chef-server through foreman-proxy (currently node and client upon host deletion, client on host rebuild)"), true),
|
11
|
-
self.set('validation_bootstrap_method', N_("Use validation.pem or create client directly storing private key in Foreman DB)"), true),
|
12
|
-
].each { |s| self.create! s.update(:category => "Setting::ForemanChef")}
|
13
|
-
end
|
14
|
-
|
15
|
-
true
|
16
|
-
|
2
|
+
def self.default_settings
|
3
|
+
[
|
4
|
+
self.set('chef_interval', N_("Duration in minutes after servers reporting via Chef are classed as out of sync."), 60),
|
5
|
+
self.set('auto_deletion', N_("Enable the auto deletion of mapped objects in chef-server through foreman-proxy (currently node and client upon host deletion, client on host rebuild)"), true),
|
6
|
+
self.set('validation_bootstrap_method', N_("Use validation.pem or create client directly storing private key in Foreman DB)"), true),
|
7
|
+
]
|
17
8
|
end
|
18
9
|
|
19
10
|
def self.humanized_category
|
20
11
|
_('Chef')
|
21
12
|
end
|
22
|
-
|
23
13
|
end
|
data/lib/foreman_chef/engine.rb
CHANGED
@@ -47,7 +47,7 @@ module ForemanChef
|
|
47
47
|
|
48
48
|
initializer 'foreman_chef.register_plugin', :before => :finisher_hook do |app|
|
49
49
|
Foreman::Plugin.register :foreman_chef do
|
50
|
-
requires_foreman '>= 1.
|
50
|
+
requires_foreman '>= 2.1.0'
|
51
51
|
extend_template_helpers ForemanChef::Concerns::Renderer
|
52
52
|
|
53
53
|
permission :import_chef_environments, { :environments => [:import, :synchronize] }, :resource_type => 'ForemanChef::Environment'
|
@@ -89,7 +89,7 @@ module ForemanChef
|
|
89
89
|
|
90
90
|
#Include extensions to models in this config.to_prepare block
|
91
91
|
config.to_prepare do
|
92
|
-
::
|
92
|
+
::Foreman::Plugin.fact_importer_registry.register(:foreman_chef, ForemanChef::FactImporter)
|
93
93
|
::FactParser.register_fact_parser(:foreman_chef, ForemanChef::FactParser)
|
94
94
|
::ConfigReportImporter.register_smart_proxy_feature('Chef')
|
95
95
|
|
data/lib/foreman_chef/version.rb
CHANGED
@@ -0,0 +1,44 @@
|
|
1
|
+
namespace :foreman_chef do
|
2
|
+
desc 'Clean data created by this plugin, this will permanently delete the data!'
|
3
|
+
task :cleanup => :environment do
|
4
|
+
puts 'Cleaning data...'
|
5
|
+
|
6
|
+
ForemanChef::FactName # fact values
|
7
|
+
|
8
|
+
User.as_anonymous_admin do
|
9
|
+
puts '... deleting records from settings'
|
10
|
+
Setting::ForemanChef.destroy_all
|
11
|
+
puts '... removing all chef facts, this can take a long time based on the amount of fact values'
|
12
|
+
ForemanChef::FactName.destroy_all
|
13
|
+
puts '... deleting all cached run lists'
|
14
|
+
ForemanChef::CachedRunList.destroy_all
|
15
|
+
puts '... deleting all chef environments'
|
16
|
+
Host.update_all :chef_environment_id => nil, :chef_proxy_id => nil
|
17
|
+
Hostgroup.update_all :chef_environment_id => nil, :chef_proxy_id => nil
|
18
|
+
ForemanChef::Environment.destroy_all
|
19
|
+
Permission.where(:resource_type => ['ForemanChef::Environment']).destroy_all
|
20
|
+
puts '... deleting REX feature'
|
21
|
+
RemoteExecutionFeature.where(:label => 'foreman_chef_run_chef_client').destroy_all
|
22
|
+
puts 'data from all tables deleted'
|
23
|
+
end
|
24
|
+
|
25
|
+
puts "Cleaning DB schema changes"
|
26
|
+
|
27
|
+
reversible_migrations = [
|
28
|
+
20160408091653,
|
29
|
+
20160324151437,
|
30
|
+
20150916141657,
|
31
|
+
20140513144804,
|
32
|
+
20140220145827
|
33
|
+
]
|
34
|
+
|
35
|
+
# invoke rake db:migrate:down VERSION=20100905201547
|
36
|
+
reversible_migrations.each do |migration|
|
37
|
+
ENV["VERSION"] = migration.to_s
|
38
|
+
Rake::Task["db:migrate:down"].invoke
|
39
|
+
end
|
40
|
+
|
41
|
+
puts 'Clean up finished, you can now remove the plugin from your system'
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreman_chef
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marek Hulan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-05-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: deface
|
@@ -122,6 +122,7 @@ files:
|
|
122
122
|
- lib/foreman_chef.rb
|
123
123
|
- lib/foreman_chef/engine.rb
|
124
124
|
- lib/foreman_chef/version.rb
|
125
|
+
- lib/tasks/cleanup.rake
|
125
126
|
homepage: https://github.com/theforeman/foreman_chef
|
126
127
|
licenses:
|
127
128
|
- GPL-3
|