cyverse / gocommands

iRODS Command-line Tools written in Go
Other
29 stars 18 forks source link

gocmd -e ls ignores -e #25

Closed jjkoehorst closed 5 months ago

jjkoehorst commented 6 months ago

When having a ~/.irods/irods_environment.json but you want to log in using a different account and set that using the system variables the command

gocmd -e ls

ignores the -e option

gocmd -e ls          
Authentication failed (auth scheme: 'pam', username: 'jkoehorst', zone: 'myzone')!

Error Trace:
  - failed to perform ls .:
    github.com/cyverse/gocommands/cmd/subcmd.processLsCommand
        /github/workspace/cmd/subcmd/ls.go:95
  - failed to get connection:
    github.com/cyverse/gocommands/cmd/subcmd.listOne
        /github/workspace/cmd/subcmd/ls.go:110
  - failed to connect to irods server:
    github.com/cyverse/go-irodsclient/irods/session.(*ConnectionPool).Get
        /go/pkg/mod/github.com/cyverse/go-irodsclient@v0.13.2/irods/session/pool.go:202
  - failed to login to irods:
    github.com/cyverse/go-irodsclient/irods/connection.(*IRODSConnection).Connect
        /go/pkg/mod/github.com/cyverse/go-irodsclient@v0.13.2/irods/connection/connection.go:253
  - received irods authentication error (CAT_INVALID_AUTHENTICATION):
    github.com/cyverse/go-irodsclient/irods/connection.(*IRODSConnection).login
        /go/pkg/mod/github.com/cyverse/go-irodsclient@v0.13.2/irods/connection/connection.go:468
  - authentication error (auth scheme: 'pam', username: 'jkoehorst', zone: 'myzone')
(base) ➜  echo $IRODS_USER_NAME
fdp_robot
iychoi commented 6 months ago

I plan to rework the configuration reading part. I'll check this soon.

iychoi commented 6 months ago

The commit 64058a8 will drop -e flag. But it will read config from environment variables if they are set.

iychoi commented 6 months ago

@jjkoehorst Can you confirm if the commit fixes the issue?

jjkoehorst commented 5 months ago

Is this part of v0.8.5?

jjkoehorst commented 5 months ago

I just compiled the code and when I do ./bin/gocmd ls as -e is now "absent" it immediately shows the home folder content of the system variable set user so it looks like its working! :)