command: render new modules properly

This commit is contained in:
Mitchell Hashimoto 2014-09-25 14:52:06 -07:00
parent 1835a03842
commit 5f791051a6
2 changed files with 20 additions and 10 deletions

View File

@ -38,7 +38,7 @@ func (h *CountHook) Reset() {
}
func (h *CountHook) PreApply(
id string,
n *terraform.InstanceInfo,
s *terraform.InstanceState,
d *terraform.InstanceDiff) (terraform.HookAction, error) {
h.Lock()
@ -55,21 +55,21 @@ func (h *CountHook) PreApply(
action = countHookActionAdd
}
h.pending[id] = action
h.pending[n.HumanId()] = action
return terraform.HookActionContinue, nil
}
func (h *CountHook) PostApply(
id string,
n *terraform.InstanceInfo,
s *terraform.InstanceState,
e error) (terraform.HookAction, error) {
h.Lock()
defer h.Unlock()
if h.pending != nil {
if a, ok := h.pending[id]; ok {
delete(h.pending, id)
if a, ok := h.pending[n.HumanId()]; ok {
delete(h.pending, n.HumanId())
if e == nil {
switch a {

View File

@ -34,11 +34,13 @@ const (
)
func (h *UiHook) PreApply(
id string,
n *terraform.InstanceInfo,
s *terraform.InstanceState,
d *terraform.InstanceDiff) (terraform.HookAction, error) {
h.once.Do(h.init)
id := n.HumanId()
op := uiResourceModify
if d.Destroy {
op = uiResourceDestroy
@ -113,9 +115,11 @@ func (h *UiHook) PreApply(
}
func (h *UiHook) PostApply(
id string,
n *terraform.InstanceInfo,
s *terraform.InstanceState,
applyerr error) (terraform.HookAction, error) {
id := n.HumanId()
h.l.Lock()
op := h.resources[id]
delete(h.resources, id)
@ -145,11 +149,15 @@ func (h *UiHook) PostApply(
}
func (h *UiHook) PreDiff(
id string, s *terraform.InstanceState) (terraform.HookAction, error) {
n *terraform.InstanceInfo,
s *terraform.InstanceState) (terraform.HookAction, error) {
return terraform.HookActionContinue, nil
}
func (h *UiHook) PreProvision(id, provId string) (terraform.HookAction, error) {
func (h *UiHook) PreProvision(
n *terraform.InstanceInfo,
provId string) (terraform.HookAction, error) {
id := n.HumanId()
h.ui.Output(h.Colorize.Color(fmt.Sprintf(
"[reset][bold]%s: Provisioning with '%s'...[reset_bold]",
id, provId)))
@ -157,9 +165,11 @@ func (h *UiHook) PreProvision(id, provId string) (terraform.HookAction, error) {
}
func (h *UiHook) PreRefresh(
id string, s *terraform.InstanceState) (terraform.HookAction, error) {
n *terraform.InstanceInfo,
s *terraform.InstanceState) (terraform.HookAction, error) {
h.once.Do(h.init)
id := n.HumanId()
h.ui.Output(h.Colorize.Color(fmt.Sprintf(
"[reset][bold]%s: Refreshing state... (ID: %s)",
id, s.ID)))