Module: Chef::Resource::SslCertificate::KeyCert

Included in:
Chef::Resource::SslCertificate
Defined in:
libraries/resource_ssl_certificate_keycert.rb

Overview

ssl_certificate Chef Resource key and cert common related methods.

Instance Method Summary collapse

Instance Method Details

#bag(arg = nil) ⇒ Object


59
60
61
62
63
64
# File 'libraries/resource_ssl_certificate_keycert.rb', line 59

def bag(arg = nil)
  return key_bag if arg.nil?
  key_bag(arg)
  cert_bag(arg)
  chain_bag(arg)
end

#dir(arg = nil) ⇒ Object


45
46
47
48
49
50
# File 'libraries/resource_ssl_certificate_keycert.rb', line 45

def dir(arg = nil)
  return key_dir if arg.nil?
  key_dir(arg)
  cert_dir(arg)
  chain_dir(arg)
end

#encrypted(arg = nil) ⇒ Object


73
74
75
76
77
78
# File 'libraries/resource_ssl_certificate_keycert.rb', line 73

def encrypted(arg = nil)
  return key_encrypted if arg.nil?
  key_encrypted(arg)
  cert_encrypted(arg)
  chain_encrypted(arg)
end

#item(arg = nil) ⇒ Object


66
67
68
69
70
71
# File 'libraries/resource_ssl_certificate_keycert.rb', line 66

def item(arg = nil)
  return key_item if arg.nil?
  key_item(arg)
  cert_item(arg)
  chain_item(arg)
end

#secret_file(arg = nil) ⇒ Object


80
81
82
83
84
85
# File 'libraries/resource_ssl_certificate_keycert.rb', line 80

def secret_file(arg = nil)
  return key_secret_file if arg.nil?
  key_secret_file(arg)
  cert_secret_file(arg)
  chain_secret_file(arg)
end

#source(arg = nil) ⇒ Object


52
53
54
55
56
57
# File 'libraries/resource_ssl_certificate_keycert.rb', line 52

def source(arg = nil)
  return key_source if arg.nil?
  key_source(arg)
  cert_source(arg)
  chain_source(arg)
end

#years(arg = nil) ⇒ Object


35
36
37
38
39
40
41
42
43
# File 'libraries/resource_ssl_certificate_keycert.rb', line 35

def years(arg = nil)
  return (time.to_i / 31_536_000).round if arg.nil?
  unless [Integer, String].inject(false) { |a, e| a || arg.is_a?(e) }
    raise Exceptions::ValidationFailed,
          "Option years must be a kind of #{to_be}! You passed "\
          "#{arg.inspect}."
  end
  time(arg.to_i * 31_536_000)
end