Skip to content

Commit

Permalink
Added support for {tstamp} placeholder.
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabrizio Branca committed May 31, 2016
1 parent 953ffa3 commit a092e9e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion ami-baker/function/ami_baker.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ exports.handler = function (event, context) {
tagPrefix = 'cfn:',
accounts = p.AdditionalAwsAccounts || [];


amiName = amiName.replace('{tstamp}', Math.floor(Date.now() / 1000));
console.log('AMI name: ' + amiName);

if (event.RequestType == "Delete") {
async.waterfall([

Expand Down Expand Up @@ -149,8 +153,9 @@ exports.handler = function (event, context) {
callback(err, err.stack);
} else {
var SnapshotId;
console.log(data.Snapshots.length);
console.log('Total number of snapshots found: ' + data.Snapshots.length);
data.Snapshots.forEach(function(snapshot) {
// console.log(snapshot.Description);
if (snapshot.Description.match(new RegExp("Created by CreateImage.*for " + ImageId + " from .*"))) {
SnapshotId = snapshot.SnapshotId;
console.log("Found snapshot: " + SnapshotId);
Expand Down

0 comments on commit a092e9e

Please sign in to comment.