Remove unnecessary variable

This commit is contained in:
Nick Sardo 2017-04-21 12:14:41 -07:00
parent e973e39be9
commit 10cecd366f

View file

@ -392,15 +392,13 @@ func (l *L7) checkSSLCert() (err error) {
} }
// Retrieve known ssl certificate // Retrieve known ssl certificate
var usedCert *compute.SslCertificate
if expectedCertName != "" { if expectedCertName != "" {
usedCert, _ = l.cloud.GetSslCertificate(expectedCertName) l.sslCert, _ = l.cloud.GetSslCertificate(expectedCertName)
} }
// TODO: Currently, GCE only supports a single certificate per static IP // TODO: Currently, GCE only supports a single certificate per static IP
// so we don't need to bother with disambiguation. Naming the cert after // so we don't need to bother with disambiguation. Naming the cert after
// the loadbalancer is a simplification. // the loadbalancer is a simplification.
ingCert := l.runtimeInfo.TLS.Cert ingCert := l.runtimeInfo.TLS.Cert
ingKey := l.runtimeInfo.TLS.Key ingKey := l.runtimeInfo.TLS.Key
@ -414,10 +412,10 @@ func (l *L7) checkSSLCert() (err error) {
// PrivateKey is write only, so compare certs alone. We're assuming that // PrivateKey is write only, so compare certs alone. We're assuming that
// no one will change just the key. We can remember the key and compare, // no one will change just the key. We can remember the key and compare,
// but a bug could end up leaking it, which feels worse. // but a bug could end up leaking it, which feels worse.
if usedCert == nil || ingCert != usedCert.Certificate { if l.sslCert == nil || ingCert != l.sslCert.Certificate {
newCertName := primaryCertName newCertName := primaryCertName
if usedCert != nil && (ingCert != usedCert.Certificate) { if l.sslCert != nil && (ingCert != l.sslCert.Certificate) {
if usedCert.Name == primaryCertName { if l.sslCert.Name == primaryCertName {
newCertName = secondaryCertName newCertName = secondaryCertName
} }
} }
@ -439,7 +437,7 @@ func (l *L7) checkSSLCert() (err error) {
return err return err
} }
// Save the current cert for cleanup after we update the target proxy. // Save the current cert for cleanup after we update the target proxy.
l.oldSSLCert = usedCert l.oldSSLCert = l.sslCert
l.sslCert = cert l.sslCert = cert
} }