-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[CLOUDSTACK-10248] Fix errors that appeared after #2283 #2417
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
178 changes: 89 additions & 89 deletions
178
...oadTemplateDirectDownloadCertificate.java → ...oadTemplateDirectDownloadCertificate.java
100755 → 100644
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,89 +1,89 @@ | ||
| // Licensed to the Apache Software Foundation (ASF) under one | ||
| // or more contributor license agreements. See the NOTICE file | ||
| // distributed with this work for additional information | ||
| // regarding copyright ownership. The ASF licenses this file | ||
| // to you under the Apache License, Version 2.0 (the | ||
| // "License"); you may not use this file except in compliance | ||
| // with the License. You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, | ||
| // software distributed under the License is distributed on an | ||
| // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| // KIND, either express or implied. See the License for the | ||
| // specific language governing permissions and limitations | ||
| // under the License. | ||
| package org.apache.cloudstack.api.command.admin.direct.download; | ||
| import com.cloud.exception.ConcurrentOperationException; | ||
| import com.cloud.exception.InsufficientCapacityException; | ||
| import com.cloud.exception.ResourceAllocationException; | ||
| import com.cloud.exception.ResourceUnavailableException; | ||
| import com.cloud.exception.NetworkRuleConflictException; | ||
| import org.apache.cloudstack.acl.RoleType; | ||
| import org.apache.cloudstack.api.APICommand; | ||
| import org.apache.cloudstack.api.ApiConstants; | ||
| import org.apache.cloudstack.api.BaseCmd; | ||
| import org.apache.cloudstack.api.Parameter; | ||
| import org.apache.cloudstack.api.ServerApiException; | ||
| import org.apache.cloudstack.api.ApiErrorCode; | ||
| import org.apache.cloudstack.api.response.SuccessResponse; | ||
| import org.apache.cloudstack.context.CallContext; | ||
| import org.apache.cloudstack.direct.download.DirectDownloadManager; | ||
| import org.apache.log4j.Logger; | ||
| import javax.inject.Inject; | ||
| @APICommand(name = UploadTemplateDirectDownloadCertificate.APINAME, | ||
| description = "Upload a certificate for HTTPS direct template download on KVM hosts", | ||
| responseObject = SuccessResponse.class, | ||
| requestHasSensitiveInfo = true, | ||
| responseHasSensitiveInfo = true, | ||
| since = "4.11.0", | ||
| authorized = {RoleType.Admin}) | ||
| public class UploadTemplateDirectDownloadCertificate extends BaseCmd { | ||
| @Inject | ||
| DirectDownloadManager directDownloadManager; | ||
| private static final Logger LOG = Logger.getLogger(UploadTemplateDirectDownloadCertificate.class); | ||
| public static final String APINAME = "uploadTemplateDirectDownloadCertificate"; | ||
| @Parameter(name = ApiConstants.CERTIFICATE, type = BaseCmd.CommandType.STRING, required = true, length = 65535, | ||
| description = "SSL certificate") | ||
| private String certificate; | ||
| @Parameter(name = ApiConstants.NAME , type = BaseCmd.CommandType.STRING, required = true, | ||
| description = "Name for the uploaded certificate") | ||
| private String name; | ||
| @Parameter(name = ApiConstants.HYPERVISOR, type = BaseCmd.CommandType.STRING, required = true, description = "Hypervisor type") | ||
| private String hypervisor; | ||
| @Override | ||
| public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException { | ||
| if (!hypervisor.equalsIgnoreCase("kvm")) { | ||
| throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Currently supporting KVM hosts only"); | ||
| } | ||
| try { | ||
| directDownloadManager.uploadCertificateToHosts(certificate, name);; | ||
| setResponseObject(new SuccessResponse(getCommandName())); | ||
| } catch (Exception e) { | ||
| throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage()); | ||
| } | ||
| } | ||
| @Override | ||
| public String getCommandName() { | ||
| return UploadTemplateDirectDownloadCertificate.APINAME; | ||
| } | ||
| @Override | ||
| public long getEntityOwnerId() { | ||
| return CallContext.current().getCallingAccount().getId(); | ||
| } | ||
| } | ||
| // Licensed to the Apache Software Foundation (ASF) under one | ||
| // or more contributor license agreements. See the NOTICE file | ||
| // distributed with this work for additional information | ||
| // regarding copyright ownership. The ASF licenses this file | ||
| // to you under the Apache License, Version 2.0 (the | ||
| // "License"); you may not use this file except in compliance | ||
| // with the License. You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, | ||
| // software distributed under the License is distributed on an | ||
| // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| // KIND, either express or implied. See the License for the | ||
| // specific language governing permissions and limitations | ||
| // under the License. | ||
| package org.apache.cloudstack.api.command.admin.direct.download; | ||
|
|
||
| import com.cloud.exception.ConcurrentOperationException; | ||
| import com.cloud.exception.InsufficientCapacityException; | ||
| import com.cloud.exception.ResourceAllocationException; | ||
| import com.cloud.exception.ResourceUnavailableException; | ||
| import com.cloud.exception.NetworkRuleConflictException; | ||
| import org.apache.cloudstack.acl.RoleType; | ||
| import org.apache.cloudstack.api.APICommand; | ||
| import org.apache.cloudstack.api.ApiConstants; | ||
| import org.apache.cloudstack.api.BaseCmd; | ||
| import org.apache.cloudstack.api.Parameter; | ||
| import org.apache.cloudstack.api.ServerApiException; | ||
| import org.apache.cloudstack.api.ApiErrorCode; | ||
| import org.apache.cloudstack.api.response.SuccessResponse; | ||
| import org.apache.cloudstack.context.CallContext; | ||
| import org.apache.cloudstack.direct.download.DirectDownloadManager; | ||
| import org.apache.log4j.Logger; | ||
|
|
||
| import javax.inject.Inject; | ||
|
|
||
| @APICommand(name = UploadTemplateDirectDownloadCertificate.APINAME, | ||
| description = "Upload a certificate for HTTPS direct template download on KVM hosts", | ||
| responseObject = SuccessResponse.class, | ||
| requestHasSensitiveInfo = true, | ||
| responseHasSensitiveInfo = true, | ||
| since = "4.11.0", | ||
| authorized = {RoleType.Admin}) | ||
| public class UploadTemplateDirectDownloadCertificate extends BaseCmd { | ||
|
|
||
| @Inject | ||
| DirectDownloadManager directDownloadManager; | ||
|
|
||
| private static final Logger LOG = Logger.getLogger(UploadTemplateDirectDownloadCertificate.class); | ||
| public static final String APINAME = "uploadTemplateDirectDownloadCertificate"; | ||
|
|
||
| @Parameter(name = ApiConstants.CERTIFICATE, type = BaseCmd.CommandType.STRING, required = true, length = 65535, | ||
| description = "SSL certificate") | ||
| private String certificate; | ||
|
|
||
| @Parameter(name = ApiConstants.NAME , type = BaseCmd.CommandType.STRING, required = true, | ||
| description = "Name for the uploaded certificate") | ||
| private String name; | ||
|
|
||
| @Parameter(name = ApiConstants.HYPERVISOR, type = BaseCmd.CommandType.STRING, required = true, description = "Hypervisor type") | ||
| private String hypervisor; | ||
|
|
||
| @Override | ||
| public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException { | ||
| if (!hypervisor.equalsIgnoreCase("kvm")) { | ||
| throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Currently supporting KVM hosts only"); | ||
| } | ||
|
|
||
| try { | ||
| directDownloadManager.uploadCertificateToHosts(certificate, name);; | ||
| setResponseObject(new SuccessResponse(getCommandName())); | ||
| } catch (Exception e) { | ||
| throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage()); | ||
| } | ||
| } | ||
|
|
||
| @Override | ||
| public String getCommandName() { | ||
| return UploadTemplateDirectDownloadCertificate.APINAME; | ||
| } | ||
|
|
||
| @Override | ||
| public long getEntityOwnerId() { | ||
| return CallContext.current().getCallingAccount().getId(); | ||
| } | ||
| } | ||
|
|
||
|
|
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
why not use 'display' here?
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.
I have no idea why sometimes it compiles. It should not per Java specs. You cannot have a
packagedeclaration inx.y.zand then put this same class in a folder structure asx.y.z.z.The thing called
displaythere is nothing. It is not a variable, it is nothing... We need a boolean variable/value here. This looks like something that eclipse generated when using the refactor feature.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.
@rafaelweingartner there is no hard requirements on the file location. But the compiler will put the corresponding
classfile in the correct directory structure, that's all.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.
I was under the impression that there was a hard requirement. Anyways, I only found the problem because of Eclipse. It was complaining about these files that were in the wrong folder structure.