Class: Bosh::Deployer::Stemcell

Inherits:
Object
  • Object
show all
Defined in:
lib/bosh-deployer/stemcell.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, version, default_path = '~/.deployer/stemcells') ⇒ Stemcell



5
6
7
8
9
# File 'lib/bosh-deployer/stemcell.rb', line 5

def initialize(name, version, default_path = '~/.deployer/stemcells')
  @name = name
  @version = version
  @default_path = default_path
end

Instance Attribute Details

#default_pathObject (readonly)

Returns the value of attribute default_path.



4
5
6
# File 'lib/bosh-deployer/stemcell.rb', line 4

def default_path
  @default_path
end

#nameObject (readonly)

Returns the value of attribute name.



4
5
6
# File 'lib/bosh-deployer/stemcell.rb', line 4

def name
  @name
end

#versionObject (readonly)

Returns the value of attribute version.



4
5
6
# File 'lib/bosh-deployer/stemcell.rb', line 4

def version
  @version
end

Instance Method Details

#downloadObject



11
12
13
# File 'lib/bosh-deployer/stemcell.rb', line 11

def download
  system("wget --timeout=10 -q #{url} -P #{default_path}")
end

#tar_filenameObject



18
19
20
21
22
23
24
# File 'lib/bosh-deployer/stemcell.rb', line 18

def tar_filename
  if os != 'centos'
    "bosh-stemcell-#{version}-#{cloud}-#{virtualization_type}-#{os}-#{os_version}-go_agent.tgz"
  else
    "bosh-stemcell-#{version}-#{cloud}-#{virtualization_type}-#{os}-go_agent.tgz"
  end
end

#uploadObject



14
15
16
# File 'lib/bosh-deployer/stemcell.rb', line 14

def upload
  system("bosh upload stemcell #{default_path}/#{tar_filename}")
end