foreman_templates 6.0.3 → 7.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (27) hide show
  1. checksums.yaml +4 -4
  2. data/app/controllers/concerns/foreman/controller/parameters/template_params.rb +20 -4
  3. data/app/controllers/template_syncs_controller.rb +13 -0
  4. data/app/controllers/ui_template_syncs_controller.rb +48 -0
  5. data/app/helpers/foreman_templates_helper.rb +10 -0
  6. data/app/models/setting/template_sync.rb +50 -3
  7. data/app/services/foreman_templates/action.rb +16 -4
  8. data/app/services/foreman_templates/export_result.rb +1 -0
  9. data/app/services/foreman_templates/parse_result.rb +10 -2
  10. data/app/services/foreman_templates/path_access_exception.rb +4 -0
  11. data/app/services/foreman_templates/template_exporter.rb +13 -8
  12. data/app/services/foreman_templates/template_importer.rb +3 -1
  13. data/app/views/template_sync_settings/show.json.rabl +11 -0
  14. data/app/views/template_syncs/index.html.erb +20 -0
  15. data/app/views/ui_template_syncs/export.json.rabl +9 -0
  16. data/app/views/ui_template_syncs/import.json.rabl +9 -0
  17. data/app/views/ui_template_syncs/sync_settings.json.rabl +11 -0
  18. data/app/views/ui_template_syncs/template_attrs.json.rabl +19 -0
  19. data/app/views/ui_template_syncs/template_export_result.rabl +7 -0
  20. data/app/views/ui_template_syncs/template_export_results.json.rabl +3 -0
  21. data/app/views/ui_template_syncs/template_import_result.json.rabl +7 -0
  22. data/app/views/ui_template_syncs/template_import_results.json.rabl +3 -0
  23. data/config/routes.rb +13 -1
  24. data/lib/foreman_templates/engine.rb +23 -3
  25. data/lib/foreman_templates/version.rb +1 -1
  26. data/lib/tasks/foreman_templates_tasks.rake +0 -2
  27. metadata +18 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0cc280125e10a060bc7debd69bffbc0d233e26fb
4
- data.tar.gz: 0341d3c81c3a0e91dd120fa77e33d5d0d45b1bb8
3
+ metadata.gz: 63fe0a1d25d54d0f50a328051d90f5df2ace0aa4
4
+ data.tar.gz: 430fbe5dfccd63f678dbb50d72cac11c124c8326
5
5
  SHA512:
6
- metadata.gz: 4ca8d2c2d570a1895100218dcfcc7139e1791f450fcd3619c9c50641d22ce0e59003f9122a87c747d93d108e8defb2bb6d7f934f63ff20346486dd6b6ddcc050
7
- data.tar.gz: b133cc7b56cf66d9a3edb57d22cef6701b43f82c879dcd338381a69ac985768c9aee54d0dbf55f827470db8fa6e172c155d07a7d84b4fc18efe4e005ae0dd869
6
+ metadata.gz: c57bc9dc48fd3f5b786f05d381ba9b81c3d61a47668b001e6ddcc0565f70b3b31161b27efa2cf41fef57982c6cafb47d2fb411f41bc1b598a06f8f0c76647e32
7
+ data.tar.gz: 2cff0a4e2a51fff6fc662ae11c30a4b77de1ab34dc11a3f1c93131244a6d7784a8181c23ad3aec4990da7bc5d035c4e622495106cfac12e21544077d7077c18b
@@ -25,14 +25,30 @@ module Foreman
25
25
  end
26
26
  end
27
27
 
28
+ def ui_template_import_params
29
+ base_import_params :ui_template_sync
30
+ end
31
+
32
+ def ui_template_export_params
33
+ base_export_params :ui_template_sync
34
+ end
35
+
28
36
  def template_import_params
29
- add_taxonomy_params(self.class.template_params_filter(self.class.extra_import_params)
30
- .filter_params(params, parameter_filter_context, :none).with_indifferent_access)
37
+ add_taxonomy_params(base_import_params(:none))
31
38
  end
32
39
 
33
40
  def template_export_params
34
- add_taxonomy_params(self.class.template_params_filter(self.class.extra_export_params)
35
- .filter_params(params, parameter_filter_context, :none).with_indifferent_access)
41
+ add_taxonomy_params(base_export_params(:none))
42
+ end
43
+
44
+ def base_import_params(toplevel_key)
45
+ self.class.template_params_filter(self.class.extra_import_params)
46
+ .filter_params(params, parameter_filter_context, toplevel_key).with_indifferent_access
47
+ end
48
+
49
+ def base_export_params(toplevel_key)
50
+ self.class.template_params_filter(self.class.extra_export_params)
51
+ .filter_params(params, parameter_filter_context, toplevel_key).with_indifferent_access
36
52
  end
37
53
 
38
54
  def organization_params
@@ -0,0 +1,13 @@
1
+ class TemplateSyncsController < ReactController
2
+ def index
3
+ end
4
+
5
+ def action_permission
6
+ case params[:action]
7
+ when 'index'
8
+ :view_template_syncs
9
+ else
10
+ super
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,48 @@
1
+ require 'ostruct'
2
+
3
+ class UiTemplateSyncsController < ApplicationController
4
+ include ::Foreman::Controller::Parameters::TemplateParams
5
+
6
+ rescue_from ::ForemanTemplates::PathAccessException do |error|
7
+ render_errors [error.message]
8
+ end
9
+
10
+ def sync_settings
11
+ import_settings = Setting.where :name => Setting::TemplateSync.import_setting_names(['verbose'])
12
+ export_settings = Setting.where :name => Setting::TemplateSync.export_setting_names(['verbose'])
13
+ @results = OpenStruct.new(:import => import_settings, :export => export_settings)
14
+ end
15
+
16
+ def import
17
+ @parse_result = OpenStruct.new ForemanTemplates::TemplateImporter.new(ui_template_import_params).import!
18
+ end
19
+
20
+ def export
21
+ @result = ForemanTemplates::TemplateExporter.new(ui_template_export_params).export!
22
+
23
+ if @result.error
24
+ render_errors [@result.error]
25
+ end
26
+
27
+ if @result.warning
28
+ render_errors [@result.warning], 'warning'
29
+ end
30
+ end
31
+
32
+ def action_permission
33
+ case params[:action]
34
+ when 'sync_settings'
35
+ :view_template_syncs
36
+ else
37
+ super
38
+ end
39
+ end
40
+
41
+ def parameter_filter_context
42
+ Foreman::ParameterFilter::Context.new(:api, controller_name, params[:action])
43
+ end
44
+
45
+ def render_errors(messages, severity = 'danger')
46
+ render :json => { :error => { :errors => { :base => messages }, :severity => severity } }, :status => :unprocessable_entity
47
+ end
48
+ end
@@ -0,0 +1,10 @@
1
+ module ForemanTemplatesHelper
2
+ def edit_paths
3
+ Template.subclasses.reduce({}) do |memo, subclass|
4
+ memo.tap do |acc|
5
+ path_part = "#{subclass.name.underscore.pluralize}_path"
6
+ acc[subclass.name] = "#{Rails.application.routes.url_helpers.public_send(path_part)}/:id/edit"
7
+ end
8
+ end
9
+ end
10
+ end
@@ -1,5 +1,35 @@
1
1
  class Setting
2
2
  class TemplateSync < ::Setting
3
+ self.include_root_in_json = false
4
+
5
+ def self.common_stripped_names
6
+ %w(verbose repo branch dir filter negate)
7
+ end
8
+
9
+ def self.import_stripped_names
10
+ %w(prefix associate force)
11
+ end
12
+
13
+ def self.export_stripped_names
14
+ %w(metadata_export_mode)
15
+ end
16
+
17
+ def self.import_setting_names(except = [])
18
+ map_prefix omit_settings(common_stripped_names + import_stripped_names, except)
19
+ end
20
+
21
+ def self.export_setting_names(except = [])
22
+ map_prefix omit_settings(common_stripped_names + export_stripped_names, except)
23
+ end
24
+
25
+ def self.map_prefix(stripped_names)
26
+ stripped_names.map { |item| "template_sync_#{item}" }
27
+ end
28
+
29
+ def self.omit_settings(setting_names, except_array)
30
+ setting_names.reject { |name| except_array.include? name }
31
+ end
32
+
3
33
  def self.associate_types
4
34
  {
5
35
  'always' => _('Always'),
@@ -16,6 +46,17 @@ class Setting
16
46
  }
17
47
  end
18
48
 
49
+ def short_name
50
+ name.split('template_sync_').last
51
+ end
52
+
53
+ def selection
54
+ selection_method = name.split('template_sync_').last.concat('_types')
55
+ return transformed_selection(selection_method) if self.class.respond_to?(selection_method)
56
+
57
+ []
58
+ end
59
+
19
60
  def self.load_defaults
20
61
  return unless super
21
62
 
@@ -28,11 +69,11 @@ class Setting
28
69
  self.set('template_sync_associate', N_('Associate templates to OS, organization and location'), 'new', N_('Associate'), nil, { :collection => Proc.new { self.associate_types } }),
29
70
  self.set('template_sync_prefix', N_('The string all imported templates should begin with'), "", N_('Prefix')),
30
71
  self.set('template_sync_dirname', N_('The directory within the Git repo containing the templates'), '/', N_('Dirname')),
31
- self.set('template_sync_filter', N_('Import or export names matching this regex (case-insensitive; snippets are not filtered)'), nil, N_('Filter')),
72
+ self.set('template_sync_filter', N_('Import or export names matching this regex (case-insensitive; snippets are not filtered)'), '', N_('Filter')),
32
73
  self.set('template_sync_repo', N_('Target path to import and export. Different protocols can be used, e.g. /tmp/dir, git://example.com, https://example.com, ssh://example.com'), 'https://github.com/theforeman/community-templates.git', N_('Repo')),
33
74
  self.set('template_sync_negate', N_('Negate the prefix (for purging) / filter (for importing/exporting)'), false, N_('Negate')),
34
- self.set('template_sync_branch', N_('Default branch in Git repo'), nil, N_('Branch')),
35
- self.set('template_sync_metadata_export_mode', N_('Default metadata export mode, refresh re-renders metadata, keep will keep existing metadata, remove exports template withou metadata'), 'refresh', N_('Metadata export mode'), nil, { :collection => Proc.new { self.metadata_export_mode_types } }),
75
+ self.set('template_sync_branch', N_('Default branch in Git repo'), '', N_('Branch')),
76
+ self.set('template_sync_metadata_export_mode', N_('Default metadata export mode, refresh re-renders metadata, keep will keep existing metadata, remove exports template without metadata'), 'refresh', N_('Metadata export mode'), nil, { :collection => Proc.new { self.metadata_export_mode_types } }),
36
77
  self.set('template_sync_force', N_('Should importing overwrite locked templates?'), false, N_('Force import')),
37
78
  self.set('template_sync_lock', N_('Should importing lock templates?'), false, N_('Lock templates')),
38
79
  ].compact.each { |s| self.create! s.update(:category => "Setting::TemplateSync") }
@@ -54,5 +95,11 @@ class Setting
54
95
  record.errors[:base] << (_("template_sync_metadata_export_mode must be one of %s") % values.join(', '))
55
96
  end
56
97
  end
98
+
99
+ private
100
+
101
+ def transformed_selection(selection_method)
102
+ self.class.public_send(selection_method).map { |key, translated| { :value => key, :label => translated } }
103
+ end
57
104
  end
58
105
  end
@@ -2,6 +2,18 @@ module ForemanTemplates
2
2
  class Action
3
3
  delegate :logger, :to => :Rails
4
4
 
5
+ def self.git_repo_start_with
6
+ %w{http:// https:// git:// ssh:// git+ssh:// ssh+git://}
7
+ end
8
+
9
+ def self.file_repo_start_with
10
+ ['/']
11
+ end
12
+
13
+ def self.repo_start_with
14
+ git_repo_start_with + file_repo_start_with
15
+ end
16
+
5
17
  def self.setting_overrides
6
18
  %i(verbose prefix dirname filter repo negate branch)
7
19
  end
@@ -25,7 +37,7 @@ module ForemanTemplates
25
37
  end
26
38
 
27
39
  def git_repo?
28
- @repo.start_with?('http://', 'https://', 'git://', 'ssh://', 'git+ssh://', 'ssh+git://')
40
+ @repo.start_with?(*self.class.git_repo_start_with)
29
41
  end
30
42
 
31
43
  def get_absolute_repo_path
@@ -33,9 +45,9 @@ module ForemanTemplates
33
45
  end
34
46
 
35
47
  def verify_path!(path)
36
- msg = _("Using file-based synchronization, but couldn't access %s to export templates. ") % path
37
- msg += _("Please check the access permissions/SELinux and make sure it is writable for the web application user account, typically 'foreman'.")
38
- raise msg unless Dir.exist?(path)
48
+ msg = _("Using file-based synchronization, but couldn't access %s. ") % path
49
+ msg += _("Please check the access permissions/SELinux and make sure it is readable/writable for the web application user account, typically 'foreman'.")
50
+ raise PathAccessException, msg unless Dir.exist?(path)
39
51
  end
40
52
 
41
53
  private
@@ -1,6 +1,7 @@
1
1
  module ForemanTemplates
2
2
  class ExportResult
3
3
  attr_accessor :exported, :error, :warning
4
+ attr_reader :templates, :git_user, :branch, :repo
4
5
 
5
6
  def initialize(repo, branch, git_user)
6
7
  @repo = repo
@@ -1,7 +1,7 @@
1
1
  module ForemanTemplates
2
2
  class ParseResult
3
3
  attr_accessor :name, :template
4
- attr_reader :imported, :diff, :exception, :additional_errors
4
+ attr_reader :imported, :diff, :exception, :additional_errors, :template_file, :additional_info
5
5
 
6
6
  def initialize(template_file)
7
7
  @template_file = template_file.split('/').last
@@ -34,7 +34,7 @@ module ForemanTemplates
34
34
  end
35
35
 
36
36
  def matching_filter
37
- generic_error "Skipping, 'name' filtered out based on 'filter' and 'negate' settings"
37
+ generic_info "Skipping, 'name' filtered out based on 'filter' and 'negate' settings"
38
38
  end
39
39
 
40
40
  def no_metadata_name
@@ -63,6 +63,13 @@ module ForemanTemplates
63
63
  self
64
64
  end
65
65
 
66
+ def generic_info(additional_msg)
67
+ @imported = false
68
+ @additional_info = additional_msg
69
+ Logging.logger('app').debug "Not importing #{@template_file}: #{additional_msg}"
70
+ self
71
+ end
72
+
66
73
  def name_error(exception, template_type)
67
74
  @imported = false
68
75
  @exception = exception
@@ -72,6 +79,7 @@ module ForemanTemplates
72
79
 
73
80
  def determine_result_diff
74
81
  return if @template.nil? || !@template.template_changed?
82
+
75
83
  template_was = @template.template_was
76
84
  template_is = @template.template
77
85
  @diff = calculate_diff(template_was, template_is)
@@ -0,0 +1,4 @@
1
+ module ForemanTemplates
2
+ class PathAccessException < ::StandardError
3
+ end
4
+ end
@@ -27,6 +27,7 @@ module ForemanTemplates
27
27
  def export_to_git
28
28
  @dir = Dir.mktmpdir
29
29
  return @export_result if branch_missing?
30
+
30
31
  git_repo = Git.clone(@repo, @dir)
31
32
  logger.debug "cloned '#{@repo}' to '#{@dir}'"
32
33
 
@@ -67,15 +68,19 @@ module ForemanTemplates
67
68
 
68
69
  def dump_files!
69
70
  templates = templates_to_dump
70
- templates.map do |template|
71
- current_dir = get_dump_dir(template)
72
- FileUtils.mkdir_p current_dir
73
- filename = File.join(current_dir, get_template_filename(template))
74
- File.open(filename, 'w+') do |file|
75
- logger.debug "Writing to file #{filename}"
76
- bytes = file.write template.public_send(export_method)
77
- logger.debug "finished writing #{bytes}"
71
+ begin
72
+ templates.map do |template|
73
+ current_dir = get_dump_dir(template)
74
+ FileUtils.mkdir_p current_dir
75
+ filename = File.join(current_dir, get_template_filename(template))
76
+ File.open(filename, 'w+') do |file|
77
+ logger.debug "Writing to file #{filename}"
78
+ bytes = file.write template.public_send(export_method)
79
+ logger.debug "finished writing #{bytes}"
80
+ end
78
81
  end
82
+ rescue StandardError => e
83
+ raise PathAccessException, e.message
79
84
  end
80
85
  @export_result.add_exported_templates templates
81
86
  end
@@ -7,7 +7,7 @@ module ForemanTemplates
7
7
  end
8
8
 
9
9
  def initialize(args = {})
10
- super
10
+ super args
11
11
  @verbose = parse_bool(@verbose)
12
12
  @force = parse_bool(@force)
13
13
  @lock = parse_bool(@lock)
@@ -62,6 +62,7 @@ module ForemanTemplates
62
62
 
63
63
  begin
64
64
  next unless (template_type = template_model(metadata, parse_result))
65
+
65
66
  template = template_type.import_without_save(name, text, import_options)
66
67
  parse_result.template = template
67
68
  parse_result.determine_result_diff
@@ -128,6 +129,7 @@ module ForemanTemplates
128
129
  def name_matching_filter?(name)
129
130
  matching = name.match(/#{@filter}/i)
130
131
  return !matching if @negate
132
+
131
133
  matching
132
134
  end
133
135
 
@@ -0,0 +1,11 @@
1
+ object @setting
2
+
3
+ node do |setting|
4
+ { :name => setting.short_name }
5
+ end
6
+
7
+ attributes :id, :value, :description, :settings_type, :default, :full_name
8
+
9
+ node do |setting|
10
+ { :selection => setting.selection }
11
+ end
@@ -0,0 +1,20 @@
1
+ <%= webpacked_plugins_js_for :foreman_templates %>
2
+ <%= webpacked_plugins_css_for :foreman_templates %>
3
+
4
+ <div id="foreman-templates"/>
5
+
6
+ <%= mount_react_component('ForemanTemplates',
7
+ '#foreman-templates',
8
+ { :apiUrls => {
9
+ :exportUrl => export_ui_template_syncs_path,
10
+ :syncSettingsUrl => sync_settings_ui_template_syncs_path,
11
+ :importUrl => import_ui_template_syncs_path
12
+ },
13
+ :validationData => { :repo => ForemanTemplates::Action.repo_start_with },
14
+ :editPaths => edit_paths,
15
+ :fileRepoStartWith => ForemanTemplates::Action.file_repo_start_with,
16
+ :userPermissions => {
17
+ :import => authorized_for(:controller => :ui_template_syncs, :action => :import),
18
+ :export => authorized_for(:controller => :ui_template_syncs, :action => :export)
19
+ }
20
+ }.to_json )%>
@@ -0,0 +1,9 @@
1
+ object @result
2
+
3
+ attributes :repo, :branch, :git_user, :error, :warning
4
+
5
+ node(:result_action) { 'export' }
6
+
7
+ child :templates => :templates do
8
+ extends 'ui_template_syncs/template_export_results'
9
+ end
@@ -0,0 +1,9 @@
1
+ object @parse_result
2
+
3
+ attributes :repo, :branch
4
+
5
+ node(:result_action) { 'import' }
6
+
7
+ child :results => :templates do
8
+ extends 'ui_template_syncs/template_import_results'
9
+ end
@@ -0,0 +1,11 @@
1
+ object false
2
+
3
+ child @results => :results do
4
+ child :import => :import do
5
+ extends "template_sync_settings/show"
6
+ end
7
+
8
+ child :export => :export do
9
+ extends "template_sync_settings/show"
10
+ end
11
+ end
@@ -0,0 +1,19 @@
1
+ object @template
2
+
3
+ attributes :id, :snippet, :locked
4
+
5
+ node(:kind) do |template|
6
+ template.template_kind.name if template.respond_to?(:template_kind) && template.template_kind
7
+ end
8
+
9
+ node(:class_name) do |template|
10
+ template.class.name
11
+ end
12
+
13
+ node(:humanized_class_name) do |template|
14
+ template.class.name.underscore.split('_').map { |part| part.capitalize }.join(' ')
15
+ end
16
+
17
+ node(:can_edit) do |template|
18
+ authorized_for(:auth_object => template, :authorizer => authorizer, :permission => "edit_#{template.class.name.underscore.pluralize}")
19
+ end
@@ -0,0 +1,7 @@
1
+ object @template
2
+
3
+ attributes :name
4
+
5
+ node(false) do |template|
6
+ partial "ui_template_syncs/template_attrs", :object => template
7
+ end
@@ -0,0 +1,3 @@
1
+ collection @templates
2
+
3
+ extends "ui_template_syncs/template_export_result"
@@ -0,0 +1,7 @@
1
+ object @template_result
2
+
3
+ attributes :additional_errors, :errors, :exception_message, :name, :template_file, :additional_info
4
+
5
+ node(false) do |result|
6
+ partial "ui_template_syncs/template_attrs", :object => result.template
7
+ end
@@ -0,0 +1,3 @@
1
+ collection @templates
2
+
3
+ extends "ui_template_syncs/template_import_result"
@@ -1,6 +1,18 @@
1
1
  Rails.application.routes.draw do
2
+ resources :template_syncs, :only => [:index]
3
+
4
+ resources :ui_template_syncs, :only => [] do
5
+ collection do
6
+ get 'sync_settings'
7
+ post 'import'
8
+ post 'export'
9
+ end
10
+ end
11
+
12
+ match '/template_syncs/*page' => 'template_syncs#index', :via => [:get]
13
+
2
14
  namespace :api, :defaults => { :format => 'json' } do
3
- scope "(:apiv)", :module => :v2, :defaults => { :apiv => 'v2' }, :apiv => /v1|v2/, :constraints => ApiConstraints.new(:version => 2) do
15
+ scope "(:apiv)", :module => :v2, :defaults => { :apiv => 'v2' }, :apiv => /v2/, :constraints => ApiConstraints.new(:version => 2, :default => true) do
4
16
  resources :templates, :controller => :template, :only => [] do
5
17
  collection do
6
18
  post 'import'
@@ -2,6 +2,7 @@ require 'fileutils'
2
2
  require 'yaml'
3
3
  require 'diffy'
4
4
  require 'git'
5
+ require 'rabl'
5
6
 
6
7
  module ForemanTemplates
7
8
  # Inherit from the Rails module of the parent app (Foreman), not the plugin.
@@ -13,21 +14,40 @@ module ForemanTemplates
13
14
  require_dependency File.expand_path('../../app/models/setting/template_sync.rb', __dir__) if (Setting.table_exists? rescue(false))
14
15
  end
15
16
 
17
+ initializer "foreman_templates.add_rabl_view_path" do
18
+ Rabl.configure do |config|
19
+ config.view_paths << ForemanTemplates::Engine.root.join('app', 'views')
20
+ end
21
+ end
22
+
16
23
  initializer 'foreman_templates.register_plugin', :before => :finisher_hook do
17
24
  Foreman::Plugin.register :foreman_templates do
18
- requires_foreman '>= 1.18'
25
+ requires_foreman '>= 1.24'
19
26
 
20
27
  apipie_documented_controllers ["#{ForemanTemplates::Engine.root}/app/controllers/api/v2/*.rb"]
21
28
 
22
29
  security_block :templates do
23
30
  permission :import_templates, {
24
- :"api/v2/template" => [:import]
31
+ :"api/v2/template" => [:import],
32
+ :ui_template_syncs => [:import]
25
33
  }, :resource_type => 'Template'
26
34
  permission :export_templates, {
27
- :"api/v2/template" => [:export]
35
+ :"api/v2/template" => [:export],
36
+ :ui_template_syncs => [:export]
37
+ }, :resource_type => 'Template'
38
+ permission :view_template_syncs, {
39
+ :ui_template_syncs => [:sync_settings],
40
+ :template_syncs => [:index]
28
41
  }, :resource_type => 'Template'
29
42
  end
30
43
  add_all_permissions_to_default_roles
44
+
45
+ menu :top_menu, :template_sync,
46
+ :url_hash => { :controller => :template_syncs, :action => :index },
47
+ :caption => N_('Sync Templates'),
48
+ :parent => :hosts_menu,
49
+ :before => :ptables,
50
+ :turbolinks => false
31
51
  end
32
52
  end
33
53
  end
@@ -1,3 +1,3 @@
1
1
  module ForemanTemplates
2
- VERSION = '6.0.3'.freeze
2
+ VERSION = '7.0.0'.freeze
3
3
  end
@@ -1,6 +1,5 @@
1
1
  require 'pp'
2
2
  # Tasks
3
- # rubocop:disable Metrics/BlockLength
4
3
  namespace :templates do
5
4
  desc 'Import templates according to settings'
6
5
  task :import => :environment do
@@ -72,7 +71,6 @@ namespace :templates do
72
71
  puts 'Clean up finished, you can now remove the plugin from your system'
73
72
  end
74
73
  end
75
- # rubocop:enable Metrics/BlockLength
76
74
 
77
75
  # Tests
78
76
  namespace :test do
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: 6.0.3
4
+ version: 7.0.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: 2018-07-11 00:00:00.000000000 Z
11
+ date: 2019-10-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: diffy
@@ -65,13 +65,27 @@ files:
65
65
  - Rakefile
66
66
  - app/controllers/api/v2/template_controller.rb
67
67
  - app/controllers/concerns/foreman/controller/parameters/template_params.rb
68
+ - app/controllers/template_syncs_controller.rb
69
+ - app/controllers/ui_template_syncs_controller.rb
70
+ - app/helpers/foreman_templates_helper.rb
68
71
  - app/models/setting/template_sync.rb
69
72
  - app/services/foreman_templates/action.rb
70
73
  - app/services/foreman_templates/cleaner.rb
71
74
  - app/services/foreman_templates/export_result.rb
72
75
  - app/services/foreman_templates/parse_result.rb
76
+ - app/services/foreman_templates/path_access_exception.rb
73
77
  - app/services/foreman_templates/template_exporter.rb
74
78
  - app/services/foreman_templates/template_importer.rb
79
+ - app/views/template_sync_settings/show.json.rabl
80
+ - app/views/template_syncs/index.html.erb
81
+ - app/views/ui_template_syncs/export.json.rabl
82
+ - app/views/ui_template_syncs/import.json.rabl
83
+ - app/views/ui_template_syncs/sync_settings.json.rabl
84
+ - app/views/ui_template_syncs/template_attrs.json.rabl
85
+ - app/views/ui_template_syncs/template_export_result.rabl
86
+ - app/views/ui_template_syncs/template_export_results.json.rabl
87
+ - app/views/ui_template_syncs/template_import_result.json.rabl
88
+ - app/views/ui_template_syncs/template_import_results.json.rabl
75
89
  - config/routes.rb
76
90
  - lib/foreman_templates.rb
77
91
  - lib/foreman_templates/engine.rb
@@ -79,7 +93,7 @@ files:
79
93
  - lib/tasks/foreman_templates_tasks.rake
80
94
  homepage: https://github.com/theforeman/foreman_templates
81
95
  licenses:
82
- - GPL-3
96
+ - GPL-3.0
83
97
  metadata: {}
84
98
  post_install_message:
85
99
  rdoc_options: []
@@ -97,7 +111,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
97
111
  version: '0'
98
112
  requirements: []
99
113
  rubyforge_project:
100
- rubygems_version: 2.6.8
114
+ rubygems_version: 2.6.14
101
115
  signing_key:
102
116
  specification_version: 4
103
117
  summary: Template-syncing engine for Foreman