Class: Kriterion::Report

Inherits:
Object
  • Object
show all
Defined in:
lib/kriterion/report.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Report

Returns a new instance of Report.



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/kriterion/report.rb', line 24

def initialize(data)
  @host                  = data['host']
  @time                  = data['time']
  @configuration_version = data['configuration_version']
  @transaction_uuid      = data['transaction_uuid']
  @report_format         = data['report_format']
  @puppet_version        = data['puppet_version']
  @status                = data['status']
  @transaction_completed = data['transaction_completed']
  @noop                  = data['noop']
  @noop_pending          = data['noop_pending']
  @environment           = data['environment']
  @logs                  = data['logs']
  @metrics               = data['metrics']
  @resource_statuses     = data['resource_statuses']
  @corrective_change     = data['corrective_change']
  @catalog_uuid          = data['catalog_uuid']
  @code_id               = data['code_id']
  @cached_catalog_status = data['cached_catalog_status']
end

Instance Attribute Details

#cached_catalog_statusObject (readonly)

Returns the value of attribute cached_catalog_status.



22
23
24
# File 'lib/kriterion/report.rb', line 22

def cached_catalog_status
  @cached_catalog_status
end

#catalog_uuidObject (readonly)

Returns the value of attribute catalog_uuid.



20
21
22
# File 'lib/kriterion/report.rb', line 20

def catalog_uuid
  @catalog_uuid
end

#code_idObject (readonly)

Returns the value of attribute code_id.



21
22
23
# File 'lib/kriterion/report.rb', line 21

def code_id
  @code_id
end

#configuration_versionObject (readonly)

Returns the value of attribute configuration_version.



8
9
10
# File 'lib/kriterion/report.rb', line 8

def configuration_version
  @configuration_version
end

#corrective_changeObject (readonly)

Returns the value of attribute corrective_change.



19
20
21
# File 'lib/kriterion/report.rb', line 19

def corrective_change
  @corrective_change
end

#environmentObject (readonly)

Returns the value of attribute environment.



16
17
18
# File 'lib/kriterion/report.rb', line 16

def environment
  @environment
end

#hostObject (readonly)

Returns the value of attribute host.



6
7
8
# File 'lib/kriterion/report.rb', line 6

def host
  @host
end

#logsObject (readonly)

Returns the value of attribute logs.



17
18
19
# File 'lib/kriterion/report.rb', line 17

def logs
  @logs
end

#metricsObject (readonly)

Returns the value of attribute metrics.



18
19
20
# File 'lib/kriterion/report.rb', line 18

def metrics
  @metrics
end

#noopObject (readonly)

Returns the value of attribute noop.



14
15
16
# File 'lib/kriterion/report.rb', line 14

def noop
  @noop
end

#noop_pendingObject (readonly)

Returns the value of attribute noop_pending.



15
16
17
# File 'lib/kriterion/report.rb', line 15

def noop_pending
  @noop_pending
end

#puppet_versionObject (readonly)

Returns the value of attribute puppet_version.



11
12
13
# File 'lib/kriterion/report.rb', line 11

def puppet_version
  @puppet_version
end

#report_formatObject (readonly)

Returns the value of attribute report_format.



10
11
12
# File 'lib/kriterion/report.rb', line 10

def report_format
  @report_format
end

#statusObject (readonly)

Returns the value of attribute status.



12
13
14
# File 'lib/kriterion/report.rb', line 12

def status
  @status
end

#timeObject (readonly)

Returns the value of attribute time.



7
8
9
# File 'lib/kriterion/report.rb', line 7

def time
  @time
end

#transaction_completedObject (readonly)

Returns the value of attribute transaction_completed.



13
14
15
# File 'lib/kriterion/report.rb', line 13

def transaction_completed
  @transaction_completed
end

#transaction_uuidObject (readonly)

Returns the value of attribute transaction_uuid.



9
10
11
# File 'lib/kriterion/report.rb', line 9

def transaction_uuid
  @transaction_uuid
end

Instance Method Details

#certnameObject



56
57
58
# File 'lib/kriterion/report.rb', line 56

def certname
  host
end

#resource_statusesObject



45
46
47
48
49
50
51
52
53
54
# File 'lib/kriterion/report.rb', line 45

def resource_statuses
  # If this is a hash then the objects haven't been initialised
  # We should initialise them now
  if @resource_statuses.is_a? Hash
    @resource_statuses = @resource_statuses.map do |_ref, params|
      Kriterion::Resource.new(params)
    end
  end
  @resource_statuses
end

#resources_with_tags(tags) ⇒ Object

Returns resources that have given tags, expects an array of tags



61
62
63
64
65
66
67
# File 'lib/kriterion/report.rb', line 61

def resources_with_tags(tags)
  resource_statuses.select do |resource|
    tags.any? do |tag|
      resource.tags.include? tag
    end
  end
end