packer/rpc: don't panic on cache errors [GH-1328]
This commit is contained in:
parent
e9c2628a77
commit
ad51098a3e
@ -22,6 +22,7 @@ BUG FIXES:
|
||||
|
||||
* core: nicer error message if an encrypted private key is used for
|
||||
SSH. [GH-1445]
|
||||
* core: Fix crash that could happen with a well timed double Ctrl-C. [GH-1328]
|
||||
* builder/amazon-chroot: Can properly build HVM images now. [GH-1360]
|
||||
* builder/amazon-chroot: Fix crash in root device check. [GH-1360]
|
||||
* builder/amazon-instance: Fix deprecation warning for `ec2-bundle-vol`
|
||||
|
@ -2,6 +2,7 @@ package rpc
|
||||
|
||||
import (
|
||||
"github.com/mitchellh/packer/packer"
|
||||
"log"
|
||||
"net/rpc"
|
||||
)
|
||||
|
||||
@ -24,7 +25,8 @@ type CacheRLockResponse struct {
|
||||
|
||||
func (c *cache) Lock(key string) (result string) {
|
||||
if err := c.client.Call("Cache.Lock", key, &result); err != nil {
|
||||
panic(err)
|
||||
log.Printf("[ERR] Cache.Lock error: %s", err)
|
||||
return
|
||||
}
|
||||
|
||||
return
|
||||
@ -33,7 +35,8 @@ func (c *cache) Lock(key string) (result string) {
|
||||
func (c *cache) RLock(key string) (string, bool) {
|
||||
var result CacheRLockResponse
|
||||
if err := c.client.Call("Cache.RLock", key, &result); err != nil {
|
||||
panic(err)
|
||||
log.Printf("[ERR] Cache.RLock error: %s", err)
|
||||
return "", false
|
||||
}
|
||||
|
||||
return result.Path, result.Exists
|
||||
@ -41,13 +44,15 @@ func (c *cache) RLock(key string) (string, bool) {
|
||||
|
||||
func (c *cache) Unlock(key string) {
|
||||
if err := c.client.Call("Cache.Unlock", key, new(interface{})); err != nil {
|
||||
panic(err)
|
||||
log.Printf("[ERR] Cache.Unlock error: %s", err)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
func (c *cache) RUnlock(key string) {
|
||||
if err := c.client.Call("Cache.RUnlock", key, new(interface{})); err != nil {
|
||||
panic(err)
|
||||
log.Printf("[ERR] Cache.RUnlock error: %s", err)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user