peripli / service-manager-cli Goto Github PK
View Code? Open in Web Editor NEWCLI Tools for Service Manager
License: Apache License 2.0
CLI Tools for Service Manager
License: Apache License 2.0
Hi!
Can I make a PR with removing replace
directive from go mod for support go install
?
Or you have some motivation to pin fsnotify version?
On Linux the .sm directory is created without write permissions, so login
cannot be executed successfully
It would be useful to be able to simply do a brew install smctl
and get the cli setup and ready to use
I'm getting an error when trying to register the service broker using the smctl tool:
$ smctl register-broker my-broker-i812662 https://my-broker-i812662-proud-camel-zy.cfapps.sap.hana.ondemand.com -b broker-user:broker-password
Error: request GET https://service-manager.cfapps.sap.hana.ondemand.com/v1/service_brokers?async=false failed: StatusCode: 200 Body: {"num_items":0,"items":[]}
I'm running on a Mac and a colleagues is running on windows (same version of smctl), and we both have the same problem.
smctl version
Service Manager Client v1.10.4 (b7476e0fafff00d2505751ddb29fc9a04cc8b255)
Can some help to identify the issue?
Best regards,
Roberto Falk
yes.
*I'm trying to install the CLI as described:
Approach 1: Manual installation
Download CLI
go get github.com/Peripli/service-manager-cli
Install CLI
go install github.com/Peripli/service-manager-cli/smctl
go get github.com/Peripli/service-manager-cli
go install github.com/Peripli/service-manager-cli/smctl
go install github.com/Peripli/service-manager-cli/smctl
can't load package: package github.com/Peripli/service-manager-cli/smctl: cannot find package "github.com/Peripli/service-manager-cli/smctl" in any of:
/usr/local/go/src/github.com/Peripli/service-manager-cli/smctl (from $GOROOT)
/Users/d036795/go/src/github.com/Peripli/service-manager-cli/smctl (from $GOPATH)
NA
Yes.
Golang version 1.17.1 in this repo is out of date and has lots of security vulnerabilities. Please upgrade it to 1.22.4.
The issue is indeed for the cli.
Trying to delete binding fails if it belongs to an instance with a non-unique name (i.e. there are additional instances with the same name)
Error message that the deletion failed since the instance name isn't unique:
Error: more than one service instance with name logging-bnr-standard found. Use --id flag to specify id of the binding to be deleted
Being able to delete the binding
For unbind I can't supply an id for the instance. Only the name is used. I believe the problem is in https://github.com/Peripli/service-manager-cli/blob/master/internal/cmd/binding/unbind.go#L90
By specification Service Manager supports https://github.com/Peripli/specification/blob/master/api.md#aggregated-catalog
Add CLI command to list aggregated catalog
smctl status /v1/service_instances/edb87ed5-a36d-4628-9245-6be44809edf8/operations/fcad4183-aec7-4b95-85be-ed11b3e24b6b
returns the status of an operation before.
Unfortunately I must know all the ID's in the command. Is there any way to get all operation status without knowing the ids?
smctl list-instances
contains all successfull created instances, but I'm unable to get all the failed.
Client id and secret cannot be configured when executing login on freshly installed CLI
I've downloaded the current release (smctl-1.12.1-darwin-arm64.tar.gz) to my Apple M2 Max MacBook Pro. There I've extracted the file and moved the executable to /usr/local/bin/smctl. But now I get the following error message:
“smctl” can’t be opened because Apple cannot check it for malicious software.
This software needs to be updated. Contact the developer for more information.
Chrome downloaded this file today at 08:42.
I can now go to System Settings -> Privacy and Security and click the "Allow Anyway" button:
I would expect that a tool that should also be used in corporate environments should get signed with an Apple developer certificate.
If I login in with smctl login....
the user context is set correct and I can get them with smctl info
>> smctl info
Service Manager URL: https://service-manager.cfapps.sap.hana.ondemand.com
User: [email protected]
But this information is still present after smctl logout
, which seems to be wrong.
>> smctl logout
You have successfully logged out.
>> smctl info
Service Manager URL: https://service-manager.cfapps.sap.hana.ondemand.com
User: [email protected]
Is there any way to the get the context (user/subaccount domain) in which I'm logged in?
the help output of the smctl
return, that smctl info
should return the information of the logged user....but I'm logged out.
help Help about any command
info Prints information for logged user
label Label resource
smctl related issue.
I am trying to install service-manager-cli
After a long debugging, I understood that the smctl_windows64.exe has to be renamed to smctl.exe .
Please update your readme with this point.
Most likely this issue is related to the cli, but could be also a combination of cli and service-manager api.
After login the used token seem not to comply with JWS standards. Client returns:
Error: request GET https://***/v1/platforms failed: StatusCode: 401 Body: {"error":"Unauthorized","description":"No authenticated user found: Cause: oidc: malformed jwt: square/go-jose: compact JWS format must have three parts"}
"***": is in reality the correct uri of the service-manager
The entire test is based on a fresh and empty docker installation of the service-manager.
After integrating with a openid connect provider (community gitlab and turning on the openid feature) a login is executed successfully (client-id and user credential based), but as soon as I use any other command it returns the error message. The Bearer token is stored in local configuration file, but not in the required JWS format.
smctl_win64.exe login --auth-flow client-credentials --client-id foo --client-secret bar --config config-client.json --url https://***
(works and returns proper error messages as expected if something is wrong with credentials or settings in openid provider)
smctl_win64.exe list-platforms --config config-client.json
Turning on verbose does not reveal much more info besides: component=util/client.go:87
Same happens with a simple mocked openid provider service based on a node-oidc-provider.
Error: request GET https://***/v1/platforms failed: StatusCode: 401 Body: {"error":"Unauthorized","description":"No authenticated user found: Cause: oidc: malformed jwt: square/go-jose: compact JWS format must have three parts"}
yes
go install github.com/Peripli/service-manager-cli fails with cannot find package "github.com/hashicorp/hcl/hcl/printer"
I PROVIDE A MITIGATION AT THE END OF THIS DESCRIPTION
$ go get github.com/Peripli/service-manager-cli
$ go install github.com/Peripli/service-manager-cli
../src/github.com/spf13/viper/viper.go:40:2: cannot find package "github.com/hashicorp/hcl/hcl/printer" in any of:
/usr/local/go/src/github.com/hashicorp/hcl/hcl/printer (from $GOROOT)
/home/a1/go/src/github.com/hashicorp/hcl/hcl/printer (from $GOPATH)
../src/github.com/spf13/viper/viper.go:40:2: cannot find package "github.com/hashicorp/hcl/hcl/printer" in any of:
/usr/local/go/src/github.com/hashicorp/hcl/hcl/printer (from $GOROOT)
/home/a1/go/src/github.com/hashicorp/hcl/hcl/printer (from $GOPATH)
$ go install github.com/Peripli/service-manager-cli
go: finding github.com/Peripli/service-manager-cli v1.11.7
go: downloading github.com/Peripli/service-manager-cli v1.11.7
go: extracting github.com/Peripli/service-manager-cli v1.11.7
Run
export GO111MODULE=on
prior to installation.
Solution has been described e.g., here: spf13/viper#1076 (comment)
The smctl provision
CLI tool returns always 0
even if the command fails. Normaly CLI tools returns
1
or any value greater zero on error. This makes it possible to test if the command has success.
( echo $?
shows the status of last execute shell command )
Instead the provision command returns a human readable text and tells how to check if the command has success or not.
smctl provision sm-instance service-manager service-operator-access -o yaml
Service Instance sm-instance successfully scheduled for provisioning. To see status of the operation use:
smctl status /v1/service_instances/3c496c0c-d89d-4753-af6f-e3c979203b8a/operations/6e9ff2c0-f5e4-4f15-804f-b5d122c53fda
But this output is pretty useless in an test/automation environment. The smctl list-instances
do not return failed instances nor do we have any other chances to retrieved failed provision commands.
Any idea how to automate/test the instance provision command?
one solution could be to support -o json
as argument in the provision command as well. In this case we can fetch the test command easy from the output instead of parse human readable output.
ClientConfig
should have options for timeout and retries.
Hi
as now smctl is now available on M1. It is beneficial to have the cli compiled for linux_arm64 as well not just darwin. This is useful for users using the cli in their developing containers.
Thank you
Documentation for list-plans
is not correct. The Shareable
information is missing in the example
Also, why don't I see the plans and offerings for registered service brokers? I'd like to also know if the plans are shareable.
most likely
Calling smctl register-broker
passing url ending with a /
results in error as the resulting call to the service broker contains the extra slash
call received by service broker:
GET //v2/catalog HTTP/1.1" 400
smctl register-broker BROKER_NAME https://*/ -b ****:****
Error: request POST .... failed: Status code: 400 Body: {"error":"ServiceBrokerErr","description":"error fetching catalog for broker with name *****: broker responded with 400 Bad Request"}
Yes
Running smctl login fails saying
Error: Could not build authenticator Reason: error occurred while fetching openid configuration: unexpected status code
The error listed above
Success in login
Note:
Running the same on one sub account works while it fails on a second sub account (I've double check that the client id, client secret and sub domain are correct)
When smctl lb
is executed no brokers are returned (even though there are some in the service manager). When smctl curl /v1/brokers
is executed a non-empty result is returned.
No brokers are displayed.
At least the registered broker is returned.
pre1.4.1
This seems to be a regression as old versions work as expected (tested with v1.0.0)
Every widely used CLI provides a public reference documentation. One should be made for the SM CLI.
we are working on an simple automation for our setup and we found a simple issue with the
smctl status
output. The entity errors
is an object instead of an array but the name of the attribute
is in plural
which assumes that the entity can contain more than one entry.
Maybe the kind of the attribute should change to an array or the naming should be singular instead of plural.
If errors
is an array we can test on success very easy with jq
and lenght
of the errors array...which is currently not possible.
smctl status /v1/service_instances/69a5e6c1-555c-4f88-8925-5558eee12bab/operations/70407abc-9684-40e9-8b17-e6135355e5b6 -o json
{
"id": "70407abc-9684-40e9-8b17-e6135355e5b6",
"type": "create",
"state": "failed",
"resource_id": "69a5e6c1-555c-4f88-8925-5558eee12bab",
"resource_type": "/v1/service_instances",
"errors": {
"error": "Conflict",
"description": "instance with same name exists for the current tenant"
},
"created_at": "2021-08-15T09:37:41.609766Z",
"updated_at": "2021-08-15T09:37:41.692213Z",
"labels": {
"subaccount_id": [
"bfcdee60-9ef8-43a7-8dbe-71b7e98e87dc"
]
}
}
The example for smctl update-broker uses broker-url as a parameter, but the update actually only works with broker_url.
The SM CLI will fail on installation due to referring to an older package name for the class LabelChanges.
The pull request from Service Manager which made these changes is here: Peripli/service-manager#444
It seems like SM CLI should update the coding to reflect these changes, otherwise the installation of the tool will not work.
smctl should have the option to trust self-signed certs. Like cf cli's "--skip-ssl-validation" smctl should have "--insecure" for example
The issue is related to the installation of CLI in Mac OS.
The downloaded for Mac OS does not have any extension like pkg and I am not sure how to make use of it to install the tool.
probably
I'm unable to unbind existing bindings.
smctl shows binding but when I try to call unbind
, smctl displays 404 and fails to unbind
This was done through the UI of service catalog, but the service catalog resource no longer exists
$ smctl list-bindings
One service binding.
ID Name Instance Name Credentials Created Updated Ready Labels
------------------------------------ ------------------------------------ ---------------------------- ----------- --------------------------- --------------------------- ----- --------------------------------------------------
a42a5dde-8bd8-4491-9cca-6a6343e97158 a42a5dde-8bd8-4491-9cca-6a6343e97158 service-catalog-auditlog-api 2021-06-22T08:04:25.998875Z 2021-06-22T08:04:25.998875Z true subaccount_id=121ebe4e-08ec-48d6-bc87-b49f9327fe82
$ smctl unbind service-catalog-auditlog-api a42a5dde-8bd8-4491-9cca-6a6343e97158
Do you really want to delete binding with name [a42a5dde-8bd8-4491-9cca-6a6343e97158] for instance with name service-catalog-auditlog-api (Y/n): y
Could not delete service binding. Reason: Error: request DELETE https://service-manager.cfapps.sap.hana.ondemand.com/v1/service_bindings/a42a5dde-8bd8-4491-9cca-6a6343e97158?async=true failed: StatusCode: 404 Body: {"error":"NotFound","description":"could not find such /v1/service_bindings"}
404 failure to unbind
successfully unbind the bindings
Currently you cannot set with a configuration the client id and secret during login operation
Some commands like update platform and update broker need a way to provide input from file.
Check also other commands which might need this.
smctl delete-broker
exits with code zero even if it fails
$ smctl delete-broker bb
Could not delete broker bb. Reason: URL: https://sm-host/v1/service_brokers/e6c67516-f7b9-44c1-a2a6-64d3decc333e, Status: 403; ErrorMessage: Forbidden; Description: Cause: Required scope "service_manager.broker.deregister" is missing from user token scopes [service_manager.broker.read service_manager.readBroker service_manager.readServiceCatalog service_manager.servicecatalog.read service_manager.broker.register service_manager.registerBroker]. Cause: Client id "service_manager_broker_admin" from user token is not trusted
Error: Broker with name: bb was not found
$ echo $?
0
$ smctl delete-broker none
Service Broker(s) not found
$ echo $?
0
non-zero exit code
When service-manager is deployed with a self-signed certificate the smctl will fail to make requests as it will validate the signature.
smctl should provide an option like cf cli --skip-ssl-validation
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.