Skip to content

Commit 7c51640

Browse files
authored
Merge pull request #45 from HPCNow:main
Added more tests on froster config command
2 parents 471a17c + b86c7d7 commit 7c51640

File tree

4 files changed

+271
-98
lines changed

4 files changed

+271
-98
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ celerybeat.pid
109109

110110
# Environments
111111
.env
112-
.venv
112+
.venv*
113113
env/
114114
venv/
115115
ENV/

froster/froster.py

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,18 @@
66
"""
77

88
# internal modules
9+
from textual.widgets import DataTable, Footer, Button
10+
from textual.widgets import Label, Input, LoadingIndicator
11+
from textual.screen import ModalScreen
12+
from textual.containers import Horizontal, Vertical
13+
from textual.app import App, ComposeResult
14+
from textual import on, work
15+
import psutil
16+
import botocore
17+
import boto3
18+
import duckdb
19+
import requests
20+
import inquirer
921
import sys
1022
import os
1123
import argparse
@@ -50,19 +62,6 @@
5062
warnings.filterwarnings("ignore", category=ResourceWarning)
5163

5264
# stuff from pypi
53-
import inquirer
54-
import requests
55-
import duckdb
56-
import boto3
57-
import botocore
58-
import psutil
59-
60-
from textual import on, work
61-
from textual.app import App, ComposeResult
62-
from textual.containers import Horizontal, Vertical
63-
from textual.screen import ModalScreen
64-
from textual.widgets import Label, Input, LoadingIndicator
65-
from textual.widgets import DataTable, Footer, Button
6665

6766

6867
class ConfigManager:
@@ -586,7 +585,8 @@ def set_aws(self, aws: 'AWSBoto'):
586585
print(' ...region is valid\n')
587586
else:
588587
print(' ...region is NOT valid\n')
589-
print('\nYou can configure aws credentials and region using the command:')
588+
print(
589+
'\nYou can configure aws credentials and region using the command:')
590590
print(' froster config --aws\n')
591591
return False
592592

@@ -634,7 +634,7 @@ def set_aws(self, aws: 'AWSBoto'):
634634
print(
635635
'\nYou can configure aws credentials and region using the command:')
636636
print(' froster config --aws\n')
637-
637+
638638
return False
639639

640640
if region != aws_profile_region:
@@ -857,7 +857,7 @@ def set_s3(self, aws: "AWSBoto"):
857857

858858
print(
859859
f'Checking AWS credentials for profile "{self.aws_profile}"...')
860-
if aws.check_credentials():
860+
if aws.check_credentials(aws_profile=self.aws_profile):
861861
print(' ...AWS credentials are valid\n')
862862
else:
863863
print(' ...AWS credentials are NOT valid\n')
@@ -893,7 +893,8 @@ def set_s3(self, aws: "AWSBoto"):
893893
return False
894894

895895
# Create new bucket
896-
aws.create_bucket(bucket_name=new_bucket_name)
896+
aws.create_bucket(bucket_name=new_bucket_name,
897+
region=self.aws_region)
897898

898899
# Store new aws s3 bucket in the config object
899900
self.__set_configuration_entry(
@@ -904,7 +905,7 @@ def set_s3(self, aws: "AWSBoto"):
904905

905906
# Get the archive directory in the selected bucket
906907
archive_dir = inquirer.text(
907-
message='Enter the archive directory name inside your S3 bucket',
908+
message='Enter the directory name inside S3 bucket (default= "froster")',
908909
default='froster',
909910
validate=self.__inquirer_check_required)
910911

@@ -1014,7 +1015,7 @@ def __set_shared_move_config(self):
10141015
# If shared configuration file exists, nothing to move
10151016
if hasattr(self, 'shared_config_file') and os.path.isfile(self.shared_config_file):
10161017
print(
1017-
f"\nNOTE: Using shared configuration file found in {self.shared_config_file}\n")
1018+
f"NOTE: Using shared configuration file found in {self.shared_config_file}\n")
10181019
return
10191020

10201021
# Clean up both configuration files
@@ -1160,7 +1161,7 @@ def set_slurm(self, args):
11601161
print(f'\n*** SLURM NOT FOUND: Nothing to configure ***\n')
11611162

11621163
return True
1163-
1164+
11641165
except:
11651166
print_error()
11661167
return False
@@ -1275,7 +1276,8 @@ def check_credentials(self,
12751276

12761277
elif aws_profile:
12771278
# Build a new STS client with the provided profile
1278-
sts = boto3.Session(profile_name=aws_profile, region_name=aws_region_name).client('sts')
1279+
sts = boto3.Session(profile_name=aws_profile,
1280+
region_name=aws_region_name).client('sts')
12791281

12801282
elif hasattr(self, 's3_client'):
12811283
# Get the current sts_client
@@ -6103,11 +6105,10 @@ def subcmd_config(args, cfg: ConfigManager, aws: AWSBoto):
61036105
Shared configuration: {cfg.shared_config_file}
61046106
61056107
You can overwrite specific configuration sections. Check options using the command:
6106-
froster config --help\n
6108+
froster config --help
61076109
'''))
61086110
return
61096111

6110-
61116112
if not cfg.set_nih():
61126113
return
61136114

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
setup(
1111
name='froster',
12-
version='0.10.5',
12+
version='0.10.6',
1313
license='MIT',
1414
packages=find_packages(),
1515
install_requires=requirements,

0 commit comments

Comments
 (0)