Class: Bosh::Gen::Generators::DeploymentManifestGenerator

Inherits:
Thor::Group
  • Object
show all
Includes:
Common::PropertyHelper, Thor::Actions
Defined in:
lib/bosh/gen/generators/deployment_manifest_generator.rb

Instance Method Summary collapse

Instance Method Details

#check_release_path_is_releaseObject



17
18
19
20
21
22
23
24
25
26
# File 'lib/bosh/gen/generators/deployment_manifest_generator.rb', line 17

def check_release_path_is_release
  unless File.exist?(release_path)
    raise Thor::Error.new("target path '#{release_path}' doesn't exist")
  end
  FileUtils.chdir(release_path) do
    unless File.exist?("jobs") && File.exist?("packages")
      raise Thor::Error.new("target path '#{release_path}' is not a BOSH release project")
    end
  end
end

#check_valid_requested_jobsObject



28
29
30
31
32
# File 'lib/bosh/gen/generators/deployment_manifest_generator.rb', line 28

def check_valid_requested_jobs
  if jobs.empty?
    raise Thor::Error.new("No valid jobs specified from #{detect_jobs.inspect}")
  end
end

#create_deployment_manifestObject

Create a deployment manifest (initially for AWS only)



35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/bosh/gen/generators/deployment_manifest_generator.rb', line 35

def create_deployment_manifest
  cloud_properties = { 
    "instance_type" => "m1.small", 
  }
  cloud_properties["persistent_disk"] = flags[:disk] if flags[:disk]
  cloud_properties["static_ips"] = ip_addresses
  director_uuid = Bosh::Gen::Models::BoshConfig.new.target_uuid
  manifest = Bosh::Gen::Models::DeploymentManifest.new(
    name, director_uuid,
    release_properties, cloud_properties, default_properties)
  manifest.jobs = job_manifests
  create_file manifest_file_name, manifest.to_yaml, :force => flags[:force]
end

#setup_bosh_deployment_targetObject



49
50
51
# File 'lib/bosh/gen/generators/deployment_manifest_generator.rb', line 49

def setup_bosh_deployment_target
  run "bosh deployment #{manifest_file_name}"
end