Class: AethernalAgent::Docker::Env
- Inherits:
-
Object
- Object
- AethernalAgent::Docker::Env
- Defined in:
- lib/aethernal_agent/docker/env.rb
Instance Attribute Summary collapse
-
#key ⇒ Object
Returns the value of attribute key.
-
#value ⇒ Object
Returns the value of attribute value.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(key, value) ⇒ Env
constructor
A new instance of Env.
- #to_docker ⇒ Object
Constructor Details
#initialize(key, value) ⇒ Env
Returns a new instance of Env.
5 6 7 8 |
# File 'lib/aethernal_agent/docker/env.rb', line 5 def initialize(key, value) self.key= key self.value= value end |
Instance Attribute Details
#key ⇒ Object
Returns the value of attribute key.
4 5 6 |
# File 'lib/aethernal_agent/docker/env.rb', line 4 def key @key end |
#value ⇒ Object
Returns the value of attribute value.
4 5 6 |
# File 'lib/aethernal_agent/docker/env.rb', line 4 def value @value end |
Class Method Details
.create_from_options(manifest_options, opts) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/aethernal_agent/docker/env.rb', line 10 def self.(, opts) envs = [] .each do |k,v| if v.present? if v["docker"].present? && v["docker"]["env"].present? if v["docker"].has_key?("auto_source") && ["user_id"].include?(v["docker"]["auto_source"]) # For now only allow user_id to be auto-sourced but we can add more things later user_id = Etc.getpwnam(opts["user"]).uid envs << Env.new(v["docker"]["env"], user_id) else envs << Env.new(v["docker"]["env"], opts[k]) end end end end return envs end |
Instance Method Details
#to_docker ⇒ Object
28 29 30 |
# File 'lib/aethernal_agent/docker/env.rb', line 28 def to_docker "#{self.key}=#{self.value}" end |