Class: Hoss::Index::Chef

Inherits:
Object
  • Object
show all
Defined in:
lib/hoss/index/chef.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts) ⇒ Chef

Returns a new instance of Chef.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/hoss/index/chef.rb', line 13

def initialize opts
  @resources = opts[:chef_resources]
  @index     = opts[:index_name]
  @log       = opts[:logger]

  @ridley = Ridley.from_chef_config opts.knife

  @es = Elasticsearch::Client.new \
    host: opts.elasticsearch_host,
    reload_connections: true,
    reload_on_failure: true,
    trace: opts.trace?,
    log: opts.trace? ? @log : nil

  log.debug \
    event: 'reindex',
    opts: opts

  started = Time.now

  reindex

  log.info \
    event: 'reindexed',
    elapsed: Time.now - started
end

Instance Attribute Details

#esObject (readonly)

Returns the value of attribute es.



11
12
13
# File 'lib/hoss/index/chef.rb', line 11

def es
  @es
end

#indexObject (readonly)

Returns the value of attribute index.



11
12
13
# File 'lib/hoss/index/chef.rb', line 11

def index
  @index
end

#logObject (readonly)

Returns the value of attribute log.



11
12
13
# File 'lib/hoss/index/chef.rb', line 11

def log
  @log
end

#resourcesObject (readonly)

Returns the value of attribute resources.



11
12
13
# File 'lib/hoss/index/chef.rb', line 11

def resources
  @resources
end

#ridleyObject (readonly)

Returns the value of attribute ridley.



11
12
13
# File 'lib/hoss/index/chef.rb', line 11

def ridley
  @ridley
end