Class: Bosh::Deployer::Specification
- Inherits:
-
Object
- Object
- Bosh::Deployer::Specification
- Defined in:
- lib/deployer/specification.rb
Instance Attribute Summary collapse
-
#properties ⇒ Object
Returns the value of attribute properties.
-
#spec ⇒ Object
Returns the value of attribute spec.
Class Method Summary collapse
Instance Method Summary collapse
- #delete(name) ⇒ Object
-
#director_port ⇒ String
The port the director runs on.
-
#initialize(spec) ⇒ Specification
constructor
A new instance of Specification.
-
#update(bosh_ip, service_ip) ⇒ Object
Update the spec with the IP of the micro bosh instance.
Constructor Details
#initialize(spec) ⇒ Specification
Returns a new instance of Specification.
21 22 23 24 |
# File 'lib/deployer/specification.rb', line 21 def initialize(spec) @spec = spec @properties = @spec["properties"] end |
Instance Attribute Details
#properties ⇒ Object
Returns the value of attribute properties.
19 20 21 |
# File 'lib/deployer/specification.rb', line 19 def properties @properties end |
#spec ⇒ Object
Returns the value of attribute spec.
18 19 20 |
# File 'lib/deployer/specification.rb', line 18 def spec @spec end |
Class Method Details
.load_apply_spec(dir) ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'lib/deployer/specification.rb', line 9 def self.load_apply_spec(dir) file = "apply_spec.yml" apply_spec = File.join(dir, file) unless File.exist?(apply_spec) err "this isn't a micro bosh stemcell - #{file} missing" end YAML.load_file(apply_spec) end |
.load_from_stemcell(dir) ⇒ Object
4 5 6 7 |
# File 'lib/deployer/specification.rb', line 4 def self.load_from_stemcell(dir) spec = load_apply_spec(dir) Specification.new(spec) end |
Instance Method Details
#delete(name) ⇒ Object
65 66 67 |
# File 'lib/deployer/specification.rb', line 65 def delete(name) @spec.delete(name) end |
#director_port ⇒ String
Returns the port the director runs on.
70 71 72 |
# File 'lib/deployer/specification.rb', line 70 def director_port @properties["director"]["port"] end |
#update(bosh_ip, service_ip) ⇒ Object
Update the spec with the IP of the micro bosh instance.
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/deployer/specification.rb', line 30 def update(bosh_ip, service_ip) # set the director name to what is specified in the micro_bosh.yml if Config.name @properties["director"] = {} unless @properties["director"] @properties["director"]["name"] = Config.name end # on AWS blobstore and nats need to use an elastic IP (if available), # as when the micro bosh instance is re-created during a deployment, # it might get a new private IP %w{blobstore nats}.each do |service| update_agent_service_address(service, bosh_ip) end services = %w{postgres director redis blobstore nats aws_registry openstack_registry powerdns} services.each do |service| update_service_address(service, service_ip) end # health monitor does not listen to any ports, so there is no # need to update the service address, but we still want to # be able to override values in the apply_spec override_property(@properties, "hm", Config.spec_properties["hm"]) # TODO this override should be made more generic if Config.spec_properties.has_key?("ntp") @properties["agent"] ||= {} @properties["agent"]["ntp"] = Config.spec_properties["ntp"] end @spec end |