EC2 data source does not properly return the instance ID when cached data exists
Bug #1883907 reported by
Robert Schweikert
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
cloud-init |
Invalid
|
Undecided
|
Unassigned |
Bug Description
When creating an AMI from a running instance without cleaning the cloud-init cache an instance from the new AMI is no properly identified as a new instance and none of the PER_INSTANCE tasks will be executed.
The problem is that the Ec2 data source will return the cached instance-id rather than the new instance ID.
To post a comment you must log in.
The data source gets pickeled to /var/lib/ cloud/instance/ obj.pkl and the information in this pickled object is read and taken at face value, i.e. the pickeled object has the instance data from the "donor" instance built in. Therefore anything that accesses data that is extracted from "self.identity" is incorrect in the new instance.
It appears as if the identity member of the object has to be set anew every time we run through the code. It appears that the idea was to save a call to the metadata server. However there is no other way to validate the cache, a call to the metadata server for at least the IID is necessary to validate if we are still on the same instance.