bosh_cli 1.3165.0 → 1.3167.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cli/client/director.rb +0 -16
- data/lib/cli/version.rb +1 -1
- metadata +8 -9
- data/lib/cli/commands/job_rename.rb +0 -103
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ebbbe6c1b4b836a543942a1b2d21ae088a9833e2
|
4
|
+
data.tar.gz: 673bd51691a1fb1ca79c181801738018024062b4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e6d8210ad6f7409ee328b487148c9bd77f13cdb989b35f63dac4f20fbc501c1a89c3178a8634dbf9e03ba55a2049d1ad6e06f5f811806b44e9d1c4c8f2b3adf2
|
7
|
+
data.tar.gz: 14ffdc29f6e92c07ddc46fcf447316c1a49132c77119b57730261cae356f07280efa11994b8fbbfe2536fa152c0863670d639403599c8ec9485419ff06e0a3a4
|
data/lib/cli/client/director.rb
CHANGED
@@ -339,22 +339,6 @@ module Bosh
|
|
339
339
|
put(url, 'application/json', payload)
|
340
340
|
end
|
341
341
|
|
342
|
-
def rename_job(deployment_name, manifest_yaml, old_name, new_name,
|
343
|
-
force = false, options = {})
|
344
|
-
options = options.dup
|
345
|
-
|
346
|
-
url = "/deployments/#{deployment_name}/jobs/#{old_name}"
|
347
|
-
|
348
|
-
extras = []
|
349
|
-
extras << ['new_name', new_name]
|
350
|
-
extras << ['force', 'true'] if force
|
351
|
-
|
352
|
-
options[:content_type] = 'text/yaml'
|
353
|
-
options[:payload] = manifest_yaml
|
354
|
-
|
355
|
-
request_and_track(:put, add_query_string(url, extras), options)
|
356
|
-
end
|
357
|
-
|
358
342
|
def fetch_logs(deployment_name, job_name, index, log_type,
|
359
343
|
filters = nil, options = {})
|
360
344
|
options = options.dup
|
data/lib/cli/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bosh_cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3167.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- VMware
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-12-
|
11
|
+
date: 2015-12-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bosh_common
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.
|
19
|
+
version: 1.3167.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 1.
|
26
|
+
version: 1.3167.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bosh-template
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 1.
|
33
|
+
version: 1.3167.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 1.
|
40
|
+
version: 1.3167.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: cf-uaa-lib
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -128,14 +128,14 @@ dependencies:
|
|
128
128
|
requirements:
|
129
129
|
- - "~>"
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version: 1.
|
131
|
+
version: 1.3167.0
|
132
132
|
type: :runtime
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
136
|
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version: 1.
|
138
|
+
version: 1.3167.0
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: net-ssh
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -365,7 +365,6 @@ files:
|
|
365
365
|
- lib/cli/commands/instances.rb
|
366
366
|
- lib/cli/commands/job.rb
|
367
367
|
- lib/cli/commands/job_management.rb
|
368
|
-
- lib/cli/commands/job_rename.rb
|
369
368
|
- lib/cli/commands/locks.rb
|
370
369
|
- lib/cli/commands/log_management.rb
|
371
370
|
- lib/cli/commands/login.rb
|
@@ -1,103 +0,0 @@
|
|
1
|
-
module Bosh::Cli::Command
|
2
|
-
class JobRename < Base
|
3
|
-
# bosh rename
|
4
|
-
usage "rename job"
|
5
|
-
desc "Renames a job. NOTE, your deployment manifest must also be " +
|
6
|
-
"updated to reflect the new job name."
|
7
|
-
option "--force", "Ignore errors"
|
8
|
-
def rename(old_name, new_name)
|
9
|
-
auth_required
|
10
|
-
manifest = prepare_deployment_manifest(show_state: true)
|
11
|
-
|
12
|
-
force = options[:force]
|
13
|
-
say("You are about to rename `#{old_name.make_green}' to `#{new_name.make_green}'")
|
14
|
-
|
15
|
-
unless confirmed?
|
16
|
-
nl
|
17
|
-
say("Job rename canceled".make_green)
|
18
|
-
exit(0)
|
19
|
-
end
|
20
|
-
|
21
|
-
sanity_check_job_rename(manifest, old_name, new_name)
|
22
|
-
|
23
|
-
status, task_id = director.rename_job(
|
24
|
-
manifest.name, manifest.yaml, old_name, new_name, force)
|
25
|
-
|
26
|
-
task_report(status, task_id, "Rename successful")
|
27
|
-
end
|
28
|
-
|
29
|
-
def sanity_check_job_rename(manifest, old_name, new_name)
|
30
|
-
# Makes sure the new deployment manifest contains the renamed job
|
31
|
-
new_jobs = manifest.hash["jobs"].map { |job| job["name"] }
|
32
|
-
unless new_jobs.include?(new_name)
|
33
|
-
err("Please update your deployment manifest to include the " +
|
34
|
-
"new job name `#{new_name}'")
|
35
|
-
end
|
36
|
-
|
37
|
-
if new_jobs.include?(old_name)
|
38
|
-
err("Old name `#{old_name}' is still being used in the " +
|
39
|
-
"deployment file")
|
40
|
-
end
|
41
|
-
|
42
|
-
# Make sure that the old deployment manifest contains the old job
|
43
|
-
current_deployment = director.get_deployment(manifest.name)
|
44
|
-
if current_deployment["manifest"].nil?
|
45
|
-
err("Director could not find manifest for deployment " +
|
46
|
-
"`#{manifest["name"]}'")
|
47
|
-
end
|
48
|
-
|
49
|
-
current_manifest = Psych.load(current_deployment["manifest"])
|
50
|
-
jobs = current_manifest["jobs"].map { |job| job["name"] }
|
51
|
-
unless jobs.include?(old_name)
|
52
|
-
err("Trying to rename a non existent job `#{old_name}'")
|
53
|
-
end
|
54
|
-
|
55
|
-
# Technically we could allow this
|
56
|
-
if jobs.include?(new_name)
|
57
|
-
err("Trying to reuse an existing job name `#{new_name}' " +
|
58
|
-
"to rename job `#{old_name}'")
|
59
|
-
end
|
60
|
-
|
61
|
-
# Make sure that only one job has been renamed
|
62
|
-
added_jobs = new_jobs - jobs
|
63
|
-
|
64
|
-
if added_jobs.size > 1
|
65
|
-
err("Cannot rename more than one job, you are trying to " +
|
66
|
-
"add #{added_jobs.inspect}")
|
67
|
-
end
|
68
|
-
|
69
|
-
if added_jobs.first != new_name
|
70
|
-
err("Manifest does not include new job `#{new_name}'")
|
71
|
-
end
|
72
|
-
|
73
|
-
renamed_jobs = jobs - new_jobs
|
74
|
-
|
75
|
-
if renamed_jobs.size > 1
|
76
|
-
err("Cannot rename more than one job, you have changes to " +
|
77
|
-
"#{renamed_jobs}")
|
78
|
-
end
|
79
|
-
|
80
|
-
if renamed_jobs.first != old_name
|
81
|
-
err("Manifest does not rename old job `#{old_name}'")
|
82
|
-
end
|
83
|
-
|
84
|
-
# Final sanity check, make sure that no
|
85
|
-
# other properties or anything other than the names
|
86
|
-
# have changed. So update current manifest with new name
|
87
|
-
# and check that it matches with the old manifest
|
88
|
-
current_manifest["jobs"].each do |job|
|
89
|
-
if job["name"] == old_name
|
90
|
-
job["name"] = new_name
|
91
|
-
break
|
92
|
-
end
|
93
|
-
end
|
94
|
-
|
95
|
-
# Now the manifests should be the same
|
96
|
-
if deployment_changed?(current_manifest.dup, manifest.hash.dup)
|
97
|
-
err("You cannot have any other changes to your manifest during " +
|
98
|
-
"rename. Please revert the above changes and retry.")
|
99
|
-
end
|
100
|
-
end
|
101
|
-
|
102
|
-
end
|
103
|
-
end
|