Merge lp:~axwalk/juju-core/manual-provisioning-followup into lp:~go-bot/juju-core/trunk

Proposed by Andrew Wilkins
Status: Merged
Approved by: Andrew Wilkins
Approved revision: no longer in the source branch.
Merged at revision: 1750
Proposed branch: lp:~axwalk/juju-core/manual-provisioning-followup
Merge into: lp:~go-bot/juju-core/trunk
Diff against target: 43 lines (+4/-2)
3 files modified
environs/manual/agent.go (+1/-1)
environs/manual/provisioner.go (+2/-0)
provider/provider.go (+1/-1)
To merge this branch: bzr merge lp:~axwalk/juju-core/manual-provisioning-followup
Reviewer Review Type Date Requested Status
Juju Engineering Pending
Review via email: mp+183097@code.launchpad.net

Commit message

environs/manual: log machine removal on error

Log the fact that the machine is being removed
from state if an error occurred during manual
provisioning.

https://codereview.appspot.com/13306044/

Description of the change

environs/manual: log machine removal on error

Log the fact that the machine is being removed
from state if an error occurred during manual
provisioning.

https://codereview.appspot.com/13306044/

To post a comment you must log in.
Revision history for this message
Andrew Wilkins (axwalk) wrote :

Reviewers: mp+183097_code.launchpad.net,

Message:
Please take a look.

Description:
environs/manual: log machine removal on error

Log the fact that the machine is being removed
from state if an error occurred during manual
provisioning.

https://code.launchpad.net/~axwalk/juju-core/manual-provisioning-followup/+merge/183097

(do not edit description out of merge proposal)

Please review this at https://codereview.appspot.com/13306044/

Affected files:
   A [revision details]
   M environs/manual/provisioner.go

Index: [revision details]
=== added file '[revision details]'
--- [revision details] 2012-01-01 00:00:00 +0000
+++ [revision details] 2012-01-01 00:00:00 +0000
@@ -0,0 +1,2 @@
+Old revision: tarmac-20130830023839-2er74ebh5lr6m46p
+New revision: <email address hidden>

Index: environs/manual/provisioner.go
=== modified file 'environs/manual/provisioner.go'
--- environs/manual/provisioner.go 2013-08-29 03:58:19 +0000
+++ environs/manual/provisioner.go 2013-08-30 06:59:40 +0000
@@ -53,6 +53,7 @@
  func ProvisionMachine(args ProvisionMachineArgs) (m *state.Machine, err
error) {
   defer func() {
    if m != nil && err != nil {
+ logger.Errorf("provisioning failed, removing machine %v", m)
     m.EnsureDead()
     m.Remove()
     m = nil
@@ -155,6 +156,7 @@
  func injectMachine(args injectMachineArgs) (m *state.Machine, err error) {
   defer func() {
    if m != nil && err != nil {
+ logger.Errorf("injecting into state failed, removing machine %v", m)
     m.EnsureDead()
     m.Remove()
    }

Revision history for this message
Ian Booth (wallyworld) wrote :

LGTM, please add the error to the logged message

https://codereview.appspot.com/13306044/diff/1/environs/manual/provisioner.go
File environs/manual/provisioner.go (right):

https://codereview.appspot.com/13306044/diff/1/environs/manual/provisioner.go#newcode56
environs/manual/provisioner.go:56: logger.Errorf("provisioning failed,
removing machine %v", m)
can we please include the error in the log

https://codereview.appspot.com/13306044/diff/1/environs/manual/provisioner.go#newcode159
environs/manual/provisioner.go:159: logger.Errorf("injecting into state
failed, removing machine %v", m)
can we please include the error in the log

https://codereview.appspot.com/13306044/

Revision history for this message
Andrew Wilkins (axwalk) wrote :

On 2013/09/03 01:33:44, wallyworld wrote:
> LGTM, please add the error to the logged message

https://codereview.appspot.com/13306044/diff/1/environs/manual/provisioner.go
> File environs/manual/provisioner.go (right):

https://codereview.appspot.com/13306044/diff/1/environs/manual/provisioner.go#newcode56
> environs/manual/provisioner.go:56: logger.Errorf("provisioning failed,
removing
> machine %v", m)
> can we please include the error in the log

https://codereview.appspot.com/13306044/diff/1/environs/manual/provisioner.go#newcode159
> environs/manual/provisioner.go:159: logger.Errorf("injecting into
state failed,
> removing machine %v", m)
> can we please include the error in the log

Done. I had thought it superfluous, as the error will be logged by the
command code. But I suppose we might use this elsewhere in the future,
and the error might not get logged.

https://codereview.appspot.com/13306044/

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'environs/manual/agent.go'
2--- environs/manual/agent.go 2013-09-02 00:44:52 +0000
3+++ environs/manual/agent.go 2013-09-03 01:56:59 +0000
4@@ -81,7 +81,7 @@
5 if err != nil {
6 return "", err
7 }
8- mcfg.MachineEnvironment[osenv.JujuProviderType] = provider.Manual
9+ mcfg.MachineEnvironment[osenv.JujuProviderType] = provider.Null
10 cloudcfg := corecloudinit.New()
11 if cloudcfg, err = cloudinit.Configure(mcfg, cloudcfg); err != nil {
12 return "", err
13
14=== modified file 'environs/manual/provisioner.go'
15--- environs/manual/provisioner.go 2013-08-29 03:58:19 +0000
16+++ environs/manual/provisioner.go 2013-09-03 01:56:59 +0000
17@@ -53,6 +53,7 @@
18 func ProvisionMachine(args ProvisionMachineArgs) (m *state.Machine, err error) {
19 defer func() {
20 if m != nil && err != nil {
21+ logger.Errorf("provisioning failed, removing machine %v: %v", m, err)
22 m.EnsureDead()
23 m.Remove()
24 m = nil
25@@ -155,6 +156,7 @@
26 func injectMachine(args injectMachineArgs) (m *state.Machine, err error) {
27 defer func() {
28 if m != nil && err != nil {
29+ logger.Errorf("injecting into state failed, removing machine %v: %v", m, err)
30 m.EnsureDead()
31 m.Remove()
32 }
33
34=== modified file 'provider/provider.go'
35--- provider/provider.go 2013-08-30 01:48:39 +0000
36+++ provider/provider.go 2013-09-03 01:56:59 +0000
37@@ -12,5 +12,5 @@
38 MAAS = "maas"
39 Azure = "azure"
40 OpenStack = "openstack"
41- Manual = "manual"
42+ Null = "null"
43 )

Subscribers

People subscribed via source and target branches

to status/vote changes: