bosh_cli 1.3215.4.0 → 1.3232.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (54) hide show
  1. checksums.yaml +4 -4
  2. data/lib/cli.rb +1 -0
  3. data/lib/cli/base_command.rb +1 -1
  4. data/lib/cli/basic_login_strategy.rb +3 -3
  5. data/lib/cli/blob_manager.rb +14 -14
  6. data/lib/cli/client/director.rb +16 -5
  7. data/lib/cli/commands/backup.rb +2 -2
  8. data/lib/cli/commands/cloudcheck.rb +2 -2
  9. data/lib/cli/commands/deployment.rb +22 -22
  10. data/lib/cli/commands/deployment_diff.rb +7 -3
  11. data/lib/cli/commands/disks.rb +1 -1
  12. data/lib/cli/commands/errand.rb +2 -2
  13. data/lib/cli/commands/events.rb +55 -0
  14. data/lib/cli/commands/help.rb +1 -1
  15. data/lib/cli/commands/job.rb +3 -3
  16. data/lib/cli/commands/job_management.rb +1 -1
  17. data/lib/cli/commands/locks.rb +6 -4
  18. data/lib/cli/commands/login.rb +1 -1
  19. data/lib/cli/commands/misc.rb +4 -4
  20. data/lib/cli/commands/package.rb +3 -3
  21. data/lib/cli/commands/property_management.rb +8 -8
  22. data/lib/cli/commands/release/delete_release.rb +3 -3
  23. data/lib/cli/commands/release/export_release.rb +2 -2
  24. data/lib/cli/commands/release/finalize_release.rb +26 -12
  25. data/lib/cli/commands/release/upload_release.rb +2 -2
  26. data/lib/cli/commands/release/verify_release.rb +2 -2
  27. data/lib/cli/commands/restore.rb +3 -3
  28. data/lib/cli/commands/snapshot.rb +5 -5
  29. data/lib/cli/commands/ssh.rb +2 -2
  30. data/lib/cli/commands/stemcell.rb +8 -8
  31. data/lib/cli/commands/task.rb +4 -4
  32. data/lib/cli/commands/user.rb +3 -3
  33. data/lib/cli/commands/vms.rb +1 -1
  34. data/lib/cli/config.rb +1 -1
  35. data/lib/cli/core_ext.rb +4 -4
  36. data/lib/cli/deployment_manifest_compiler.rb +1 -1
  37. data/lib/cli/file_with_progress_bar.rb +2 -0
  38. data/lib/cli/job_property_collection.rb +2 -2
  39. data/lib/cli/job_state.rb +2 -2
  40. data/lib/cli/logs_downloader.rb +1 -1
  41. data/lib/cli/manifest.rb +3 -3
  42. data/lib/cli/public_stemcell_presenter.rb +3 -3
  43. data/lib/cli/release.rb +3 -3
  44. data/lib/cli/release_compiler.rb +2 -2
  45. data/lib/cli/release_tarball.rb +2 -1
  46. data/lib/cli/runner.rb +1 -1
  47. data/lib/cli/sorted_release_archiver.rb +1 -12
  48. data/lib/cli/uaa_login_strategy.rb +1 -1
  49. data/lib/cli/version.rb +1 -1
  50. data/lib/cli/versions/local_artifact_storage.rb +2 -2
  51. data/lib/cli/versions/releases_dir_migrator.rb +3 -3
  52. data/lib/cli/versions/version_file_resolver.rb +1 -1
  53. data/lib/cli/versions/versions_index.rb +10 -11
  54. metadata +9 -8
@@ -31,7 +31,7 @@ module Bosh::Cli
31
31
  if command.empty?
32
32
  setup_interactive_shell(manifest.name, job, id)
33
33
  else
34
- say("Executing `#{command.join(' ')}' on #{job}/#{id}")
34
+ say("Executing '#{command.join(' ')}' on #{job}/#{id}")
35
35
  perform_operation(:exec, manifest.name, job, id, command)
36
36
  end
37
37
  end
@@ -107,7 +107,7 @@ module Bosh::Cli
107
107
  # @param [optional,String] password
108
108
  def setup_ssh(deployment_name, job, id, password)
109
109
 
110
- say("Target deployment is `#{deployment_name}'")
110
+ say("Target deployment is '#{deployment_name}'")
111
111
  nl
112
112
  say('Setting up ssh artifacts')
113
113
 
@@ -16,13 +16,13 @@ module Bosh::Cli
16
16
  nl
17
17
 
18
18
  if stemcell.valid?
19
- say("`#{tarball_path}' is a valid stemcell".make_green)
19
+ say("'#{tarball_path}' is a valid stemcell".make_green)
20
20
  else
21
21
  say('Validation errors:'.make_red)
22
22
  stemcell.errors.each do |error|
23
23
  say('- %s' % [error])
24
24
  end
25
- err("`#{tarball_path}' is not a valid stemcell")
25
+ err("'#{tarball_path}' is not a valid stemcell")
26
26
  end
27
27
  end
28
28
 
@@ -72,10 +72,10 @@ If --name & --version are provided, they will be used for checking if stemcell e
72
72
 
73
73
  if !options[:fix] && exists?(name, version)
74
74
  if options[:skip_if_exists]
75
- say("Stemcell `#{name}/#{version}' already exists. Skipping upload.")
75
+ say("Stemcell '#{name}/#{version}' already exists. Skipping upload.")
76
76
  return
77
77
  else
78
- err("Stemcell `#{name}/#{version}' already exists. Increment the version if it has changed.")
78
+ err("Stemcell '#{name}/#{version}' already exists. Increment the version if it has changed.")
79
79
  end
80
80
  end
81
81
 
@@ -86,7 +86,7 @@ If --name & --version are provided, they will be used for checking if stemcell e
86
86
  nl
87
87
  else
88
88
  nl
89
- say("Using remote stemcell `#{stemcell_location}'")
89
+ say("Using remote stemcell '#{stemcell_location}'")
90
90
  end
91
91
 
92
92
  selected_options = {}
@@ -161,9 +161,9 @@ If --name & --version are provided, they will be used for checking if stemcell e
161
161
 
162
162
  force = !!options[:force]
163
163
 
164
- err("Stemcell `#{name}/#{version}' does not exist") unless exists?(name, version)
164
+ err("Stemcell '#{name}/#{version}' does not exist") unless exists?(name, version)
165
165
 
166
- say("You are going to delete stemcell `#{name}/#{version}'".make_red)
166
+ say("You are going to delete stemcell '#{name}/#{version}'".make_red)
167
167
 
168
168
  unless confirmed?
169
169
  say('Canceled deleting stemcell'.make_green)
@@ -172,7 +172,7 @@ If --name & --version are provided, they will be used for checking if stemcell e
172
172
 
173
173
  status, task_id = director.delete_stemcell(name, version, :force => force)
174
174
 
175
- task_report(status, task_id, "Deleted stemcell `#{name}/#{version}'")
175
+ task_report(status, task_id, "Deleted stemcell '#{name}/#{version}'")
176
176
  end
177
177
 
178
178
  private
@@ -119,16 +119,16 @@ module Bosh::Cli::Command
119
119
  def show_tasks_table(tasks)
120
120
  return if tasks.empty?
121
121
  tasks_table = table do |t|
122
- t.headings = "#", "State", "Timestamp", "User", "Deployment", "Description", "Result"
122
+ t.headings = "#", "State", "Started", "Last Activity", "User", "Deployment", "Description", "Result"
123
123
  tasks.map do |task|
124
- t << [task["id"], task["state"], Time.at(task["timestamp"]).utc, task["user"], task["deployment"],
124
+ t << [task["id"], task["state"], task["started_at"] ? Time.at(task["started_at"]).utc : '-', Time.at(task["timestamp"]).utc, task["user"], task["deployment"],
125
125
  task["description"].to_s, task["result"].to_s.truncate(80)]
126
126
  end
127
127
  end
128
128
 
129
- say("\n")
129
+ nl
130
130
  say(tasks_table)
131
- say("\n")
131
+ nl
132
132
  end
133
133
 
134
134
  # Returns the verbose level for the given no_filter flag
@@ -25,7 +25,7 @@ module Bosh::Cli::Command
25
25
  end
26
26
 
27
27
  if director.create_user(username, password)
28
- say("User `#{username}' has been created".make_green)
28
+ say("User '#{username}' has been created".make_green)
29
29
  else
30
30
  err("Error creating user")
31
31
  end
@@ -45,9 +45,9 @@ module Bosh::Cli::Command
45
45
  err("Please provide a username to delete")
46
46
  end
47
47
 
48
- if confirmed?("Are you sure you would like to delete the user `#{username}'?")
48
+ if confirmed?("Are you sure you would like to delete the user '#{username}'?")
49
49
  if director.delete_user(username)
50
- say("User `#{username}' has been deleted".make_green)
50
+ say("User '#{username}' has been deleted".make_green)
51
51
  else
52
52
  err("Unable to delete user")
53
53
  end
@@ -16,7 +16,7 @@ module Bosh::Cli::Command
16
16
  deps = director.list_deployments
17
17
  err('No deployments') if deps.empty?
18
18
  deps.each do |dep|
19
- say("Deployment `#{dep['name'].make_green}'")
19
+ say("Deployment '#{dep['name'].make_green}'")
20
20
  show_deployment(dep['name'], options)
21
21
  end
22
22
  else
data/lib/cli/config.rb CHANGED
@@ -34,7 +34,7 @@ module Bosh::Cli
34
34
  # @return [void]
35
35
  def self.register_command(command)
36
36
  if @commands.has_key?(command.usage)
37
- raise CliError, "Duplicate command `#{command.usage}'"
37
+ raise CliError, "Duplicate command '#{command.usage}'"
38
38
  end
39
39
  @commands[command.usage] = command
40
40
  end
data/lib/cli/core_ext.rb CHANGED
@@ -74,25 +74,25 @@ module BoshExtensions
74
74
 
75
75
  yaml = Psych::load(yaml_str)
76
76
  if expected_type && !yaml.is_a?(expected_type)
77
- err("Incorrect YAML structure in `#{path}': expected #{expected_type} at the root".make_red)
77
+ err("Incorrect YAML structure in '#{path}': expected #{expected_type} at the root".make_red)
78
78
  end
79
79
 
80
80
  yaml
81
81
  end
82
82
 
83
83
  def read_yaml_file(path)
84
- err("Cannot find file `#{path}'".make_red) unless File.exist?(path)
84
+ err("Cannot find file '#{path}'".make_red) unless File.exist?(path)
85
85
 
86
86
  begin
87
87
  yaml_str = ERB.new(File.read(path)).result
88
88
  rescue SystemCallError => e
89
- err("Cannot load YAML file at `#{path}': #{e}".make_red)
89
+ err("Cannot load YAML file at '#{path}': #{e}".make_red)
90
90
  end
91
91
 
92
92
  begin
93
93
  Bosh::Cli::YamlHelper.check_duplicate_keys(yaml_str)
94
94
  rescue Exception => e # on ruby 1.9.3 Psych::SyntaxError isn't a StandardError
95
- err("Incorrect YAML structure in `#{path}': #{e}".make_red)
95
+ err("Incorrect YAML structure in '#{path}': #{e}".make_red)
96
96
  end
97
97
  yaml_str
98
98
  end
@@ -11,7 +11,7 @@ module Bosh::Cli
11
11
 
12
12
  def property(name)
13
13
  @properties[name] || raise(UndefinedProperty,
14
- "Cannot resolve deployment property `#{name}'")
14
+ "Cannot resolve deployment property '#{name}'")
15
15
  end
16
16
 
17
17
  def result
@@ -32,6 +32,7 @@ module Bosh
32
32
  if result && result.size > 0
33
33
  progress_bar.inc(result.size)
34
34
  else
35
+ progress_bar.set(size)
35
36
  progress_bar.finish
36
37
  end
37
38
 
@@ -43,6 +44,7 @@ module Bosh
43
44
  if count
44
45
  progress_bar.inc(count)
45
46
  else
47
+ progress_bar.set(size)
46
48
  progress_bar.finish
47
49
  end
48
50
  count
@@ -42,8 +42,8 @@ module Bosh::Cli
42
42
 
43
43
  if resolved.nil?
44
44
  raise InvalidPropertyMapping,
45
- "Cannot satisfy property mapping `#{to}: #{from}', " +
46
- "as `#{from}' is not in deployment properties"
45
+ "Cannot satisfy property mapping '#{to}: #{from}', " +
46
+ "as '#{from}' is not in deployment properties"
47
47
  end
48
48
 
49
49
  @job_properties[to] = resolved
data/lib/cli/job_state.rb CHANGED
@@ -52,7 +52,7 @@ module Bosh::Cli
52
52
  end
53
53
 
54
54
  @command.nl
55
- @command.say("Performing `#{operation_desc}'...")
55
+ @command.say("Performing '#{operation_desc}'...")
56
56
  @command.director.change_job_state(@manifest.name, @manifest.yaml, job, index_or_id, new_state, @options)
57
57
  end
58
58
 
@@ -61,7 +61,7 @@ module Bosh::Cli
61
61
  other_changes_present = @command.inspect_deployment_changes(@manifest, show_empty_changeset: false)
62
62
 
63
63
  if other_changes_present && !force
64
- @command.err("Cannot perform job management when other deployment changes are present. Please use `--force' to override.")
64
+ @command.err("Cannot perform job management when other deployment changes are present. Please use '--force' to override.")
65
65
  end
66
66
  end
67
67
 
@@ -19,7 +19,7 @@ module Bosh::Cli
19
19
 
20
20
  FileUtils.mv(tmp_file, logs_destination_path)
21
21
 
22
- @ui.say("Logs saved in `#{logs_destination_path.make_green}'")
22
+ @ui.say("Logs saved in '#{logs_destination_path.make_green}'")
23
23
  @ui.nl
24
24
 
25
25
  rescue Bosh::Cli::DirectorError => e
data/lib/cli/manifest.rb CHANGED
@@ -13,7 +13,7 @@ module Bosh::Cli
13
13
 
14
14
  def load
15
15
  unless File.exists?(@deployment_file)
16
- err("Cannot find deployment manifest in `#{@deployment_file}'")
16
+ err("Cannot find deployment manifest in '#{@deployment_file}'")
17
17
  end
18
18
 
19
19
  @hash = load_yaml_file(@deployment_file)
@@ -49,7 +49,7 @@ module Bosh::Cli
49
49
  end
50
50
 
51
51
  if name.blank? || @hash['director_uuid'].blank?
52
- err("Invalid manifest `#{File.basename(@deployment_file)}': " +
52
+ err("Invalid manifest '#{File.basename(@deployment_file)}': " +
53
53
  'name and director UUID are required')
54
54
  end
55
55
 
@@ -84,7 +84,7 @@ module Bosh::Cli
84
84
  if stemcell['version'] == 'latest'
85
85
  latest_version = latest_stemcells[stemcell['name']]
86
86
  if latest_version.nil?
87
- err("Latest version for stemcell `#{stemcell['name']}' is unknown")
87
+ err("Latest version for stemcell '#{stemcell['name']}' is unknown")
88
88
  end
89
89
  stemcell['version'] = latest_version
90
90
  end
@@ -18,7 +18,7 @@ module Bosh::Cli
18
18
  end
19
19
 
20
20
  @ui.say(stemcells_table.render)
21
- @ui.say("To download use `bosh download public stemcell <stemcell_name>'. For full url use --full.")
21
+ @ui.say('To download use `bosh download public stemcell <stemcell_name>`. For full url use --full.')
22
22
  end
23
23
 
24
24
  def download(stemcell_name)
@@ -26,8 +26,8 @@ module Bosh::Cli
26
26
  @ui.err("'#{stemcell_name}' not found.")
27
27
  end
28
28
 
29
- if File.exists?(stemcell_name) && !@ui.confirmed?("Overwrite existing file `#{stemcell_name}'?")
30
- @ui.err("File `#{stemcell_name}' already exists")
29
+ if File.exists?(stemcell_name) && !@ui.confirmed?("Overwrite existing file '#{stemcell_name}'?")
30
+ @ui.err("File '#{stemcell_name}' already exists")
31
31
  end
32
32
 
33
33
  stemcell = @public_stemcells.find(stemcell_name)
data/lib/cli/release.rb CHANGED
@@ -18,11 +18,11 @@ module Bosh::Cli
18
18
  @private_config_file = File.join(config_dir, "private.yml")
19
19
 
20
20
  unless File.directory?(dir)
21
- err("Cannot find release directory `#{dir}'")
21
+ err("Cannot find release directory '#{dir}'")
22
22
  end
23
23
 
24
24
  unless File.directory?(config_dir)
25
- err("Cannot find release config directory `#{config_dir}'")
25
+ err("Cannot find release config directory '#{config_dir}'")
26
26
  end
27
27
 
28
28
  @final_config = load_config(@final_config_file)
@@ -159,7 +159,7 @@ module Bosh::Cli
159
159
  # to migrate while the old one tells you to upgrade.
160
160
  if @dev_config.has_key?("blobstore_options") &&
161
161
  @dev_config["blobstore_options"] != "deprecated"
162
- say("Found legacy dev config file `#{@dev_config_file}'".make_yellow)
162
+ say("Found legacy dev config file '#{@dev_config_file}'".make_yellow)
163
163
 
164
164
  new_dev_config = {
165
165
  "dev_name" => @dev_config["name"],
@@ -47,7 +47,7 @@ module Bosh::Cli
47
47
 
48
48
  def compile
49
49
  if exists?
50
- quit("You already have this version in `#{tarball_path.make_green}'")
50
+ quit("You already have this version in '#{tarball_path.make_green}'")
51
51
  end
52
52
 
53
53
  packages = @packages
@@ -114,7 +114,7 @@ module Bosh::Cli
114
114
 
115
115
  if found_build.nil?
116
116
  say("MISSING".make_red)
117
- err("Cannot find #{build_type} with checksum `#{build.sha1}'")
117
+ err("Cannot find #{build_type} with checksum '#{build.sha1}'")
118
118
  end
119
119
 
120
120
  sha1 = found_build["sha1"]
@@ -35,6 +35,7 @@ module Bosh::Cli
35
35
  end
36
36
 
37
37
  def unpack_license
38
+ return false if manifest_yaml['license'].nil?
38
39
  return @unpacked_license unless @unpacked_license.nil?
39
40
  exit_success = safe_fast_unpack('./license.tgz')
40
41
  @unpacked_license = !!exit_success
@@ -179,7 +180,7 @@ module Bosh::Cli
179
180
 
180
181
  def upload_packages?(package_matches = [])
181
182
  return true if package_matches.nil?
182
- package_matches.size != manifest_yaml[@packages_folder].size
183
+ package_matches.uniq.size != manifest_yaml[@packages_folder].map { |p| p['version'] }.uniq.size
183
184
  end
184
185
 
185
186
  # Repacks tarball according to the structure of remote release
data/lib/cli/runner.rb CHANGED
@@ -204,7 +204,7 @@ module Bosh::Cli
204
204
  }.flatten.uniq
205
205
  rescue
206
206
  err('Cannot load plugins, '.make_yellow +
207
- "please run `gem update --system' to ".make_yellow +
207
+ "please run `gem update --system` to ".make_yellow +
208
208
  'update your RubyGems'.make_yellow)
209
209
  end
210
210
 
@@ -6,23 +6,12 @@ module Bosh::Cli
6
6
 
7
7
  def archive(destination_file)
8
8
  Dir.chdir(@dir) do
9
+ ordered_release_files = Bosh::Common::Release::ReleaseDirectory.new('.').ordered_release_files
9
10
  success = Kernel.system('tar', '-C', @dir, '-pczf', destination_file, *ordered_release_files, out: '/dev/null', err: '/dev/null')
10
11
  if !success
11
12
  raise InvalidRelease, 'Cannot create release tarball'
12
13
  end
13
14
  end
14
15
  end
15
-
16
- private
17
-
18
- def ordered_release_files
19
- ordered_release_files = ['./release.MF']
20
- license_files = (Dir.entries('.') & ['LICENSE', 'NOTICE']).sort
21
- unless license_files.empty?
22
- ordered_release_files += license_files.map { |filename| "./#{filename}" }
23
- end
24
- ordered_release_files += ['./jobs', './packages']
25
- ordered_release_files
26
- end
27
16
  end
28
17
  end
@@ -22,7 +22,7 @@ module Bosh
22
22
  end
23
23
 
24
24
  if access_info = @uaa_client.access_info(credentials)
25
- @terminal.say_green("Logged in as `#{access_info.username}'")
25
+ @terminal.say_green("Logged in as '#{access_info.username}'")
26
26
  else
27
27
  err('Failed to log in')
28
28
  end
data/lib/cli/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Bosh
2
2
  module Cli
3
- VERSION = '1.3215.4.0'
3
+ VERSION = '1.3232.0'
4
4
  end
5
5
  end
@@ -12,7 +12,7 @@ module Bosh::Cli::Versions
12
12
  def put_file(sha, origin_file_path)
13
13
  destination = file_path(sha)
14
14
  unless File.exist?(origin_file_path)
15
- raise "Trying to store non-existant file `#{origin_file_path}' with sha `#{sha}'"
15
+ raise "Trying to store non-existant file '#{origin_file_path}' with sha '#{sha}'"
16
16
  end
17
17
  FileUtils.mkdir_p(File.dirname(destination))
18
18
  FileUtils.cp(origin_file_path, destination, :preserve => true)
@@ -23,7 +23,7 @@ module Bosh::Cli::Versions
23
23
  def get_file(sha)
24
24
  destination = file_path(sha)
25
25
  unless File.exist?(destination)
26
- raise "Trying to retrieve non-existant file `#{destination}' with sha `#{sha}'"
26
+ raise "Trying to retrieve non-existant file '#{destination}' with sha '#{sha}'"
27
27
  end
28
28
 
29
29
  File.expand_path(destination)
@@ -20,8 +20,8 @@ module Bosh::Cli::Versions
20
20
  begin
21
21
  SemiSemantic::Version.parse(format_version_string) < VersionsIndex::CURRENT_INDEX_VERSION
22
22
  rescue ArgumentError, SemiSemantic::ParseError
23
- raise InvalidIndex, "Invalid versions index version in `#{index_path}', " +
24
- "`#{format_version_string}' given, SemiSemantic version expected"
23
+ raise InvalidIndex, "Invalid versions index version in '#{index_path}', " +
24
+ "'#{format_version_string}' given, SemiSemantic version expected"
25
25
  end
26
26
  end
27
27
 
@@ -29,7 +29,7 @@ module Bosh::Cli::Versions
29
29
  return false unless needs_migration?
30
30
 
31
31
  unless Dir.exist?(@releases_path)
32
- raise "Releases path `#{@releases_path}' does not exist"
32
+ raise "Releases path '#{@releases_path}' does not exist"
33
33
  end
34
34
 
35
35
  @ui.header("Migrating #{@release_type_name} releases".make_green)
@@ -14,7 +14,7 @@ module Bosh::Cli::Versions
14
14
  if file_sha1 == sha1
15
15
  return file_path
16
16
  end
17
- say("SHA1 `#{file_sha1}' of #{desc} does not match expected SHA1 `#{sha1}'".make_red)
17
+ say("SHA1 '#{file_sha1}' of #{desc} does not match expected SHA1 '#{sha1}'".make_red)
18
18
  end
19
19
 
20
20
  if blobstore_id.nil?