Class: Bosh::Director::VmMetadataUpdater
- Defined in:
- lib/bosh/director/vm_metadata_updater.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(cloud, director_metadata, logger) ⇒ VmMetadataUpdater
constructor
A new instance of VmMetadataUpdater.
- #update(instance, metadata) ⇒ Object
Constructor Details
#initialize(cloud, director_metadata, logger) ⇒ VmMetadataUpdater
Returns a new instance of VmMetadataUpdater.
7 8 9 10 11 |
# File 'lib/bosh/director/vm_metadata_updater.rb', line 7 def initialize(cloud, , logger) @cloud = cloud @director_metadata = @logger = logger end |
Class Method Details
Instance Method Details
#update(instance, metadata) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/bosh/director/vm_metadata_updater.rb', line 13 def update(instance, ) if @cloud.respond_to?(:set_vm_metadata) = .merge(@director_metadata) [:deployment] = instance.deployment.name [:id] = instance.uuid [:job] = instance.job [:index] = instance.index.to_s [:name] = "#{instance.job}/#{instance.uuid}" [:created_at] = Time.new.getutc.strftime('%Y-%m-%dT%H:%M:%SZ') @cloud.(instance.vm_cid, ) end rescue Bosh::Clouds::NotImplemented => e @logger.debug(e.inspect) end |