Class: Services::Connection
- Inherits:
-
Object
- Object
- Services::Connection
- Includes:
- Chef::DSL::DataQuery, Chef::Mixin::Language
- Defined in:
- lib/services/connection.rb
Overview
Setup ETCD connection via chef or plain host Also stores that aconnection in Services.connection Most other classes require this to be setup
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#node ⇒ Object
readonly
Returns the value of attribute node.
-
#port ⇒ Object
readonly
Returns the value of attribute port.
-
#run_context ⇒ Object
readonly
Returns the value of attribute run_context.
-
#ssl_verify ⇒ Object
readonly
Returns the value of attribute ssl_verify.
Instance Method Summary collapse
-
#initialize(args) ⇒ Connection
constructor
Initialize etcd client.
Constructor Details
#initialize(args) ⇒ Connection
Initialize etcd client
You should pass either a run_context or explicit host/port arguments the run_context will take prescedence
31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/services/connection.rb', line 31 def initialize(args) @run_context = args.fetch(:run_context, nil) Services.run_context = args[:run_context] @node = args[:run_context].node if run_context @host = args[:host] @port = args[:port] || 4001 @redirect = args[:redirect] || true @ssl_verify = args[:verify] || OpenSSL::SSL::VERIFY_NONE validate load_gem Services.connection = get_connection(find_servers) end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
10 11 12 |
# File 'lib/services/connection.rb', line 10 def client @client end |
#host ⇒ Object (readonly)
Returns the value of attribute host.
10 11 12 |
# File 'lib/services/connection.rb', line 10 def host @host end |
#node ⇒ Object (readonly)
Returns the value of attribute node.
10 11 12 |
# File 'lib/services/connection.rb', line 10 def node @node end |
#port ⇒ Object (readonly)
Returns the value of attribute port.
10 11 12 |
# File 'lib/services/connection.rb', line 10 def port @port end |
#run_context ⇒ Object (readonly)
Returns the value of attribute run_context.
10 11 12 |
# File 'lib/services/connection.rb', line 10 def run_context @run_context end |
#ssl_verify ⇒ Object (readonly)
Returns the value of attribute ssl_verify.
10 11 12 |
# File 'lib/services/connection.rb', line 10 def ssl_verify @ssl_verify end |