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
Fix to the delete-domain to fail early if domain is shared #596
Fix to the delete-domain to fail early if domain is shared #596
Conversation
Hey SrinivasChilveri! Thanks for submitting this pull request! I'm here to inform the recipients of the pull request that you've already signed the CLA. |
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/103895494. |
3243e39
to
f770bbf
Compare
Hi @camelpunch , I have fixed all your comments. Thanks & Regards, |
@@ -63,6 +63,28 @@ var _ = Describe("delete-domain command", func() { | |||
}) | |||
}) | |||
|
|||
Context("Checks whether the domain is owned or shared", func() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The BeforeEach() sets the domain to 'Shared: true', so this context should be something like, "when the domain is shared".
f770bbf
to
21088c2
Compare
Hi @camelpunch , I have fixed all your comments. Thanks & Regards, |
@goehmen how does the language sit with you? Do both "X is not an owned domain" and "X is not a shared domain" make sense in context? |
Yes they do. Greg Oehmen On Wed, Sep 23, 2015 at 7:44 AM, Andrew Bruce notifications@github.com
|
@simonleung8 @goehmen @squeedee I'd expect this change to result in a nonzero exit code, but:
Should this really be a 1 exit? |
Looks like the default is a fail, so exit 1 seems appropriate @SrinivasChilveri can you please make it a |
Hi @camelpunch @simonleung8 , I think you mean to change the below lines case *errors.ModelNotFoundError: both in delete-domain & delete-shared domain commands? am i correct? Thanks & Regards, |
Sorry I didn't make it clear. I meant changing the modified lines from case nil:
if domain.Shared {
cmd.ui.Say(T("domain {{.DomainName}} is not an owned domain",
map[string]interface{}{
"DomainName": domainName}))
return
} |
21088c2
to
0b6ae81
Compare
Hi @camelpunch @simonleung8, Thanks & Regards, |
@SrinivasChilveri sorry for the back-forth, but we could really do with test coverage for that last change. For example, a test fails when I change the |
delete-domain command is not failing early if given name is a shared domain and delete-shared-domain is not failing early if given name is owned domain. Modified the delete-domain and delete-shared-domain commands to check the domain type and fail early based on domain type. $ cf domains Getting domains in org abc as admin... name status 10.244.0.34.xip.io shared abc.shared.com shared abc.private.domain owned Before Fix : delete-domain abc.shared.com -f Deleting domain abc.shared.com as admin... FAILED Error deleting domain abc.shared.com Server error, status code: 404, error code: 130002, message: The domain could not be found: c42e00e4-0c72-4ba4-ba1c-cb4b59ff1bc0 $ cf delete-shared-domain abc.private.domain -f Deleting domain abc.private.domain as admin... FAILED Error deleting domain abc.private.domain Server error, status code: 404, error code: 130002, message: The domain could not be found: 51a6d739-5134-4dfd-8ed0-6e1d38c5a2e0 After Fix : $ ./out/cf delete-domain abc.shared.com domain abc.shared.com is not an owned domain $ ./out/cf delete-shared-domain abc.private.domain Deleting domain abc.private.domain as admin... domain abc.private.domain is not a shared domain [#68736518]
0b6ae81
to
98e4439
Compare
HI @camelpunch ,Thanks a lot for your review. changes are done. Thanks&Regards, |
Fix to the delete-domain to fail early if domain is shared [finishes #103895494]
delete-domain command is not failing early if given name is a shared
domain and delete-shared-domain is not failing early if given name is
owned domain.
Modified the delete-domain and delete-shared-domain commands to check
the domain type and fail early based on domain type.
$ cf domains
Getting domains in org abc as admin...
name status
10.244.0.34.xip.io shared
abc.shared.com shared
abc.private.domain owned
Before Fix :
delete-domain abc.shared.com -f
Deleting domain abc.shared.com as admin...
FAILED
Error deleting domain abc.shared.com
Server error, status code: 404, error code: 130002, message: The domain could not be found: c42e00e4-0c72-4ba4-ba1c-cb4b59ff1bc0
$ cf delete-shared-domain abc.private.domain -f
Deleting domain abc.private.domain as admin...
FAILED
Error deleting domain abc.private.domain
Server error, status code: 404, error code: 130002, message: The domain could not be found: 51a6d739-5134-4dfd-8ed0-6e1d38c5a2e0
After Fix :
$ ./out/cf delete-domain abc.shared.com
domain abc.shared.com is not an owned domain
$ ./out/cf delete-shared-domain abc.private.domain
Deleting domain abc.private.domain as admin...
domain abc.private.domain is not a shared domain
[#68736518]