dpl-cloud_foundry 1.10.2.travis.2987.6 → 1.10.2.travis.2992.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b0c602eca2ea4af5223c31763e4b1742a53ddaabe9924fbb5147235565ed1f41
4
- data.tar.gz: 4705cce332eeee9006c26ded53f1c3081a9a98e20ab9ec6c20eb33cc38bc33c6
3
+ metadata.gz: 06f0e0c763132b4800abb6984c32f7704212e2df2a3bc18d30310a9a6e9f0d58
4
+ data.tar.gz: 7ec0d3b8a3fdef110f0466409896cb9a9765fff2638fc436d6a7b780f96d4af0
5
5
  SHA512:
6
- metadata.gz: d0295cec0a3a942de1e3b0f80de879f3451960c2f817353860561c4067c86e43ffcf964bce9611aaa96e203a099d2a9e495f1d4c375b1f9203e041d8d9566da8
7
- data.tar.gz: 122e69db0ae71ca034e52bc6db05c13400dd7e20b28af80410cf978576d0f9ecf58f9b79b0a470103369f0bd5aa4b7cde3afb24f1a51340e395cdf226f0a7f0a
6
+ metadata.gz: 29858dd0e1277cb899882cdc333b504ae8eebe05f7c01073ca2df958f579b907a0f3cdadc5b624ec24e6fb6d72b4cc9d7086e0e33dc3897288d4153f171afff5
7
+ data.tar.gz: 2ac60684353d3c565f004f9008926a4cc0f560659ac86a2f22d328407f2cef4e2287779e688bb99d22dcaee90225e9b05193d1b276bf51822db5aef1005c6f2d
@@ -9,7 +9,7 @@ module DPL
9
9
  def check_auth
10
10
  initial_go_tools_install
11
11
  context.shell "./cf api #{option(:api)} #{'--skip-ssl-validation' if options[:skip_ssl_validation]}"
12
- context.shell "./cf login -u #{option(:username)} -p #{option(:password)} -o #{option(:organization)} -s #{option(:space)}"
12
+ options[:client_id] ? check_client_auth : check_basic_auth
13
13
  end
14
14
 
15
15
  def check_app
@@ -38,6 +38,17 @@ module DPL
38
38
  def manifest
39
39
  options[:manifest].nil? ? "" : " -f #{options[:manifest]}"
40
40
  end
41
+
42
+ private
43
+
44
+ def check_basic_auth
45
+ context.shell "./cf login -u #{option(:username)} -p #{option(:password)} -o '#{option(:organization)}' -s '#{option(:space)}'"
46
+ end
47
+
48
+ def check_client_auth
49
+ context.shell "./cf auth #{option(:client_id)} #{option(:client_secret)} --client-credentials"
50
+ context.shell "./cf target -o '#{option(:organization)}' -s '#{option(:space)}'"
51
+ end
41
52
  end
42
53
  end
43
54
  end
@@ -11,12 +11,34 @@ describe DPL::Provider::CloudFoundry do
11
11
  skip_ssl_validation: true)
12
12
  end
13
13
 
14
+
14
15
  describe "#check_auth" do
15
- example do
16
- expect(provider.context).to receive(:shell).with('test x$TRAVIS_OS_NAME = "xlinux" && rel="linux64-binary" || rel="macosx64"; wget "https://cli.run.pivotal.io/stable?release=${rel}&source=github" -qO cf.tgz && tar -zxvf cf.tgz && rm cf.tgz')
17
- expect(provider.context).to receive(:shell).with('./cf api api.run.awesome.io --skip-ssl-validation')
18
- expect(provider.context).to receive(:shell).with('./cf login -u mallomar -p myreallyawesomepassword -o myorg -s outer')
19
- provider.check_auth
16
+ context 'when basic credentials are provided' do
17
+ example do
18
+ expect(provider.context).to receive(:shell).with('test x$TRAVIS_OS_NAME = "xlinux" && rel="linux64-binary" || rel="macosx64"; wget "https://cli.run.pivotal.io/stable?release=${rel}&source=github" -qO cf.tgz && tar -zxvf cf.tgz && rm cf.tgz')
19
+ expect(provider.context).to receive(:shell).with('./cf api api.run.awesome.io --skip-ssl-validation')
20
+ expect(provider.context).to receive(:shell).with('./cf login -u mallomar -p myreallyawesomepassword -o \'myorg\' -s \'outer\'')
21
+ provider.check_auth
22
+ end
23
+ end
24
+
25
+ context 'when client credentials are provided' do
26
+ subject :provider do
27
+ described_class.new(DummyContext.new, api: 'api.run.awesome.io', client_id: 'craw',
28
+ client_secret: 'myreallyawesomesecret',
29
+ organization: 'myorg',
30
+ space: 'outer',
31
+ manifest: 'worker-manifest.yml',
32
+ skip_ssl_validation: true)
33
+ end
34
+
35
+ example do
36
+ expect(provider.context).to receive(:shell).with('test x$TRAVIS_OS_NAME = "xlinux" && rel="linux64-binary" || rel="macosx64"; wget "https://cli.run.pivotal.io/stable?release=${rel}&source=github" -qO cf.tgz && tar -zxvf cf.tgz && rm cf.tgz')
37
+ expect(provider.context).to receive(:shell).with('./cf api api.run.awesome.io --skip-ssl-validation')
38
+ expect(provider.context).to receive(:shell).with('./cf auth craw myreallyawesomesecret --client-credentials')
39
+ expect(provider.context).to receive(:shell).with('./cf target -o \'myorg\' -s \'outer\'')
40
+ provider.check_auth
41
+ end
20
42
  end
21
43
  end
22
44
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dpl-cloud_foundry
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.10.2.travis.2987.6
4
+ version: 1.10.2.travis.2992.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Konstantin Haase
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 1.10.2.travis.2987.6
19
+ version: 1.10.2.travis.2992.6
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.10.2.travis.2987.6
26
+ version: 1.10.2.travis.2992.6
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rspec
29
29
  requirement: !ruby/object:Gem::Requirement