Class: HealthInspector::Checklists::Roles
- Inherits:
-
Base
- Object
- Base
- HealthInspector::Checklists::Roles
show all
- Defined in:
- lib/health_inspector/checklists/roles.rb
Instance Method Summary
collapse
Methods inherited from Base
#all_item_names, #banner, #indent, #initialize, #load_ruby_or_json_from_local, #load_validate, option, #print_failures, #print_failures_from_hash, #print_key, #print_success, #print_value_diff, run, #run, title, #ui, underscored_class, #validate_item
#color
Instance Method Details
#load_item(name) ⇒ Object
11
12
13
14
15
16
17
|
# File 'lib/health_inspector/checklists/roles.rb', line 11
def load_item(name)
Role.new(@context,
name: name,
server: load_item_from_server(name),
local: load_item_from_local(name)
)
end
|
#load_item_from_local(name) ⇒ Object
36
37
38
|
# File 'lib/health_inspector/checklists/roles.rb', line 36
def load_item_from_local(name)
load_ruby_or_json_from_local(Chef::Role, 'roles', name)
end
|
#load_item_from_server(name) ⇒ Object
29
30
31
32
33
34
|
# File 'lib/health_inspector/checklists/roles.rb', line 29
def load_item_from_server(name)
role = Chef::Role.load(name)
role.to_hash
rescue
nil
end
|
#local_items ⇒ Object
23
24
25
26
27
|
# File 'lib/health_inspector/checklists/roles.rb', line 23
def local_items
Dir["#{@context.repo_path}/roles/**/*.{rb,json,js}"].map do |e|
File.basename(e, '.*')
end
end
|
#server_items ⇒ Object
19
20
21
|
# File 'lib/health_inspector/checklists/roles.rb', line 19
def server_items
@server_items ||= Chef::Role.list.keys
end
|