Skip to content

Commit 791fd03

Browse files
authored
table has truncated version (#10)
* remove whitespaces * use tablefmt="pipe" in query
1 parent 4579ba5 commit 791fd03

File tree

4 files changed

+146
-146
lines changed

4 files changed

+146
-146
lines changed

glrd/manage.py

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -268,9 +268,9 @@ def cleanup_temp_repo():
268268

269269
def glrd_query_type(args, release_type):
270270
"""Retrieve releases of a specific type."""
271-
releases = load_all_releases(release_type, DEFAULTS['QUERY_INPUT_TYPE'],
272-
DEFAULTS['QUERY_INPUT_URL'],
273-
DEFAULTS['QUERY_INPUT_FILE_PREFIX'],
271+
releases = load_all_releases(release_type, DEFAULTS['QUERY_INPUT_TYPE'],
272+
DEFAULTS['QUERY_INPUT_URL'],
273+
DEFAULTS['QUERY_INPUT_FILE_PREFIX'],
274274
DEFAULTS['QUERY_INPUT_FORMAT'])
275275
if not releases:
276276
logging.error(f"Error retrieving releases: {result.stderr}")
@@ -471,7 +471,7 @@ def create_initial_nightly_releases(stable_releases):
471471

472472
# Set the default start date to 2020-06-09 06:00 UTC
473473
start_date_default = datetime(2020, 6, 9, 6, 0, 0, tzinfo=pytz.UTC)
474-
474+
475475
if stable_releases:
476476
# Get the earliest stable release timestamp
477477
first_stable_release = min(stable_releases, key=lambda r: r['lifecycle']['released']['timestamp'])
@@ -620,9 +620,9 @@ def create_single_release(release_type, args, existing_releases):
620620

621621
if artifacts_data:
622622
flavors = parse_flavors_commit(
623-
commit,
624-
version=version,
625-
query_s3=True,
623+
commit,
624+
version=version,
625+
query_s3=True,
626626
s3_objects=artifacts_data,
627627
logger=logging.getLogger()
628628
)
@@ -650,7 +650,7 @@ def create_single_release(release_type, args, existing_releases):
650650
release['git']['commit_short'] = commit_short
651651
release['flavors'] = flavors
652652
release['attributes'] = {}
653-
release['attributes']['source_repo'] = True
653+
release['attributes']['source_repo'] = True
654654
elif release_type == "next":
655655
release['name'] = f"{release_type}"
656656
release['lifecycle']['extended'] = {}
@@ -680,7 +680,7 @@ def create_single_release(release_type, args, existing_releases):
680680
release['github']['release'] = f"https://github.com/gardenlinux/gardenlinux/releases/tag/{major}.{minor}"
681681
release['flavors'] = flavors
682682
release['attributes'] = {}
683-
release['attributes']['source_repo'] = True
683+
release['attributes']['source_repo'] = True
684684

685685
logging.debug(f"Release '{release['name']}' created.")
686686
return release
@@ -1038,14 +1038,14 @@ def merge_existing_s3_data(bucket_name, bucket_key, local_file, new_data):
10381038
def download_all_s3_files(bucket_name, bucket_prefix):
10391039
"""Download all release files from S3 bucket."""
10401040
s3_client = get_s3_client()
1041-
1041+
10421042
try:
10431043
# List all objects in the bucket with the given prefix
10441044
paginator = s3_client.get_paginator('list_objects_v2')
10451045
found_files = False
1046-
1046+
10471047
logging.info(f"Looking for files in s3://{bucket_name}/{bucket_prefix}")
1048-
1048+
10491049
for page in paginator.paginate(Bucket=bucket_name, Prefix=bucket_prefix):
10501050
if 'Contents' in page:
10511051
found_files = True
@@ -1054,21 +1054,21 @@ def download_all_s3_files(bucket_name, bucket_prefix):
10541054
if key.endswith('.json'):
10551055
local_file = os.path.basename(key)
10561056
download_from_s3(bucket_name, key, local_file)
1057-
1057+
10581058
if not found_files:
10591059
logging.warning(f"No release files found in s3://{bucket_name}/{bucket_prefix}")
10601060
# Create empty files for each release type
10611061
for release_type in DEFAULTS['RELEASE_TYPES']:
10621062
filename = f"releases-{release_type}.json"
10631063
save_output_file({'releases': []}, filename, 'json')
1064-
1064+
10651065
except Exception as e:
10661066
logging.error(f"Error downloading files from S3: {e}")
10671067

10681068
def upload_all_local_files(bucket_name, bucket_prefix):
10691069
"""Upload all local release files to S3."""
10701070
s3_client = boto3.client('s3')
1071-
1071+
10721072
try:
10731073
# First find all matching local files
10741074
matching_files = []
@@ -1077,22 +1077,22 @@ def upload_all_local_files(bucket_name, bucket_prefix):
10771077
filename = f"releases-{release_type}.json"
10781078
if fnmatch.fnmatch(file, filename):
10791079
matching_files.append(file)
1080-
1080+
10811081
if not matching_files:
10821082
logging.warning(f"No release files found to upload")
10831083
return
1084-
1084+
10851085
# Show what will be uploaded and ask for confirmation
10861086
print("\nThe following files will be uploaded to S3:")
10871087
for file in matching_files:
10881088
bucket_key = f"{bucket_prefix}{file}"
10891089
print(f" {file} -> s3://{bucket_name}/{bucket_key}")
1090-
1090+
10911091
response = input("\nDo you really want to upload these files to S3? [y/N] ").lower()
10921092
if response != 'y':
10931093
print("Upload cancelled.")
10941094
return
1095-
1095+
10961096
# Proceed with upload
10971097
files_uploaded = 0
10981098
for file in matching_files:
@@ -1102,9 +1102,9 @@ def upload_all_local_files(bucket_name, bucket_prefix):
11021102
files_uploaded += 1
11031103
except Exception as e:
11041104
logging.error(f"Error uploading {file}: {e}")
1105-
1105+
11061106
logging.info(f"Successfully uploaded {files_uploaded} release files")
1107-
1107+
11081108
except Exception as e:
11091109
logging.error(f"Error accessing S3: {e}")
11101110
sys.exit(ERROR_CODES["s3_error"])
@@ -1114,7 +1114,7 @@ def handle_releases(args):
11141114
if args.input_all:
11151115
upload_all_local_files(args.s3_bucket_name, args.s3_bucket_prefix)
11161116
return
1117-
1117+
11181118
if args.output_all:
11191119
download_all_s3_files(args.s3_bucket_name, args.s3_bucket_prefix)
11201120
return
@@ -1124,7 +1124,7 @@ def handle_releases(args):
11241124

11251125
create_initial_stable, create_initial_patch, create_initial_nightly = False, False, False
11261126
next_releases, stable_releases, patch_releases, nightly_releases, dev_releases = [], [], [], [], []
1127-
1127+
11281128
if args.create_initial_releases:
11291129
create_initial_list = args.create_initial_releases.split(',')
11301130
create_initial_stable = 'stable' in create_initial_list
@@ -1282,34 +1282,34 @@ def handle_output(args, bucket_name, bucket_prefix, releases):
12821282

12831283
def parse_arguments():
12841284
parser = argparse.ArgumentParser(description="Manage Garden Linux releases data.")
1285-
1286-
parser.add_argument('--log-level', type=str,
1285+
1286+
parser.add_argument('--log-level', type=str,
12871287
choices=['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL'],
12881288
default='INFO', help="Set the logging level")
1289-
1289+
12901290
parser.add_argument('--input-file', type=str, default=DEFAULTS['MANAGE_INPUT_FILE'],
12911291
help="The name of the input file (default: releases-input.yaml).")
1292-
1292+
12931293
parser.add_argument('--output-format', type=str, choices=['yaml', 'json'],
12941294
default=DEFAULTS['MANAGE_OUTPUT_FORMAT'],
12951295
help="Output format: yaml or json (default: yaml).")
1296-
1296+
12971297
parser.add_argument('--output-file-prefix', type=str,
12981298
default=DEFAULTS['MANAGE_OUTPUT_FILE_PREFIX'],
12991299
help="The prefix for output files (default: releases).")
1300-
1300+
13011301
parser.add_argument('--s3-bucket-name', type=str,
13021302
default=DEFAULTS['GLRD_S3_BUCKET_NAME'],
13031303
help="Name of S3 bucket. Defaults to 'gardenlinux-glrd'.")
1304-
1304+
13051305
parser.add_argument('--s3-bucket-region', type=str,
13061306
default=DEFAULTS['GLRD_S3_BUCKET_REGION'],
13071307
help="Region for S3 bucket. Defaults to 'eu-central-1'.")
1308-
1308+
13091309
parser.add_argument('--s3-bucket-prefix', type=str,
13101310
default=DEFAULTS['GLRD_S3_BUCKET_PREFIX'],
13111311
help="Prefix for S3 bucket objects. Defaults to empty string.")
1312-
1312+
13131313
parser.add_argument('--delete', type=str, help="Delete a release by name (format: type-major.minor). Requires --s3-update.")
13141314
parser.add_argument('--create-initial-releases', type=str, help="Comma-separated list of initial releases to retrieve and generate: 'stable,patch,nightly'.")
13151315
parser.add_argument('--create', type=str, help="Create a release for this type using the current timestamp and git information (choose one of: stable,patch,nightly,dev,next)'.")
@@ -1324,7 +1324,7 @@ def parse_arguments():
13241324
parser.add_argument('--no-output-split', action='store_true', help="Do not split Output into stable+patch and nightly. Additional output-files *-nightly and *-dev will not be created.")
13251325
parser.add_argument('--s3-create-bucket', action='store_true', help="Create an S3 bucket.")
13261326
parser.add_argument('--s3-update', action='store_true', help="Update (merge) the generated files with S3.")
1327-
parser.add_argument('--output-all', action='store_true',
1327+
parser.add_argument('--output-all', action='store_true',
13281328
help="Download and write all release files found in S3 to local disk")
13291329
parser.add_argument('--input-all', action='store_true',
13301330
help="Upload all local release files to S3")

0 commit comments

Comments
 (0)