From ff2e1e0a5e4a068a1bf76bc522d1ecfea790e243 Mon Sep 17 00:00:00 2001 From: Mike Schiessl Date: Thu, 10 Jun 2021 11:11:08 +0200 Subject: [PATCH] fixed a bug in edgerc handling (left ~ unhandled if --edgerc flag was used) --- bin/akamai-mfa | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/akamai-mfa b/bin/akamai-mfa index 6d37471..9e7b120 100755 --- a/bin/akamai-mfa +++ b/bin/akamai-mfa @@ -86,7 +86,7 @@ class MFAConfig(): eventparser.add_argument("--noreceipt", default=False, action="store_true", help="Discard the receipt attribute to save log space") - self.parser.add_argument("--edgerc", type=argparse.FileType('r'), default=os.path.expanduser("~/.edgerc"), + self.parser.add_argument("--edgerc", type=argparse.FileType('r'), default="~/.edgerc", help='Location of the credentials file (default is %s)' % os.path.expanduser("~/.edgerc")) self.parser.add_argument("--section", default="default", help="Section inside .edgerc, default is [default]") @@ -104,7 +104,7 @@ class MFAConfig(): # 2. Load MFA params from .edgerc edgerc_config = configparser.ConfigParser() - edgerc_config.read_file(self.edgerc) + edgerc_config.read_file(os.path.expanduser(self.edgerc)) if not edgerc_config.has_section(self.section): err_msg = "ERROR: No section named %s was found in your .edgerc file\n" % self.section err_msg += "ERROR: Please generate credentials for the script functionality\n"