Skip to content
This repository was archived by the owner on Jun 2, 2021. It is now read-only.

Commit 3b07fc2

Browse files
authored
Merge branch 'master' into dependabot/npm_and_yarn/docs/v3/glob-7.1.6
2 parents deaad62 + 8500996 commit 3b07fc2

55 files changed

Lines changed: 1906 additions & 496 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.editorconfig

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# EditorConfig is awesome: https://EditorConfig.org
2+
3+
# top-most EditorConfig file
4+
root = true
5+
6+
[*.rb]
7+
insert_final_newline = true
8+
trim_trailing_whitespace = true

.github/workflows/unit_tests.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,18 @@ jobs:
4141
service mysql restart
4242
- name: Run tests
4343
run: DB=mysql bundle exec rake spec:all
44+
test_docs:
45+
runs-on: ubuntu-latest
46+
container:
47+
image: "cloudfoundry/capi:rc-docs"
48+
steps:
49+
- uses: actions/checkout@v2
50+
- name: Install dependencies
51+
run: |
52+
bundle install
53+
cd docs/v3
54+
bundle install
55+
cd -
56+
- name: Run docs tests
57+
run: bundle exec rake check_doc_links
4458

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ spec/examples.txt
1212
ci-artifacts-dir
1313
ci-working-dir
1414
coverage
15+
db/schema.rb
1516
doc
1617
*.rbc
1718
*.swp

Gemfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ gem 'steno'
3939
gem 'talentbox-delayed_job_sequel', '~> 4.3.0'
4040
gem 'thin'
4141
gem 'unf'
42-
gem 'vmstat', '~> 2.0'
42+
gem 'vmstat', '~> 2.3'
4343
gem 'yajl-ruby'
4444

4545
# Rails Components
@@ -49,7 +49,7 @@ gem 'activemodel', '~> 5.2.4', '>= 5.2.4.3'
4949
gem 'railties', '~> 5.2.4', '>= 5.2.4.3'
5050

5151
# Blobstore and Bits Service Dependencies
52-
gem 'azure-storage', '0.14.0.preview' # https://github.com/Azure/azure-storage-ruby/issues/122
52+
gem 'azure-storage', '0.15.0.preview' # https://github.com/Azure/azure-storage-ruby/issues/122
5353
gem 'bits_service_client', '~> 3.3', '>= 3.3.0'
5454
gem 'fog-aliyun'
5555
gem 'fog-aws'

Gemfile.lock

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,11 @@ GEM
6565
i18n
6666
ast (2.4.1)
6767
awesome_print (1.8.0)
68-
azure-core (0.1.14)
68+
azure-core (0.1.15)
6969
faraday (~> 0.9)
7070
faraday_middleware (~> 0.10)
7171
nokogiri (~> 1.6)
72-
azure-storage (0.14.0.preview)
72+
azure-storage (0.15.0.preview)
7373
azure-core (~> 0.1)
7474
faraday (~> 0.9)
7575
faraday_middleware (~> 0.10)
@@ -135,7 +135,7 @@ GEM
135135
domain_name (0.5.20180417)
136136
unf (>= 0.0.5, < 1.0.0)
137137
e2mmap (0.1.0)
138-
em-http-request (1.1.5)
138+
em-http-request (1.1.6)
139139
addressable (>= 2.3.4)
140140
cookiejar (!= 0.3.1)
141141
em-socksify (>= 0.3)
@@ -146,12 +146,12 @@ GEM
146146
erubi (1.9.0)
147147
eventmachine (1.0.9.1)
148148
excon (0.71.0)
149-
faraday (0.15.4)
149+
faraday (0.17.3)
150150
multipart-post (>= 1.2, < 3)
151151
faraday-cookie_jar (0.0.6)
152152
faraday (>= 0.7.4)
153153
http-cookie (~> 1.0.0)
154-
faraday_middleware (0.12.2)
154+
faraday_middleware (0.14.0)
155155
faraday (>= 0.7.4, < 1.0)
156156
ffi (1.9.25)
157157
ffi-compiler (1.0.1)
@@ -289,16 +289,16 @@ GEM
289289
mustache (1.1.1)
290290
mustermann (1.0.3)
291291
mysql2 (0.5.2)
292-
net-ssh (5.0.2)
292+
net-ssh (6.1.0)
293293
netaddr (2.0.4)
294294
netrc (0.11.0)
295-
newrelic_rpm (5.3.0.346)
295+
newrelic_rpm (6.11.0.365)
296296
nokogiri (1.10.9)
297297
mini_portile2 (~> 2.4.0)
298298
os (1.0.1)
299299
palm_civet (1.1.0)
300300
parallel (1.19.1)
301-
parallel_tests (2.27.1)
301+
parallel_tests (3.0.0)
302302
parallel
303303
parser (2.7.1.3)
304304
ast (~> 2.4.0)
@@ -357,7 +357,7 @@ GEM
357357
rspec-core (~> 3.8.0)
358358
rspec-expectations (~> 3.8.0)
359359
rspec-mocks (~> 3.8.0)
360-
rspec-collection_matchers (1.1.3)
360+
rspec-collection_matchers (1.2.0)
361361
rspec-expectations (>= 2.99.0.beta1)
362362
rspec-core (3.8.2)
363363
rspec-support (~> 3.8.0)
@@ -394,7 +394,7 @@ GEM
394394
rainbow (>= 2.2.2, < 4.0)
395395
ruby-progressbar (~> 1.7)
396396
unicode-display_width (>= 1.4.0, < 1.7)
397-
ruby-debug-ide (0.7.0.beta4)
397+
ruby-debug-ide (0.7.2)
398398
rake (>= 0.8.1)
399399
ruby-mysql (2.9.14)
400400
ruby-progressbar (1.10.1)
@@ -472,7 +472,7 @@ GEM
472472
unicode-display_width (1.6.1)
473473
vhd (0.0.4)
474474
bit-struct
475-
vmstat (2.3.0)
475+
vmstat (2.3.1)
476476
webmock (3.5.1)
477477
addressable (>= 2.3.6)
478478
crack (>= 0.3.2)
@@ -495,7 +495,7 @@ DEPENDENCIES
495495
addressable
496496
allowy (>= 2.1.0)
497497
awesome_print
498-
azure-storage (= 0.14.0.preview)
498+
azure-storage (= 0.15.0.preview)
499499
bits_service_client (~> 3.3, >= 3.3.0)
500500
byebug
501501
cf-copilot (= 0.0.14)
@@ -571,7 +571,7 @@ DEPENDENCIES
571571
timecop
572572
unf
573573
vcap-concurrency!
574-
vmstat (~> 2.0)
574+
vmstat (~> 2.3)
575575
webmock (> 2.3.1)
576576
yajl-ruby
577577

app/actions/space_diff_manifest.rb

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
require 'presenters/v3/app_manifest_presenter'
2+
require 'json-diff'
3+
4+
module VCAP::CloudController
5+
class SpaceDiffManifest
6+
def self.generate_diff(app_manifests, space)
7+
json_diff = []
8+
9+
app_manifests.each_with_index do |manifest_app_hash, index|
10+
existing_app = space.app_models.find { |app| app.name == manifest_app_hash['name'] }
11+
12+
if existing_app.nil?
13+
existing_app_hash = {}
14+
else
15+
manifest_presenter = Presenters::V3::AppManifestPresenter.new(
16+
existing_app,
17+
existing_app.service_bindings,
18+
existing_app.routes,
19+
)
20+
existing_app_hash = manifest_presenter.to_hash.deep_stringify_keys['applications'][0]
21+
web_process_hash = existing_app_hash['processes'].find { |p| p['type'] == 'web' }
22+
existing_app_hash = existing_app_hash.merge(web_process_hash) if web_process_hash
23+
end
24+
25+
manifest_app_hash.each do |key, value|
26+
existing_value = existing_app_hash[key]
27+
28+
key_diffs = JsonDiff.diff(
29+
existing_value,
30+
value,
31+
include_was: true,
32+
)
33+
key_diffs.each do |diff|
34+
diff['path'] = "/applications/#{index}/#{key}" + diff['path']
35+
36+
if diff['op'] == 'replace' && diff['was'].nil?
37+
diff['op'] = 'add'
38+
end
39+
40+
json_diff << diff
41+
end
42+
end
43+
end
44+
45+
json_diff
46+
end
47+
end
48+
end

app/actions/v3/service_instance_delete.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ def delete(service_instance)
1717
cannot_delete_shared_instances! if service_instance.shared?
1818

1919
lock = DeleterLock.new(service_instance)
20-
lock.lock!
2120

2221
job = case service_instance
2322
when ManagedServiceInstance
2423
asynchronous_destroy(service_instance)
2524
when UserProvidedServiceInstance
25+
lock.lock!
2626
synchronous_destroy(service_instance, lock)
2727
end
2828

app/controllers/runtime/helpers/blob_dispatcher.rb

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,17 @@ def initialize(blobstore:, controller:)
66
end
77

88
def send_or_redirect(guid:)
9-
raise CloudController::Errors::BlobNotFound unless guid
9+
unless guid
10+
logger.error('No guid for BlobNotFound')
11+
raise CloudController::Errors::BlobNotFound
12+
end
1013

1114
blob = @blobstore.blob(guid)
1215

13-
raise CloudController::Errors::BlobNotFound unless blob
16+
unless blob
17+
logger.error('No blob object for BlobNotFound')
18+
raise CloudController::Errors::BlobNotFound
19+
end
1420

1521
send_or_redirect_blob(blob)
1622
end

app/controllers/v3/droplets_controller.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,10 @@ def download
161161
private
162162

163163
def send_droplet_blob(droplet)
164+
if droplet.blobstore_key.nil?
165+
resource_not_found_with_message!('Blobstore key not present on droplet. This may be due to a failed build.')
166+
end
167+
164168
droplet_blobstore = CloudController::DependencyLocator.instance.droplet_blobstore
165169
BlobDispatcher.new(blobstore: droplet_blobstore, controller: self).send_or_redirect(guid: droplet.blobstore_key)
166170
rescue CloudController::Errors::BlobNotFound
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
require 'fetchers/service_credential_binding_fetcher'
2+
3+
class ServiceCredentialBindingsController < ApplicationController
4+
before_action :ensure_service_credential_binding_exists!
5+
before_action :ensure_user_has_access!
6+
7+
def show
8+
render status: :ok, json: serialized
9+
end
10+
11+
private
12+
13+
def serialized
14+
{
15+
guid: service_credential_binding.guid,
16+
type: service_credential_binding.type
17+
}
18+
end
19+
20+
def ensure_service_credential_binding_exists!
21+
not_found! unless service_credential_binding_exists?
22+
end
23+
24+
def ensure_user_has_access!
25+
not_found! unless allowed_to_access_space?
26+
end
27+
28+
def not_found!
29+
resource_not_found!(:service_credential_binding)
30+
end
31+
32+
def service_credential_binding
33+
@service_credential_binding ||= fetcher.fetch(hashed_params[:guid])
34+
end
35+
36+
def fetcher
37+
@fetcher ||= VCAP::CloudController::ServiceCredentialBindingFetcher.new
38+
end
39+
40+
def service_credential_binding_exists?
41+
!!service_credential_binding
42+
end
43+
44+
def allowed_to_access_space?
45+
space = service_credential_binding.space
46+
47+
permission_queryer.can_read_from_space?(space.guid, space.organization_guid)
48+
end
49+
end

0 commit comments

Comments
 (0)