mirror of
https://github.com/ipxe/ipxe
synced 2026-01-22 03:32:59 +03:00
[cloud] Use a sortable default AMI name
The AWS console user interface provides no convenient way to sort AMIs by creation date. Provide a default AMI name constructed from the current date and CPU architecture, to simplify the task of finding the most recent iPXE AMI in a given AWS region. Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
@@ -3,6 +3,7 @@
|
|||||||
import argparse
|
import argparse
|
||||||
from base64 import b64encode
|
from base64 import b64encode
|
||||||
from concurrent.futures import ThreadPoolExecutor, as_completed
|
from concurrent.futures import ThreadPoolExecutor, as_completed
|
||||||
|
from datetime import date
|
||||||
from hashlib import sha256
|
from hashlib import sha256
|
||||||
from itertools import count
|
from itertools import count
|
||||||
|
|
||||||
@@ -75,7 +76,7 @@ def launch_link(region, image_id):
|
|||||||
parser = argparse.ArgumentParser(description="Import AWS EC2 image (AMI)")
|
parser = argparse.ArgumentParser(description="Import AWS EC2 image (AMI)")
|
||||||
parser.add_argument('--architecture', '-a', default='x86_64',
|
parser.add_argument('--architecture', '-a', default='x86_64',
|
||||||
help="CPU architecture")
|
help="CPU architecture")
|
||||||
parser.add_argument('--name', '-n', required=True,
|
parser.add_argument('--name', '-n',
|
||||||
help="Image name")
|
help="Image name")
|
||||||
parser.add_argument('--public', '-p', action='store_true',
|
parser.add_argument('--public', '-p', action='store_true',
|
||||||
help="Make image public")
|
help="Make image public")
|
||||||
@@ -86,6 +87,13 @@ parser.add_argument('--wiki', '-w', metavar='FILE',
|
|||||||
parser.add_argument('image', help="iPXE disk image")
|
parser.add_argument('image', help="iPXE disk image")
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
# Use default name if none specified
|
||||||
|
if not args.name:
|
||||||
|
args.name = 'iPXE (%s %s)' % (
|
||||||
|
date.today().strftime('%Y-%m-%d'),
|
||||||
|
args.architecture,
|
||||||
|
)
|
||||||
|
|
||||||
# Use all regions if none specified
|
# Use all regions if none specified
|
||||||
if not args.region:
|
if not args.region:
|
||||||
args.region = sorted(x['RegionName'] for x in
|
args.region = sorted(x['RegionName'] for x in
|
||||||
|
|||||||
Reference in New Issue
Block a user