forked from TrueCloudLab/certificates
Fail silently if the identity fails.
This commit is contained in:
parent
401fc20e96
commit
28b08ef46b
1 changed files with 4 additions and 3 deletions
|
@ -119,20 +119,21 @@ func (o *clientOptions) applyDefaultIdentity() error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Do not load an identity if something fails
|
||||||
b, err := ioutil.ReadFile(IdentityFile)
|
b, err := ioutil.ReadFile(IdentityFile)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
var identity Identity
|
var identity Identity
|
||||||
if err := json.Unmarshal(b, &identity); err != nil {
|
if err := json.Unmarshal(b, &identity); err != nil {
|
||||||
return errors.Wrapf(err, "error unmarshaling %s", IdentityFile)
|
return nil
|
||||||
}
|
}
|
||||||
if err := identity.Validate(); err != nil {
|
if err := identity.Validate(); err != nil {
|
||||||
return err
|
return nil
|
||||||
}
|
}
|
||||||
opts, err := identity.Options()
|
opts, err := identity.Options()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return nil
|
||||||
}
|
}
|
||||||
for _, fn := range opts {
|
for _, fn := range opts {
|
||||||
if err := fn(o); err != nil {
|
if err := fn(o); err != nil {
|
||||||
|
|
Loading…
Reference in a new issue