Closed aig787 closed 7 years ago
@aig787 i'm not able to replicate this. Can you share a sanitized version of your profile/provider?
also whats the command you are runnign when you see this?
The command I'm running is salt-cloud -m build/etc/salt/test-cloud.map -c build/etc/salt -l debug -y -P
. I am running this on macOS if that makes a difference.
Sanitized profile:
salt-master:
provider: ec2
image: ami-d2c924b2
iam_profile: REDACTED
size: t2.micro
ssh_interface: public_ips
minion:
environment: qa
master:
file_roots:
qa:
- /srv/salt
pillar_roots:
qa:
- /srv/pillar/qa
ext_pillar:
- file_tree:
root_dir: /srv/pillar
location: us-west-2
availability_zone: us-west-2c
ssh_username: centos
tag: {'service': 'salt'}
subnetid: REDACTED
del_root_vol_on_destroy: True
securitygroupid:
- REDACTED
Sanitized provider:
ec2:
driver: ec2
ssh_interface: private_ips
keyname: REDACTED
private_key: REDACTED
securitygroupid: REDACTED
id: REDACTED
key: REDACTED
location: us-west-2
@aig787 i'm still not able to replicate this. I wonder if its related to the drives attached to that ami.
Can you add the following and paste here with it sanitized:
# Use default volume type if not specified
+ log.debug('blockdevicemappings are the following: {0}'.format(ex_blockdevicemappings))
+ log.debug('dev_index is the following:'.format(dev_index))
if ex_blockdevicemappings and 'Ebs.VolumeType' not in ex_blockdevicemappings[dev_index]:
type_key = '{0}BlockDeviceMapping.{1}.Ebs.VolumeType'.format(spot_prefix, dev_index)
params[type_key] = rd_type
I'm curious what values you are getting there.
Adding those lines I now get this output
[INFO ] Found root device name: /dev/sda1
[DEBUG ] blockdevicemappings are the following: None
[DEBUG ] dev_index is the following:
[DEBUG ] MasterEvent PUB socket URI: /var/run/salt/master/master_event_pub.ipc
[DEBUG ] MasterEvent PULL socket URI: /var/run/salt/master/master_event_pull.ipc
Just ran into this. My cloud profile entry:
ec2.oregon.medium:
del_all_vol_on_destroy: true
del_root_vol_on_destroy: true
image: ami-d2c924b2
network_interfaces:
- DeviceIndex: 0
SecurityGroupId:
- sg-foobar
SubnetId: subnet-foobar
provider: ec2-or
size: m3.medium
ssh_username: centos
sync_after_install: grains
My cloud map entry:
ec2.oregon.medium:
- web03.or.company.internal:
grains:
branch: master
datacenter: or.company.internal
role:
- prod
- web
salt_managed: true
minion:
master: salt01.or.company.internal
network_interfaces:
- AssociatePublicIpAddress: false
DeviceIndex: 0
SecurityGroupId:
- sg-foobar
SubnetId: subnet-foobar
salt_interface: private_ips
block_device_mappings:
- DeviceName: /dev/sda1
Ebs.VolumeSize: 30
Removing del_root_vol_on_destroy from the profile allowed salt to build the instance, I was able to keep del_all_vol_on_destroy.
@aig787 thnaks for adding those logs. I don't quit understand why you are hitting that indexerror if ex_blockdevicemappings
is None, so we will need to get an engineer on this issue. Thanks for all your help on this one.
Also thanks @tedohayer for the profile information. We will definitely need to get htis fixed.
@aig787 I have been looking at this today and I am unable to reproduce this either. Would you mind trying this again with those same debug lines that @Ch3LL asked you about above, and then adding a couple of additional type check debug lines? I am wondering if somehow the ex_blockdevicemappings
value is getting set to a 'None'
string and that's how it's getting past the if ex_blockdevicemappings
check.
I also noticed that the first time we had these debug lines in there, we were missing the {0}
from the string format. So that's why nothing printed on that second debug statement after the :
. I'm curious what index is listed there as well.
# Use default volume type if not specified
+ log.debug('blockdevicemappings are the following: {0}'.format(ex_blockdevicemappings))
+ log.debug('blockdevcemappings type: {0}'.format(type(ex_blockdevicemappings)))
+ log.debug('dev_index is the following: {0}'.format(dev_index))
+ log.debug('dev_index type: {0}'.format(type(dev_index)))
if ex_blockdevicemappings and 'Ebs.VolumeType' not in ex_blockdevicemappings[dev_index]:
type_key = '{0}BlockDeviceMapping.{1}.Ebs.VolumeType'.format(spot_prefix, dev_index)
params[type_key] = rd_type
Description of Issue/Question
Using a profile that has del_root_vol_on_destroy: True gives
Setup
(Please provide relevant configs and/or SLS files (Be sure to remove sensitive info).)
Steps to Reproduce Issue
(Include debug logs if possible and relevant.)
Versions Report
(Provided by running
salt --versions-report
. Please also mention any differences in master/minion versions.)