foreman_snapshot_management 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +619 -0
- data/README.md +15 -0
- data/Rakefile +47 -0
- data/app/controllers/foreman_snapshot_management/snapshots_controller.rb +117 -0
- data/app/helpers/foreman_snapshot_management/snapshot_helper.rb +7 -0
- data/app/helpers/foreman_snapshot_management/snapshotadministration_helper.rb +72 -0
- data/app/models/foreman_snapshot_management/snapshot.rb +73 -0
- data/app/models/foreman_snapshot_management/vmware_extensions.rb +40 -0
- data/app/overrides/hosts/add_tab_to_host_overview.rb +21 -0
- data/app/views/foreman_snapshot_management/snapshots/_index.html.erb +57 -0
- data/config/routes.rb +11 -0
- data/lib/foreman_snapshot_management.rb +4 -0
- data/lib/foreman_snapshot_management/engine.rb +66 -0
- data/lib/foreman_snapshot_management/version.rb +3 -0
- data/lib/tasks/foreman_snapshot_management_tasks.rake +35 -0
- data/locale/Makefile +60 -0
- data/locale/en/foreman_snapshot_management.po +19 -0
- data/locale/foreman_snapshot_management.pot +19 -0
- data/locale/gemspec.rb +2 -0
- data/test/test_plugin_helper.rb +2 -0
- data/test/unit/foreman_snapshot_management_test.rb +11 -0
- metadata +94 -0
data/config/routes.rb
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
require 'deface'
|
2
|
+
|
3
|
+
module ForemanSnapshotManagement
|
4
|
+
class Engine < ::Rails::Engine
|
5
|
+
engine_name 'foreman_snapshot_management'
|
6
|
+
|
7
|
+
config.autoload_paths += Dir["#{config.root}/app/controllers/foreman_snapshot_management/"]
|
8
|
+
config.autoload_paths += Dir["#{config.root}/app/helpers/foreman_snapshot_management/"]
|
9
|
+
config.autoload_paths += Dir["#{config.root}/app/models/foreman_snapshot_management"]
|
10
|
+
config.autoload_paths += Dir["#{config.root}/app/overrides"]
|
11
|
+
|
12
|
+
initializer 'foreman_snapshot_management.register_plugin', before: :finisher_hook do |_app|
|
13
|
+
Foreman::Plugin.register :foreman_snapshot_management do
|
14
|
+
requires_foreman '>= 1.14'
|
15
|
+
|
16
|
+
# Add permissions
|
17
|
+
security_block :foreman_snapshot_management do
|
18
|
+
permission :view_foreman_snapshot_management, :'foreman_snapshot_management/hosts' => [:new_action]
|
19
|
+
permission :view_foreman_snapshot_management, :'foreman_snapshot_management/virtualmachines' => [:index]
|
20
|
+
permission :view_foreman_snapshot_management, :'foreman_snapshot_management/createsnapshot' => [:index]
|
21
|
+
permission :view_foreman_snapshot_management, :'foreman_snapshot_management/createsnapshot' => [:createSnapshot]
|
22
|
+
end
|
23
|
+
|
24
|
+
# Add a new role called 'ForemanSnapshotManagement' if it doesn't exist
|
25
|
+
role 'ForemanSnapshotManagement', [:view_foreman_snapshot_management]
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
# Precompile any JS or CSS files under app/assets/
|
30
|
+
# If requiring files from each other, list them explicitly here to avoid precompiling the same
|
31
|
+
# content twice.
|
32
|
+
assets_to_precompile =
|
33
|
+
Dir.chdir(root) do
|
34
|
+
Dir['app/assets/javascripts/**/*', 'app/assets/stylesheets/**/*'].map do |f|
|
35
|
+
f.split(File::SEPARATOR, 4).last
|
36
|
+
end
|
37
|
+
end
|
38
|
+
initializer 'foreman_snapshot_management.assets.precompile' do |app|
|
39
|
+
app.config.assets.precompile += assets_to_precompile
|
40
|
+
end
|
41
|
+
initializer 'foreman_snapshot_management.configure_assets', group: :assets do
|
42
|
+
SETTINGS[:foreman_snapshot_management] = { assets: { precompile: assets_to_precompile } }
|
43
|
+
end
|
44
|
+
|
45
|
+
# Include concerns in this config.to_prepare block
|
46
|
+
config.to_prepare do
|
47
|
+
begin
|
48
|
+
::Foreman::Model::Vmware.send(:include, ForemanSnapshotManagement::VmwareExtensions)
|
49
|
+
rescue => e
|
50
|
+
Rails.logger.warn "ForemanSnapshotManagement: skipping engine hook (#{e})"
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
rake_tasks do
|
55
|
+
Rake::Task['db:seed'].enhance do
|
56
|
+
ForemanSnapshotManagement::Engine.load_seed
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
initializer 'foreman_snapshot_management.register_gettext', after: :load_config_initializers do |_app|
|
61
|
+
locale_dir = File.join(File.expand_path('../../..', __FILE__), 'locale')
|
62
|
+
locale_domain = 'foreman_snapshot_management'
|
63
|
+
Foreman::Gettext::Support.add_text_domain locale_domain, locale_dir
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# Tests
|
2
|
+
namespace :test do
|
3
|
+
desc 'Test ForemanSnapshotManagement'
|
4
|
+
Rake::TestTask.new(:foreman_snapshot_management) do |t|
|
5
|
+
test_dir = File.join(File.dirname(__FILE__), '../..', 'test')
|
6
|
+
t.libs << ['test', test_dir]
|
7
|
+
t.pattern = "#{test_dir}/**/*_test.rb"
|
8
|
+
t.verbose = true
|
9
|
+
t.warning = false
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
namespace :foreman_snapshot_management do
|
14
|
+
task :rubocop do
|
15
|
+
begin
|
16
|
+
require 'rubocop/rake_task'
|
17
|
+
RuboCop::RakeTask.new(:rubocop_foreman_snapshot_management) do |task|
|
18
|
+
task.patterns = ["#{ForemanSnapshotManagement::Engine.root}/app/**/*.rb",
|
19
|
+
"#{ForemanSnapshotManagement::Engine.root}/lib/**/*.rb",
|
20
|
+
"#{ForemanSnapshotManagement::Engine.root}/test/**/*.rb"]
|
21
|
+
end
|
22
|
+
rescue
|
23
|
+
puts 'Rubocop not loaded.'
|
24
|
+
end
|
25
|
+
|
26
|
+
Rake::Task['rubocop_foreman_snapshot_management'].invoke
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
Rake::Task[:test].enhance ['test:foreman_snapshot_management']
|
31
|
+
|
32
|
+
load 'tasks/jenkins.rake'
|
33
|
+
if Rake::Task.task_defined?(:'jenkins:unit')
|
34
|
+
Rake::Task['jenkins:unit'].enhance ['test:foreman_snapshot_management', 'foreman_snapshot_management:rubocop']
|
35
|
+
end
|
data/locale/Makefile
ADDED
@@ -0,0 +1,60 @@
|
|
1
|
+
#
|
2
|
+
# Makefile for PO merging and MO generation. More info in the README.
|
3
|
+
#
|
4
|
+
# make all-mo (default) - generate MO files
|
5
|
+
# make check - check translations using translate-tool
|
6
|
+
# make tx-update - download and merge translations from Transifex
|
7
|
+
# make clean - clean everything
|
8
|
+
#
|
9
|
+
DOMAIN = foreman_snapshot_management
|
10
|
+
VERSION = $(shell ruby -e 'require "rubygems";spec = Gem::Specification::load(Dir.glob("../*.gemspec")[0]);puts spec.version')
|
11
|
+
POTFILE = $(DOMAIN).pot
|
12
|
+
MOFILE = $(DOMAIN).mo
|
13
|
+
POFILES = $(shell find . -name '$(DOMAIN).po')
|
14
|
+
MOFILES = $(patsubst %.po,%.mo,$(POFILES))
|
15
|
+
POXFILES = $(patsubst %.po,%.pox,$(POFILES))
|
16
|
+
EDITFILES = $(patsubst %.po,%.edit.po,$(POFILES))
|
17
|
+
|
18
|
+
%.mo: %.po
|
19
|
+
mkdir -p $(shell dirname $@)/LC_MESSAGES
|
20
|
+
msgfmt -o $(shell dirname $@)/LC_MESSAGES/$(MOFILE) $<
|
21
|
+
|
22
|
+
# Generate MO files from PO files
|
23
|
+
all-mo: $(MOFILES)
|
24
|
+
|
25
|
+
# Check for malformed strings
|
26
|
+
%.pox: %.po
|
27
|
+
msgfmt -c $<
|
28
|
+
pofilter --nofuzzy -t variables -t blank -t urls -t emails -t long -t newlines \
|
29
|
+
-t endwhitespace -t endpunc -t puncspacing -t options -t printf -t validchars --gnome $< > $@
|
30
|
+
cat $@
|
31
|
+
! grep -q msgid $@
|
32
|
+
|
33
|
+
%.edit.po:
|
34
|
+
touch $@
|
35
|
+
|
36
|
+
check: $(POXFILES)
|
37
|
+
|
38
|
+
# Unify duplicate translations
|
39
|
+
uniq-po:
|
40
|
+
for f in $(shell find ./ -name "*.po") ; do \
|
41
|
+
msguniq $$f -o $$f ; \
|
42
|
+
done
|
43
|
+
|
44
|
+
tx-pull: $(EDITFILES)
|
45
|
+
tx pull -f
|
46
|
+
for f in $(EDITFILES) ; do \
|
47
|
+
sed -i 's/^\("Project-Id-Version: \).*$$/\1$(DOMAIN) $(VERSION)\\n"/' $$f; \
|
48
|
+
done
|
49
|
+
|
50
|
+
tx-update: tx-pull
|
51
|
+
@echo
|
52
|
+
@echo Run rake plugin:gettext[$(DOMAIN)] from the Foreman installation, then make -C locale mo-files to finish
|
53
|
+
@echo
|
54
|
+
|
55
|
+
mo-files: $(MOFILES)
|
56
|
+
git add $(POFILES) $(POTFILE) ../locale/*/LC_MESSAGES
|
57
|
+
git commit -m "i18n - pulling from tx"
|
58
|
+
@echo
|
59
|
+
@echo Changes commited!
|
60
|
+
@echo
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# foreman_snapshot_management
|
2
|
+
#
|
3
|
+
# This file is distributed under the same license as foreman_snapshot_management.
|
4
|
+
#
|
5
|
+
#, fuzzy
|
6
|
+
msgid ""
|
7
|
+
msgstr ""
|
8
|
+
"Project-Id-Version: version 0.0.1\n"
|
9
|
+
"Report-Msgid-Bugs-To: \n"
|
10
|
+
"POT-Creation-Date: 2014-08-20 08:46+0100\n"
|
11
|
+
"PO-Revision-Date: 2014-08-20 08:54+0100\n"
|
12
|
+
"Last-Translator: Foreman Team <foreman-dev@googlegroups.com>\n"
|
13
|
+
"Language-Team: Foreman Team <foreman-dev@googlegroups.com>\n"
|
14
|
+
"Language: \n"
|
15
|
+
"MIME-Version: 1.0\n"
|
16
|
+
"Content-Type: text/plain; charset=UTF-8\n"
|
17
|
+
"Content-Transfer-Encoding: 8bit\n"
|
18
|
+
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
19
|
+
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# foreman_snapshot_management
|
2
|
+
#
|
3
|
+
# This file is distributed under the same license as foreman_snapshot_management.
|
4
|
+
#
|
5
|
+
#, fuzzy
|
6
|
+
msgid ""
|
7
|
+
msgstr ""
|
8
|
+
"Project-Id-Version: version 0.0.1\n"
|
9
|
+
"Report-Msgid-Bugs-To: \n"
|
10
|
+
"POT-Creation-Date: 2014-08-20 08:46+0100\n"
|
11
|
+
"PO-Revision-Date: 2014-08-20 08:46+0100\n"
|
12
|
+
"Last-Translator: Foreman Team <foreman-dev@googlegroups.com>\n"
|
13
|
+
"Language-Team: Foreman Team <foreman-dev@googlegroups.com>\n"
|
14
|
+
"Language: \n"
|
15
|
+
"MIME-Version: 1.0\n"
|
16
|
+
"Content-Type: text/plain; charset=UTF-8\n"
|
17
|
+
"Content-Transfer-Encoding: 8bit\n"
|
18
|
+
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
|
19
|
+
|
data/locale/gemspec.rb
ADDED
metadata
ADDED
@@ -0,0 +1,94 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: foreman_snapshot_management
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- ATIX AG
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-08-11 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rubocop
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.49.1
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.49.1
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rdoc
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: Foreman-plugin to manage snapshots in a vSphere environment.
|
42
|
+
email:
|
43
|
+
- info@atix.de
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- LICENSE
|
49
|
+
- README.md
|
50
|
+
- Rakefile
|
51
|
+
- app/controllers/foreman_snapshot_management/snapshots_controller.rb
|
52
|
+
- app/helpers/foreman_snapshot_management/snapshot_helper.rb
|
53
|
+
- app/helpers/foreman_snapshot_management/snapshotadministration_helper.rb
|
54
|
+
- app/models/foreman_snapshot_management/snapshot.rb
|
55
|
+
- app/models/foreman_snapshot_management/vmware_extensions.rb
|
56
|
+
- app/overrides/hosts/add_tab_to_host_overview.rb
|
57
|
+
- app/views/foreman_snapshot_management/snapshots/_index.html.erb
|
58
|
+
- config/routes.rb
|
59
|
+
- lib/foreman_snapshot_management.rb
|
60
|
+
- lib/foreman_snapshot_management/engine.rb
|
61
|
+
- lib/foreman_snapshot_management/version.rb
|
62
|
+
- lib/tasks/foreman_snapshot_management_tasks.rake
|
63
|
+
- locale/Makefile
|
64
|
+
- locale/en/foreman_snapshot_management.po
|
65
|
+
- locale/foreman_snapshot_management.pot
|
66
|
+
- locale/gemspec.rb
|
67
|
+
- test/test_plugin_helper.rb
|
68
|
+
- test/unit/foreman_snapshot_management_test.rb
|
69
|
+
homepage: http://www.orcharhino.com
|
70
|
+
licenses: []
|
71
|
+
metadata: {}
|
72
|
+
post_install_message:
|
73
|
+
rdoc_options: []
|
74
|
+
require_paths:
|
75
|
+
- lib
|
76
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
77
|
+
requirements:
|
78
|
+
- - ">="
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: '0'
|
81
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
82
|
+
requirements:
|
83
|
+
- - ">="
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
requirements: []
|
87
|
+
rubyforge_project:
|
88
|
+
rubygems_version: 2.5.2
|
89
|
+
signing_key:
|
90
|
+
specification_version: 4
|
91
|
+
summary: Snapshot Management for VMware vSphere
|
92
|
+
test_files:
|
93
|
+
- test/test_plugin_helper.rb
|
94
|
+
- test/unit/foreman_snapshot_management_test.rb
|