def _create_base_aws_cli_config_files_if_needed(google_config):
def touch(fname, mode=0o600):
flags = os.O_CREAT | os.O_APPEND
with os.fdopen(os.open(fname, flags, mode)) as f:
try:
os.utime(fname, None)
finally:
f.close()
aws_config_root = os.path.dirname(google_config.aws_config_location)
if not os.path.exists(aws_config_root):
os.mkdir(aws_config_root, 0o700)
if not os.path.exists(google_config.aws_credentials_location):
touch(google_config.aws_credentials_location)
aws_credentials_root = os.path.dirname(google_config.aws_credentials_location)
if not os.path.exists(aws_credentials_root):
os.mkdir(aws_credentials_root, 0o700)
if not os.path.exists(google_config.aws_config_location):
touch(google_config.aws_config_location)
评论列表
文章目录