← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1449318] [NEW] power_state does not take effect when runcmd errors

 

Public bug reported:

When the runcmd errors the power-state-change does not take effect and
the instance is not powered off.


AMI ID: ubuntu-vivid-15.04-amd64-server-20150422 (ami-2d10241d)

Instance launched on EC2 using awscli:

$ aws --region us-west-2 ec2 run-instances --image-id ami-2d10241d
--instance-type t2.medium --security-groups ssh-http-https --user-data
file://fail.cfg

Minimal fail.cfg cloud config:
```
#cloud-config
power_state:
  mode: poweroff

runcmd:
- set -e
- python3 -c "raise Exception"
```

Longer fail.cfg used for retrieving logs:
```
#cloud-config
output:
  all: '| tee -a /var/log/cloud-init-output.log'

power_state:
  mode: poweroff

bootcmd:
- cloud-init-per once ssh-users-ca echo "TrustedUserCAKeys /etc/ssh/users_ca.pub" >> /etc/ssh/sshd_config

runcmd:
- set -e
- python3 -c "raise Exception"

write_files:
- path: /etc/ssh/users_ca.pub
  content: <my ssh ca key>
```

** Affects: cloud-init
     Importance: Undecided
         Status: New

** Attachment added: "cloud-init.log and cloud-init-output.log"
   https://bugs.launchpad.net/bugs/1449318/+attachment/4386159/+files/cloud-init.log

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to cloud-init.
https://bugs.launchpad.net/bugs/1449318

Title:
  power_state does not take effect when runcmd errors

Status in Init scripts for use on cloud images:
  New

Bug description:
  When the runcmd errors the power-state-change does not take effect and
  the instance is not powered off.

  
  AMI ID: ubuntu-vivid-15.04-amd64-server-20150422 (ami-2d10241d)

  Instance launched on EC2 using awscli:

  $ aws --region us-west-2 ec2 run-instances --image-id ami-2d10241d
  --instance-type t2.medium --security-groups ssh-http-https --user-data
  file://fail.cfg

  Minimal fail.cfg cloud config:
  ```
  #cloud-config
  power_state:
    mode: poweroff

  runcmd:
  - set -e
  - python3 -c "raise Exception"
  ```

  Longer fail.cfg used for retrieving logs:
  ```
  #cloud-config
  output:
    all: '| tee -a /var/log/cloud-init-output.log'

  power_state:
    mode: poweroff

  bootcmd:
  - cloud-init-per once ssh-users-ca echo "TrustedUserCAKeys /etc/ssh/users_ca.pub" >> /etc/ssh/sshd_config

  runcmd:
  - set -e
  - python3 -c "raise Exception"

  write_files:
  - path: /etc/ssh/users_ca.pub
    content: <my ssh ca key>
  ```

To manage notifications about this bug go to:
https://bugs.launchpad.net/cloud-init/+bug/1449318/+subscriptions


Follow ups

References