Skip to content

Commit

Permalink
Merge pull request #62 from awslabs/fix-tests
Browse files Browse the repository at this point in the history
Fix tests if ~/.aws/shell/ doesn't exist.
  • Loading branch information
donnemartin committed Dec 17, 2015
2 parents 66b7ecc + b43b429 commit 782e860
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions awsshell/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,17 @@ def _copy_template_to_config(self, template_path,
:type overwrite: bool
:param overwrite: (Optional) Determines whether to overwrite the
existing config file, if it exists.
:raises: :class:`OSError <exceptions.OSError>`
"""
expanded_config_path = os.path.expanduser(config_path)
if not overwrite and os.path.isfile(config_path):
return
else:
try:
config_path_dir_name = os.path.dirname(config_path)
os.makedirs(config_path_dir_name)
except OSError:
if not os.path.isdir(config_path_dir_name):
raise
shutil.copyfile(template_path, config_path)

0 comments on commit 782e860

Please sign in to comment.