Use empty string for name if there are no tags

This commit is contained in:
John Shaughnessy 2021-07-20 07:23:23 -07:00
Родитель df0d01979f
Коммит c2b2d8a045
1 изменённых файлов: 13 добавлений и 3 удалений

Просмотреть файл

@ -88,13 +88,15 @@ async function ec2_describe_instances({ region }) {
PublicIpAddress, PublicIpAddress,
Tags, Tags,
}) { }) {
const NameTags = Tags.filter(function ({ Key }) {
return Key === "Name";
});
const Name = (NameTags.length && NameTags[0].Value) || "";
instances.push({ instances.push({
InstanceId, InstanceId,
PrivateIpAddress, PrivateIpAddress,
PublicIpAddress, PublicIpAddress,
Name: Tags.filter(function ({ Key }) { Name,
return Key === "Name";
})[0].Value,
}); });
}); });
}); });
@ -426,6 +428,14 @@ const allow_list = [
"hubs.chat.", "hubs.chat.",
"hubs.wtf.", "hubs.wtf.",
"hubs.fun.", "hubs.fun.",
"svtesthub.com.",
"svtesthub.link.",
"svtesthub2.com.",
"svtesthub2.link.",
"svtesthub3.com.",
"svtesthub3.link.",
"svtesthub4.com.",
"svtesthub4.link.",
]; ];
function filter_by_allow_list({ hosted_zones, allow_list }) { function filter_by_allow_list({ hosted_zones, allow_list }) {