-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
project id added in test #3378
project id added in test #3378
Conversation
as per @ustcweizhou's comment: #3377 (comment)
I saved test_15_project_tag in a seperated python file, and run it in marvin test so this is ok for me. @DaanHoogland @rhtyd |
@@ -1756,6 +1756,7 @@ def test_15_project_tag(self): | |||
listall=True, | |||
resourceType='project', | |||
resourceIds=project.id, | |||
projectid=project.id, |
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 would have expected this to work without specifying project ID. Do you think we need to fix mgmt server instead?
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.
@DaanHoogland Read this https://github.com/apache/cloudstack/pull/3323/files, how about we add a check to read the resource type and use the provided resource ID as account ID when type is project.
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.
@rhtyd that should be good.
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.
yes, that would work, @rhtyd. I don't think it matters much, as the id is already in the API, but that solution would have less breakage of ecosystem scripting so let's go for it.
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.
on second thought @rhtyd , you do mean to use the resource ID to get the account ID and not use it as account ID, right? (else I don't understand 😮 )
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.
yes @DaanHoogland, I'm more concerned with existing systems and integrations that may break. And moreover, it breaks the API semantics (we're already passing projectid in the resource ID so why not use it).
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.
on second thought @rhtyd , it won't work. There is no resource ID unless the project ID is passed as such. in the call there is no information that we can use
listall=True,
resourceType='project',
key=tag_key,
We could get the current account from the call context but that would only satisfy some use-cases. if an admin wants tags for some project they are not in we still need the parameter.
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.
never mind, i think I was stupid just there ^^. I'll revisit.
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've been mostly busy on other things today but gave it a second look. I think it can be fixed as you suggest in the query service. I will give it a swing soon. I'll remove the java change for now but leave the test in.
I think I just overkilled it. didn't want to spend more time on it. |
@ustcweizhou I realize that now. I am confused by @rhtyd 's remark to use the resource ID it would not be the account ID of the owner of the project but the project itself. I don't think we can use that either. We could use it to find the account ID. |
note to self; need to do something like:
but translate |
@DaanHoogland |
@@ -646,7 +646,9 @@ | |||
|
|||
Ternary<Long, Boolean, ListProjectResourcesCriteria> domainIdRecursiveListProject = new Ternary<Long, Boolean, ListProjectResourcesCriteria>(cmd.getDomainId(), cmd.isRecursive(), null); | |||
|
|||
_accountMgr.buildACLSearchParameters(caller, null, cmd.getAccountName(), cmd.getProjectId(), permittedAccounts, domainIdRecursiveListProject, listAll, false); | |||
Long projectId = cmd.getProjectId() == null ? cmd.getResourceId() : cmd.getProjectId(); |
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.
public String getResourceId() {
return resourceId;
}
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.
Previous approval was based on 1 line change. Need to review again after mutiple changes.
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.
Previous approval was based on 1 line change. Need to review again after new changes.
@DaanHoogland failed following marvin test: (not sure if it's related to the PR)
|
try { | ||
projectId = Long.parseLong(resourceId); | ||
} catch (NumberFormatException e) { | ||
projectId = _projectDao.findByUuid(resourceId).getId(); |
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.
What if the uuid is invalid ?
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.
it throws an exception: garbage in, garbage out. should we handle that? I think it is the exception @rhtyd is pointing at. How do you suggest this should be handled?
Ping @DaanHoogland |
I'm taking over the failing smoketests/Travis issues here: #3476 |
as per @ustcweizhou's comment: #3377 (comment)
Description
Types of changes
Screenshots (if appropriate):
How Has This Been Tested?