File tree Expand file tree Collapse file tree 2 files changed +10
-12
lines changed Expand file tree Collapse file tree 2 files changed +10
-12
lines changed Original file line number Diff line number Diff line change @@ -57,8 +57,8 @@ type ClientOptions struct {
57
57
// Addresses specifies the namenode(s) to connect to.
58
58
Addresses []string
59
59
// User specifies which HDFS user the client will act as. It is required
60
- // unless kerberos authentication is enabled, in which case it will be
61
- // determined from the provided credentials if empty .
60
+ // unless kerberos authentication is enabled, in which case it is overridden
61
+ // by the username set in KerberosClient .
62
62
User string
63
63
// UseDatanodeHostname specifies whether the client should connect to the
64
64
// datanodes via hostname (which is useful in multi-homed setups) or IP
Original file line number Diff line number Diff line change @@ -58,8 +58,8 @@ type NamenodeConnectionOptions struct {
58
58
// Addresses specifies the namenode(s) to connect to.
59
59
Addresses []string
60
60
// User specifies which HDFS user the client will act as. It is required
61
- // unless kerberos authentication is enabled, in which case it will be
62
- // determined from the provided credentials if empty .
61
+ // unless kerberos authentication is enabled, in which case it is overridden
62
+ // by the username set in KerberosClient .
63
63
User string
64
64
// DialFunc is used to connect to the namenodes. If nil, then
65
65
// (&net.Dialer{}).DialContext is used.
@@ -94,14 +94,12 @@ func NewNamenodeConnection(options NamenodeConnectionOptions) (*NamenodeConnecti
94
94
95
95
var user , realm string
96
96
user = options .User
97
- if user == "" {
98
- if options .KerberosClient != nil {
99
- creds := options .KerberosClient .Credentials
100
- user = creds .UserName ()
101
- realm = creds .Realm ()
102
- } else {
103
- return nil , errors .New ("user not specified" )
104
- }
97
+ if options .KerberosClient != nil {
98
+ creds := options .KerberosClient .Credentials
99
+ user = creds .UserName ()
100
+ realm = creds .Realm ()
101
+ } else if user == "" {
102
+ return nil , errors .New ("user not specified" )
105
103
}
106
104
107
105
// The ClientID is reused here both in the RPC headers (which requires a
You can’t perform that action at this time.
0 commit comments