barracuda-cloudgen-access / access-cli

Allows to access all CloudGen Access Enterprise Console APIs from the command line.
Apache License 2.0
10 stars 4 forks source link

Wrong error message when logging with a auth.yml that doesn't exist #19

Closed fisheyz closed 4 years ago

fisheyz commented 4 years ago

Description

I was trying to log in using a auth.yml that didn't exist.

Behaviour

An error Invalid login credentials.

Screenshot 2020-01-07 at 17 20 32

Expectation

An error related to the file not existing.

gbl08ma commented 4 years ago

I can't reproduce, for me it creates the specified file when it doesn't exist. Same for the endpoint set command. image

Are you sure you actually specified valid credentials for the default endpoint (since it will use the default endpoint, given that the specified file doesn't exist)?

fisheyz commented 4 years ago

I am sure the credentials are correct, I checked the default auth.yml to make sure the endpoint was the right one.

However when i specify the credentials using -e -p it works.

Screenshot 2020-01-07 at 18 15 55

What happens when you don't have privileges over the auth.yml file path.

gbl08ma commented 4 years ago

I really can't reproduce. Can you please repeat these steps and compare the output?

gabriel@Segvision-Windows:~$ cat missing.yaml
cat: missing.yaml: No such file or directory
gabriel@Segvision-Windows:~$ fyde-cli login --auth=missing.yaml
Email address: gbl08ma@gmail.com
Password:
Logged in successfully, access token stored in missing.yaml
gabriel@Segvision-Windows:~$ rm missing.yaml
gabriel@Segvision-Windows:~$ fyde-cli login --auth=missing.yaml -e gbl08ma@gmail.com
Password:
Logged in successfully, access token stored in missing.yaml
gabriel@Segvision-Windows:~$ rm missing.yaml
gabriel@Segvision-Windows:~$  fyde-cli login --auth=missing.yaml -e gbl08ma@gmail.com -p [removed]
Logged in successfully, access token stored in missing.yaml
gabriel@Segvision-Windows:~$ rm missing.yaml
gabriel@Segvision-Windows:~$ fyde-cli endpoint --auth=missing.yaml
Currently configured endpoint:
enterprise.fyde.com
gabriel@Segvision-Windows:~$ fyde-cli endpoint
Currently configured endpoint:
test.local:8080
gabriel@Segvision-Windows:~$ cat missing.yaml
cat: missing.yaml: No such file or directory
gabriel@Segvision-Windows:~$ fyde-cli endpoint set --auth=missing.yaml localhost:5000
Endpoint set to localhost:5000.
Credentials cleared, please login again using `fyde-cli login`
gabriel@Segvision-Windows:~$ rm missing.yaml
gabriel@Segvision-Windows:~$ fyde-cli endpoint
Currently configured endpoint:
test.local:8080
gabriel@Segvision-Windows:~$ fyde-cli endpoint --auth=missing.yaml
Currently configured endpoint:
enterprise.fyde.com
gabriel@Segvision-Windows:~$ fyde-cli version
Version 0.7.0
Built on 2019-12-17T12:50:46Z from commit 9b3b51a

I'm going to need more details. What operating system are you using? What is the fyde-cli version? Did you compile it yourself, or are you using a pre-built binary? If it's a pre-built binary, what is its sha256? Thanks.

fisheyz commented 4 years ago

Following your steps I figured out what I was doing wrong. I thought that the default endpoint was the one set in the default auth file.

Thanks for the help and sorry for the confusion.

gbl08ma commented 4 years ago

The --auth and --config flags specify the files that will override completely (not act as some sort of "overlay") over the respective user files (usually in ~/.config or the platform's equivalent). If a non-existent file is specified using those flags, fyde-cli will work as if it had to create the file from scratch and will use its internal defaults (in the case of the auth file, the endpoint defaults to enterprise.fyde.com).