openziti / ziti

The parent project for OpenZiti. Here you will find the executables for a fully zero trust, application embedded, programmable network @OpenZiti
https://openziti.io
Apache License 2.0
2.82k stars 159 forks source link

can't create service policy with @ identity name #93

Closed ekoby closed 4 years ago

ekoby commented 4 years ago

this fails in zac and via cli

eugene@scruffy:~/work/scruffy-env$ ziti edge controller list identities
id: 1fc6b5aa-bc13-450b-beb5-b47d7068457c    name: hermes    type: Device    role attributes: {}                                                                                              
id: b9fba8ad-262c-4169-b4bb-658121bb7454    name: Default Admin    type: User    role attributes: {}                                                                                         
results: 1-2 of 2

eugene@scruffy:~/work/scruffy-env$ ziti edge controller create service-policy hermes-bind1 Bind -i @hermes -r '#all'                                                                         
panic: error creating service-policies instance in Ziti Edge Controller at https://scruffy:1280. Status code: 400 Bad Request, Server returned: {"error":{"args":{"urlVars":{}},"cause":{"message":"no identities found with the given ids","field":"identityRoles","value":["hermes"]},"causeMessage":"the value '[hermes]' for 'identityRoles' is invalid: no identities found with the given ids","code":"INVALID_FIELD","message":"The field contains an invalid value","requestId":"b9624172-6e08-4438-a703-92bc63f02dcb"},"meta":{"apiEnrolmentVersion":"0.0.1","apiVersion":"0.0.1"}}

goroutine 1 [running]:
github.com/netfoundry/ziti-cmd/ziti/cmd/ziti/cmd/edge_controller.runCreateServicePolicy(0xc000297540, 0xc000167d60, 0xc000167d38)                                                            
        /home/eugene/work/github/ziti-cmd/ziti/cmd/ziti/cmd/edge_controller/create_service_policy.go:84 +0x606                                                                               
github.com/netfoundry/ziti-cmd/ziti/cmd/ziti/cmd/edge_controller.newCreateServicePolicyCmd.func1(0xc00029e780, 0xc0002b1c20, 0x2, 0x6)                                                       
        /home/eugene/work/github/ziti-cmd/ziti/cmd/ziti/cmd/edge_controller/create_service_policy.go:54 +0x66                                                                                
github.com/spf13/cobra.(*Command).execute(0xc00029e780, 0xc0002b1bc0, 0x6, 0x6, 0xc00029e780, 0xc0002b1bc0)                                                                                  
        /home/eugene/go/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:830 +0x29d
github.com/spf13/cobra.(*Command).ExecuteC(0xf8a0a0, 0x1006998, 0x0, 0x0)
        /home/eugene/go/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:914 +0x2fb
github.com/spf13/cobra.(*Command).Execute(...)
        /home/eugene/go/pkg/mod/github.com/spf13/cobra@v0.0.5/command.go:864
github.com/netfoundry/ziti-cmd/ziti/cmd/ziti/cmd.Execute()
        /home/eugene/work/github/ziti-cmd/ziti/cmd/ziti/cmd/cmd.go:77 +0x51
main.main()
        /home/eugene/work/github/ziti-cmd/ziti/cmd/ziti/main.go:24 +0x20

eugene@scruffy:~/work/scruffy-env$ ziti edge controller create service-policy hermes-bind1 Bind -i @1fc6b5aa-bc13-450b-beb5-b47d7068457c -r '#all'                                         
0b31d769-8e3a-4e38-a368-e2e5474c21b3

eugene@scruffy:~/work/scruffy-env$ 
plorenz commented 4 years ago

From the REST API perspective, this is working as intended. We had support for @name but it was agreed to only support @id and support for @name was removed. It can be added back in the clients (CLI/ZAC).