Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Ignore stemcells with pre in their name

  • Loading branch information...
commit de6c638a751e78883dc42cb8df338fe3fb29e924 1 parent aac91f4
@drnic drnic authored
Showing with 7 additions and 12 deletions.
  1. +5 −10 lib/bosh/cli/commands/cf.rb
  2. +2 −2 spec/unit/cf_command_spec.rb
View
15 lib/bosh/cli/commands/cf.rb
@@ -319,12 +319,12 @@ def confirm_or_upload_stemcell
end
end
unless stemcell_version && stemcell_version.size
- system_config.stemcell_version = best_bosh_stemcell_version
+ system_config.stemcell_version = latest_bosh_stemcell_version
system_config.save
end
unless bosh_stemcell_versions.include?(stemcell_version)
say "Requested stemcell version #{stemcell_version} is not available.".yellow
- system_config.stemcell_version = best_bosh_stemcell_version
+ system_config.stemcell_version = latest_bosh_stemcell_version
system_config.save
end
say "Using stemcell #{stemcell_name} #{stemcell_version}".green
@@ -343,13 +343,6 @@ def confirm_release_name
end
end
- # An attempt to choose the best base stemcell for the current
- # BOSH. Currently it hardcodes a guess on the assumption that
- # the BOSH is from 0.8.1; rather than current edge (1.5.0.preX)
- def best_bosh_stemcell_version
- "0.7.0"
- end
-
# Largest version number BOSH stemcell ("bosh-stemcell") uploaded to BOSH
# @return [String] version number, e.g. "0.6.7"
def latest_bosh_stemcell_version
@@ -436,12 +429,14 @@ def clone_or_update_repository(name, repo_uri)
# | bosh-stemcell-0.5.2.tgz | vsphere |
# | bosh-stemcell-aws-0.6.4.tgz | aws, stable |
# | bosh-stemcell-aws-0.6.7.tgz | aws |
+ #
+ # Ignores any stemcells with "pre" in their name
def bosh_stemcell_name(stemcell_type)
tags = [bosh_provider]
tags << "stable" if stemcell_type == "stable" unless openstack?
bosh_stemcells_cmd = "bosh public stemcells --tags #{tags.join(',')}"
say "Locating bosh stemcell, running '#{bosh_stemcells_cmd}'..."
- `#{bosh_stemcells_cmd} | grep ' bosh-stemcell-' | awk '{ print $2 }' | sort -r | head -n 1`.strip
+ `#{bosh_stemcells_cmd} | grep ' bosh-stemcell-' | grep -V pre | awk '{ print $2 }' | sort -r | head -n 1`.strip
end
def download_stemcell(stemcell_name)
View
4 spec/unit/cf_command_spec.rb
@@ -43,11 +43,11 @@
@cmd.stub!(:bosh_target_uuid).and_return("DIRECTOR_UUID")
@cmd.stub!(:bosh_cpi).and_return("aws")
@cmd.should_receive(:`).
- with("bosh public stemcells --tags aws | grep ' bosh-stemcell-' | awk '{ print $2 }' | sort -r | head -n 1").
+ with("bosh public stemcells --tags aws | grep ' bosh-stemcell-' | grep -V pre | awk '{ print $2 }' | sort -r | head -n 1").
and_return("bosh-stemcell-aws-0.6.7.tgz")
# FIXME default to stable stemcells when 0.8.1 is marked stable
# @cmd.should_receive(:`).
- # with("bosh public stemcells --tags aws,stable | grep ' bosh-stemcell-' | awk '{ print $2 }' | sort -r | head -n 1").
+ # with("bosh public stemcells --tags aws,stable | grep ' bosh-stemcell-' | grep -V pre | awk '{ print $2 }' | sort -r | head -n 1").
# and_return("bosh-stemcell-aws-0.6.7.tgz")
@cmd.should_receive(:sh).
with("bosh -n --color download public stemcell bosh-stemcell-aws-0.6.7.tgz")
Please sign in to comment.
Something went wrong with that request. Please try again.