Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add "create-service-key" to cloud controller, based on story #87057732 #339

Merged
merged 1 commit into from
Mar 27, 2015

Conversation

wsxiaozhang
Copy link

Add the rest API controller and DB model for "create service key", this patch includes the following part:

  1. 1 new rest controller for "create-service-key"
  2. DB migration script for adding a new table to record service keys
  3. 1 new DB model for service key
  4. Changes the v2 service broker client to support create service key

This patch is submitted to implement story #87057732 in Service Key API
More test cases will be added in other commits

Signed-off-by: Tom Xing xingzhou@cn.ibm.com

@cfdreddbot
Copy link

Hey wsxiaozhang!

Thanks for submitting this pull request!

All pull request authors must have a Contributor License Agreement (CLA) on-file with us. Please sign the appropriate CLA (individual or corporate).

When sending signed CLA please provide your github username in case of individual CLA or the list of github usernames that can make pull requests on behalf of your organization.

@cf-gitbot
Copy link

We have created an issue in Pivotal Tracker to manage this. You can view the current status of your issue at: https://www.pivotaltracker.com/story/show/90769332.

def after_initialize
super
self.guid ||= SecureRandom.uuid
puts self.guid
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this was left behind from debugging. Can we delete this?

@maximilien
Copy link
Contributor

Thanks @dsabeti for the quick comments. We will try to address them all today and resubmit.

Best,

max

@xingzhou
Copy link
Contributor

@dsabeti , thanks for the comments and we have resbumitted the PR according to your suggestions. For "orphan mitigation" and "delete keys" and "details" relevant code and test cases, we will add them in relevant stories later.

@xingzhou
Copy link
Contributor

Current PR depends on another PR in errors project: cloudfoundry-attic/errors#18, this will lead to the failure of Travis CI build.

context 'when the service instance is invalid' do
context 'because service_instance_guid is invalid' do
before do
service.save
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this before block is unnecessary because we're not saving any new data to the service. We could probably delete it.

@xingzhou
Copy link
Contributor

@dsabeti , have removed the useless lines in service_keys_controller_spec, please take a look at the latest patch

@dsabeti
Copy link
Contributor

dsabeti commented Mar 24, 2015

We've merged in the PR for vendor/errors, so you can now update this PR to include the correct submodule reference.

end

context 'because the service instance is destroyed after controller validation and before binding save' do
let(:service_instance_guid) { 'THISISWRONG' }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test is exactly the same as the test above it. Let's remove the dup. I understand that you copied this unnecessary test from ServiceBindingsController, but we're going to remove it from that test as well.

@xingzhou xingzhou force-pushed the service_key branch 2 times, most recently from 80cc598 to 27446f3 Compare March 25, 2015 02:34

many_to_one :service_instance

export_attributes :name, :service_instance_guid, :credentials, :syslog_drain_url
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

syslog_drain_url is not applicable to service_keys (it only matters for bindings with apps). Please remove all fields and logic regarding syslog_drain_url

end

describe 'Serialization' do
it { is_expected.to export_attributes :name, :service_instance_guid, :credentials, :syslog_drain_url }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No syslog_drain_url

@dsabeti
Copy link
Contributor

dsabeti commented Mar 25, 2015

Hi @xingzhou . We've made a complete pass through the code, and this should be ready to merge once you address these last few concerns. Sorry about the endless back-and-forth.

Two things to note:

  • Through reviewing your code, we noticed several issues that we will also be changing for service bindings. When looking to the service bindings code for guidance, please point out any confusing/incorrect code/tests, and feel free to change your own implementation for service keys from what we currently have. It's an interesting side-effect of copying old, crufty code that we get to re-evaluate and see all of its problems. We definitely want to continue seeing this feedback, but it will make things easier if they don't make it in to new code for Service Keys. So please, do let us know if you see anything strange in the Service Binding code so we can refactor / clean up appropriately.
  • In a few places, this commit includes code that is outside the scope of the story. Please try to include the minimum change to implement the current feature. It's easier for us to review the pull request, to keep track of corresponding tests, and keeping changing patterns up-to-date. (For an example of the last case, we're referring to the before_destroy hook vs ServiceBindingDelete class) This will help us review your PR's more quickly.

Add the rest API controller and DB model for "create service key", this patch includes the following part:

1. 1 new rest controller for "create-service-key"
2. DB migration script for adding a new table to record service keys
3. 1 new DB model for service key
4. Changes the v2 service broker client to support create service key

This patch is submitted to implement story #87057732 in Service Key API
More test cases will be added in other commits

Signed-off-by: Tom Xing <xingzhou@cn.ibm.com>
@xingzhou
Copy link
Contributor

@dsabeti, thanks for the review, it's the fast way for us to pick up the CC code by these back-and-forth review process, we will keep these in mind in the following development.

dsabeti added a commit that referenced this pull request Mar 27, 2015
Add "create-service-key" to cloud controller, based on story #87057732
@dsabeti dsabeti merged commit 45765e0 into cloudfoundry:master Mar 27, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants