Add switches to override default s3 variables

This commit is contained in:
Louis Abel 2023-04-05 14:10:54 -07:00
parent 7fbf226e43
commit 44947ef406
Signed by untrusted user: label
GPG Key ID: B37E62D143879B36
4 changed files with 69 additions and 3 deletions

View File

@ -13,6 +13,9 @@ parser.add_argument('--s3', action='store_true', help="S3")
parser.add_argument('--arch', type=str, help="Architecture")
parser.add_argument('--local-compose', action='store_true', help="Compose Directory is Here")
parser.add_argument('--force-download', action='store_true', help="Force a download")
parser.add_argument('--s3-region', type=str, help="S3 region (overrides defaults)")
parser.add_argument('--s3-bucket', type=str, help="S3 bucket name (overrides defaults)")
parser.add_argument('--s3-bucket-url', type=str, help="S3 bucket url (overrides defaults)")
parser.add_argument('--logger', type=str)
results = parser.parse_args()
rlvars = rldict[results.release]
@ -26,6 +29,9 @@ a = IsoBuild(
arch=results.arch,
force_download=results.force_download,
compose_dir_is_here=results.local_compose,
s3_region=result.s3_region,
s3_bucket=result.s3_bucket,
s3_bucket_url=result.s3_bucket_url,
logger=results.logger,
)

View File

@ -0,0 +1,40 @@
# builds ISO's
import argparse
from empanadas.common import *
from empanadas.util import Checks
from empanadas.util import IsoBuild
parser = argparse.ArgumentParser(description="ISO Artifact Builder")
parser.add_argument('--release', type=str, help="Major Release Version", required=True)
parser.add_argument('--s3', action='store_true', help="S3")
parser.add_argument('--arch', type=str, help="Architecture")
parser.add_argument('--local-compose', action='store_true', help="Compose Directory is Here")
parser.add_argument('--force-download', action='store_true', help="Force a download")
parser.add_argument('--s3-region', type=str, help="S3 region (overrides defaults)")
parser.add_argument('--s3-bucket', type=str, help="S3 bucket name (overrides defaults)")
parser.add_argument('--s3-bucket-url', type=str, help="S3 bucket url (overrides defaults)")
parser.add_argument('--logger', type=str)
results = parser.parse_args()
rlvars = rldict[results.release]
major = rlvars['major']
a = IsoBuild(
rlvars,
config,
major=major,
s3=results.s3,
arch=results.arch,
force_download=results.force_download,
compose_dir_is_here=results.local_compose,
s3_region=result.s3_region,
s3_bucket=result.s3_bucket,
s3_bucket_url=result.s3_bucket_url,
logger=results.logger,
)
def run():
#a.run_pull_iso_images()
print('currently not supported')

View File

@ -15,6 +15,9 @@ parser.add_argument('--arch', type=str, help="Architecture")
parser.add_argument('--local-compose', action='store_true', help="Compose Directory is Here")
parser.add_argument('--force-unpack', action='store_true', help="Force an unpack")
parser.add_argument('--force-download', action='store_true', help="Force a download")
parser.add_argument('--s3-region', type=str, help="S3 region (overrides defaults)")
parser.add_argument('--s3-bucket', type=str, help="S3 bucket name (overrides defaults)")
parser.add_argument('--s3-bucket-url', type=str, help="S3 bucket url (overrides defaults)")
parser.add_argument('--logger', type=str)
results = parser.parse_args()
rlvars = rldict[results.release]
@ -30,6 +33,9 @@ a = IsoBuild(
force_unpack=results.force_unpack,
force_download=results.force_download,
compose_dir_is_here=results.local_compose,
s3_region=result.s3_region,
s3_bucket=result.s3_bucket,
s3_bucket_url=result.s3_bucket_url,
logger=results.logger,
)

View File

@ -64,6 +64,9 @@ class IsoBuild:
updated_image: bool = False,
image_increment: str = '0',
image=None,
s3_region=None,
s3_bucket=None,
s3_bucket_url=None,
logger=None
):
self.image = image
@ -121,9 +124,20 @@ class IsoBuild:
self.container = rlvars['container']
# all bucket related info
self.s3_region = config['aws_region']
self.s3_bucket = config['bucket']
self.s3_bucket_url = config['bucket_url']
if s3_region:
self.s3_region = s3_region
else:
self.s3_region = config['aws_region']
if s3_bucket:
self.s3_bucket = s3_bucket
else:
self.s3_bucket = config['bucket']
if s3_bucket_url:
self.s3_bucket_url = s3_bucket_url
else:
self.s3_bucket_url = config['bucket_url']
#if s3:
# self.s3 = boto3.client('s3')