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

In zms-cli, the create_admin_role seems to be required to set it. #2187

Open
TakuyaMatsu opened this issue May 26, 2023 · 3 comments
Open

In zms-cli, the create_admin_role seems to be required to set it. #2187

TakuyaMatsu opened this issue May 26, 2023 · 3 comments

Comments

@TakuyaMatsu
Copy link
Contributor

When performing putProviderResourceGroupRoles, createAdminRole is optional on the ZMS server.

Bool createAdminRole (optional, default=true); //optional flag indicating whether to create a default tenancy admin role

It appears to be optional in zmc-cli, but in reality, it seems to be required to set it.

buf.WriteString(" create_admin_role : optional flag indicating whether to create a default tenancy admin role\n")

case "add-provider-resource-group-roles":
if argc > 4 {
createAdminRole, err := strconv.ParseBool(args[3])
if err == nil {
return cli.AddProviderResourceGroupRoles(dn, args[0], args[1], args[2], createAdminRole, args[4:])
}
return nil, err
}

@havetisyan
Copy link
Collaborator

The link you've provided for line 2385 is for add-tenancy and not for add-provider-resource-group-roles and in the add-tenancy we're correctly handling it as optional on line 709.

We have the same comment for add-provider-resource-group-roles on line 2468 but I think the problem there is the comment. But unlike add-tenancy, that argument cannot be optional since it's not the last argument:

buf.WriteString(" add-tenancy provider [create_admin_role]\n") buf.WriteString(" add-provider-resource-group-roles provider_domain provider_service resource_group create_admin_role role=action [role=action ...]\n")
and the online help correctly specifies the argument as optional for the add-tenancy but not for add-provider-resource-group-roles command.

@TakuyaMatsu
Copy link
Contributor Author

Thank you for your clarification. I understand that the create_admin_role argument is not optional for the add-provider-resource-group-roles command due to its position in the argument list. However, considering the create_admin_role is optional on the ZMS server, would it be possible to refactor the command to allow this argument to be optional as well? This could potentially improve the user experience and consistency across the CLI. If there are any suggestions for refactoring, I am willing to make the necessary changes.

@havetisyan
Copy link
Collaborator

sure, you can easily add the necessary logic when parsing that command. it's a boolean argument and the rest of the remaining arguments must be in the form of role=action. So if the argument is either "true" or "false" then you can assume it's the value for the create_admin_role argument, otherwise treat it as one of the role=action values and process as such.

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

No branches or pull requests

2 participants