securekey / fabric-examples

133 stars 58 forks source link

How to run this tool when using a remote Fabric network? #4

Open vmorris opened 7 years ago

vmorris commented 7 years ago

I have a remote Fabric network (ie. HSBN) to which I have credentials provided to me post-network creation. There is no way to regenerate the MSP data directory structure and attempting to run this cli tool against the remote network results in the following error:

panic: Error getting user for org PeerOrg1: Error finding the private key path: Could not read directory open /root/go/src/github.com/securekey/fabric-examples/fabric-cli/cmd/fabric-cli/fixtures/channel/crypto-config/peerOrganizations/PeerOrg1.example.com/users/User1@PeerOrg1.example.com/keystore: no such file or directory, err /root/go/src/github.com/securekey/fabric-examples/fabric-cli/cmd/fabric-cli/fixtures/channel/crypto-config/peerOrganizations/PeerOrg1.example.com/users/User1@PeerOrg1.example.com/keystore

root@loadtest:~/go/src/github.com/securekey/fabric-examples/fabric-cli/cmd/fabric-cli# ./fabric-cli --config 4ecc/4ecc-config.yaml --orgid PeerOrg1 --user admin --pw <> query info 2017-08-20 21:30:56.693 CDT [fabric_sdk_go] InitConfigWithCmdRoot -> INFO 001 Using config file: 4ecc/4ecc-config.yaml 2017-08-20 21:30:56.694 CDT [fabric_sdk_go] InitConfigWithCmdRoot -> INFO 002 fabric_sdk_go Logging level: warning 21:30:56.694 [bccsp_sw] DEBU : KeyStore path [/tmp/msp-4ecc/keystore] missing [true]: [] 21:30:56.694 [bccsp_sw] DEBU : Creating KeyStore at [/tmp/msp-4ecc/keystore]... 21:30:56.694 [bccsp_sw] DEBU : KeyStore created at [/tmp/msp-4ecc/keystore]. 21:30:56.694 [bccsp_sw] DEBU : KeyStore opened at [/tmp/msp-4ecc/keystore]...done 21:30:56.695 [bccsp_sw] DEBU : KeyStore path [/tmp/msp-4ecc/keystore] missing [true]: [] 21:30:56.695 [bccsp_sw] DEBU : Creating KeyStore at [/tmp/msp-4ecc/keystore]... 21:30:56.695 [bccsp_sw] DEBU : KeyStore created at [/tmp/msp-4ecc/keystore]. 21:30:56.695 [bccsp_sw] DEBU : KeyStore opened at [/tmp/msp-4ecc/keystore]...done 21:30:56.695 [bccsp] DEBU : Initialize BCCSP [SW] 21:30:56.695 [bccsp_sw] DEBU : KeyStore path [/tmp/msp-4ecc/keystore] missing [true]: [] 21:30:56.695 [bccsp_sw] DEBU : Creating KeyStore at [/tmp/msp-4ecc/keystore]... 21:30:56.695 [bccsp_sw] DEBU : KeyStore created at [/tmp/msp-4ecc/keystore]. 21:30:56.695 [bccsp_sw] DEBU : KeyStore opened at [/tmp/msp-4ecc/keystore]...done panic: Error getting user for org PeerOrg1: Error finding the private key path: Could not read directory open /root/go/src/github.com/securekey/fabric-examples/fabric-cli/cmd/fabric-cli/fixtures/channel/crypto-config/peerOrganizations/PeerOrg1.example.com/users/User1@PeerOrg1.example.com/keystore: no such file or directory, err /root/go/src/github.com/securekey/fabric-examples/fabric-cli/cmd/fabric-cli/fixtures/channel/crypto-config/peerOrganizations/PeerOrg1.example.com/users/User1@PeerOrg1.example.com/keystore

goroutine 1 [running]: github.com/securekey/fabric-examples/fabric-cli/cmd/fabric-cli/common.(Action).OrgUser(0xc42022d980, 0x7ffe45bd472e, 0x8, 0x0, 0x0) /root/go/src/github.com/securekey/fabric-examples/fabric-cli/cmd/fabric-cli/common/action.go:287 +0x1ae github.com/securekey/fabric-examples/fabric-cli/cmd/fabric-cli/common.(Action).Initialize(0xc42022d980, 0xc42022ccc0, 0xc4201d5cd8, 0x89593f) /root/go/src/github.com/securekey/fabric-examples/fabric-cli/cmd/fabric-cli/common/action.go:144 +0x1348 github.com/securekey/fabric-examples/fabric-cli/cmd/fabric-cli/query.newQueryInfoAction(0xc42022ccc0, 0xc42022ccc0, 0x88cff4, 0xc42022ccc0) /root/go/src/github.com/securekey/fabric-examples/fabric-cli/cmd/fabric-cli/query/queryinfocmd.go:51 +0x4a github.com/securekey/fabric-examples/fabric-cli/cmd/fabric-cli/query.glob..func4(0x1244e60, 0xc4202be300, 0x0, 0x8) /root/go/src/github.com/securekey/fabric-examples/fabric-cli/cmd/fabric-cli/query/queryinfocmd.go:22 +0x3d github.com/securekey/fabric-examples/fabric-cli/vendor/github.com/spf13/cobra.(Command).execute(0x1244e60, 0xc4202be000, 0x8, 0x8, 0x1244e60, 0xc4202be000) /root/go/src/github.com/securekey/fabric-examples/fabric-cli/vendor/github.com/spf13/cobra/command.go:648 +0x234 github.com/securekey/fabric-examples/fabric-cli/vendor/github.com/spf13/cobra.(Command).ExecuteC(0xc42021cd80, 0x1243f80, 0x1243920, 0x1244c40) /root/go/src/github.com/securekey/fabric-examples/fabric-cli/vendor/github.com/spf13/cobra/command.go:734 +0x339 github.com/securekey/fabric-examples/fabric-cli/vendor/github.com/spf13/cobra.(*Command).Execute(0xc42021cd80, 0xc420000340, 0xc420000340) /root/go/src/github.com/securekey/fabric-examples/fabric-cli/vendor/github.com/spf13/cobra/command.go:693 +0x2b main.main() /root/go/src/github.com/securekey/fabric-examples/fabric-cli/cmd/fabric-cli/fabric-cli.go:50 +0x2f

bstasyszyn commented 7 years ago

The user that you specify is currently ignored by the CLI. I'll look into it when I get a chance.