Skip to content

Commit 47061b7

Browse files
committed
fixing incorrect library names and missing args
1 parent c7bae60 commit 47061b7

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

awth/__init__.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# import 1password
22

33
# all aws (apple with sauce)
4-
from awsmfa.config import initial_setup
5-
from awsmfa.util import log_error_and_exit, prompter
4+
from awth.config import initial_setup
5+
from awth.util import log_error_and_exit, prompter
66
import boto3
77
from botocore.exceptions import ClientError, ParamValidationError
88

@@ -22,8 +22,7 @@
2222
import sys
2323

2424
logger = logging.getLogger('awth')
25-
# AWS_CREDS_PATH = f'{path.expanduser('~')}/.aws/credentials'
26-
AWS_CREDS_PATH = path.expanduser(os.environ.get('AWS_SHARED_CREDENTIALS_FILE', '~/.aws/credentials'))
25+
AWS_CREDS_PATH = path.expanduser(environ.get('AWS_SHARED_CREDENTIALS_FILE', '~/.aws/credentials'))
2726

2827

2928
def setup_logger(level=logging.DEBUG):
@@ -83,24 +82,23 @@ def setup_logger(level=logging.DEBUG):
8382
help="Refresh credentials even if currently valid.",
8483
required=False)
8584
@click.option('--log-level',
86-
type=click.choice(['CRITICAL', 'ERROR', 'WARNING', 'INFO', 'DEBUG', 'NOTSET'], case_sensitive=False),
85+
type=click.Choice(['CRITICAL', 'ERROR', 'WARNING', 'INFO', 'DEBUG', 'NOTSET'], case_sensitive=False),
8786
help="Set log level",
8887
required=False,
8988
default='DEBUG')
9089
@click.option('--setup',
9190
help="Setup a new log term credentials section",
9291
is_flag=bool,
9392
required=False)
94-
@click.option('--token', '--mfa-token',
93+
@click.option('--token',
9594
help="Provide MFA token as an argument",
96-
required=False)
97-
default=None)
95+
required=False,
96+
default=None)
9897
@click.option('--region',
9998
help="AWS STS Region",
10099
required=False,
101100
type=str)
102101
@click.option('--keychain',
103-
action="store_true",
104102
is_flag=bool,
105103
help="Use system keychain to store or retrieve long term credentials",
106104
required=False)
@@ -109,12 +107,13 @@ def main(device: str,
109107
profile: str,
110108
long_term_suffix: str,
111109
short_term_suffix: str,
112-
role: str,
110+
assume_role: str,
113111
role_session_name: str,
114112
force: bool,
115113
log_level: str,
116114
setup: bool,
117-
token: str,
115+
token: str = "",
116+
region: str = "eu-central-1",
118117
keychain: bool = False):
119118

120119
# set up logging before we begin
@@ -161,15 +160,16 @@ def get_config(aws_creds_path: str = ""):
161160
return config
162161

163162

164-
def validate(profile: str = "",
163+
def validate(config,
164+
profile: str = "",
165165
long_term_suffix: str = "",
166166
short_term_suffix: str = "",
167167
assume_role: bool = False,
168168
keychain: bool = False,
169169
device: str = "",
170170
duration: int = 0,
171-
force: bool = False,
172-
config):
171+
force: bool = False
172+
):
173173
"""
174174
validate all the options
175175
"""
@@ -341,7 +341,7 @@ def validate(profile: str = "",
341341
assume_role,
342342
short_term_suffix,
343343
role_session_name,
344-
region_name,
344+
region,
345345
config)
346346

347347

@@ -354,7 +354,7 @@ def get_credentials(short_term_name,
354354
assume_role,
355355
short_term_suffix,
356356
role_session_name,
357-
region_name,
357+
region,
358358
config):
359359
"""
360360
Get credentials from AWS?

awth/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from awsmfa.util import log_error_and_exit, prompter
1+
from awth.util import log_error_and_exit, prompter
22

33
try:
44
import configparser

0 commit comments

Comments
 (0)