Class: Bosh::Agent::ApplyPlan::Package

Inherits:
Object
  • Object
show all
Includes:
Helpers
Defined in:
lib/bosh_agent/apply_plan/package.rb

Defined Under Namespace

Classes: InstallationError

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(spec) ⇒ Package

Returns a new instance of Package.



14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/bosh_agent/apply_plan/package.rb', line 14

def initialize(spec)
  validate_spec(spec)

  @base_dir = Bosh::Agent::Config.base_dir
  @name = spec['name']
  @version = spec['version']
  @checksum = spec['sha1']
  @blobstore_id = spec['blobstore_id']

  @install_path = File.join(@base_dir, 'data', 'packages',
                            @name, @version)
  @link_path = File.join(@base_dir, 'packages', @name)
end

Instance Attribute Details

#install_pathObject (readonly)

Returns the value of attribute install_path.



11
12
13
# File 'lib/bosh_agent/apply_plan/package.rb', line 11

def install_path
  @install_path
end

Returns the value of attribute link_path.



12
13
14
# File 'lib/bosh_agent/apply_plan/package.rb', line 12

def link_path
  @link_path
end

Instance Method Details

#install_for_job(job) ⇒ Object



32
33
34
35
36
37
# File 'lib/bosh_agent/apply_plan/package.rb', line 32

def install_for_job(job)
  fetch_bits_and_symlink
  create_symlink_in_job(job) if job
rescue SystemCallError => e
  install_failed("System call error: #{e.message}")
end

#prepare_for_installObject



28
29
30
# File 'lib/bosh_agent/apply_plan/package.rb', line 28

def prepare_for_install
  fetch_bits
end