Class: ForemanTemplates::Action
- Inherits:
-
Object
- Object
- ForemanTemplates::Action
show all
- Defined in:
- app/services/foreman_templates/action.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(args = {}) ⇒ Action
Returns a new instance of Action.
35
36
37
38
39
|
# File 'app/services/foreman_templates/action.rb', line 35
def initialize(args = {})
@taxonomies = { :organizations => args[:organization_params] || {},
:locations => args[:location_params] || {} }
assign_attributes args
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
23
24
25
26
27
28
29
|
# File 'app/services/foreman_templates/action.rb', line 23
def method_missing(method, *args, &block)
if self.class.setting_overrides.include?(method)
instance_variable_get("@#{method}")
else
super
end
end
|
Class Method Details
.file_repo_start_with ⇒ Object
11
12
13
|
# File 'app/services/foreman_templates/action.rb', line 11
def self.file_repo_start_with
['/']
end
|
.git_repo_start_with ⇒ Object
7
8
9
|
# File 'app/services/foreman_templates/action.rb', line 7
def self.git_repo_start_with
%w{http:// https:// git:// ssh:// git+ssh:// ssh+git://}
end
|
.repo_start_with ⇒ Object
15
16
17
|
# File 'app/services/foreman_templates/action.rb', line 15
def self.repo_start_with
git_repo_start_with + file_repo_start_with
end
|
.setting_overrides ⇒ Object
19
20
21
|
# File 'app/services/foreman_templates/action.rb', line 19
def self.setting_overrides
%i(verbose prefix dirname filter repo negate branch http_proxy_policy)
end
|
Instance Method Details
#get_absolute_repo_path ⇒ Object
45
46
47
|
# File 'app/services/foreman_templates/action.rb', line 45
def get_absolute_repo_path
File.expand_path(@repo)
end
|
#git_repo? ⇒ Boolean
41
42
43
|
# File 'app/services/foreman_templates/action.rb', line 41
def git_repo?
@repo.start_with?(*self.class.git_repo_start_with)
end
|
#respond_to_missing?(method, include_private = false) ⇒ Boolean
31
32
33
|
# File 'app/services/foreman_templates/action.rb', line 31
def respond_to_missing?(method, include_private = false)
self.class.setting_overrides.include?(method)
end
|
#verify_path!(path) ⇒ Object
49
50
51
52
53
|
# File 'app/services/foreman_templates/action.rb', line 49
def verify_path!(path)
msg = _("Using file-based synchronization, but couldn't access %s. ") % path
msg += _("Please check the access permissions/SELinux and make sure it is readable/writable for the web application user account, typically '%s'.") % 'foreman'
raise PathAccessException, msg unless Dir.exist?(path)
end
|