Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add insecure and ordinarycallingformat #7

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 24 additions & 6 deletions bin/boto-rsync
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import sys, os, time, datetime, argparse, threading, signal
from fnmatch import fnmatch
import boto
import boto.s3.connection

__version__ = '0.8.1'

Expand Down Expand Up @@ -204,6 +205,15 @@ def main():
help='Connect without credentials (S3 only). Useful if working ' + \
'with others\' buckets that have a global read/write ACL.'
)
parser.add_argument(
'--insecure', action='store_true',
help='Connect without SSL'
)
parser.add_argument(
'--ordinarycallingformat' , action='store_true',
help='Connect with the old connection type ' + \
'(no subdomain and Bucket upper case).'
)
parser.add_argument(
'--endpoint', metavar='HOST', default='s3.amazonaws.com',
help='Specify a specific S3 endpoint to connect to via boto\'s ' + \
Expand Down Expand Up @@ -312,6 +322,8 @@ def main():
cloud_access_key_id = args.cloud_access_key_id
cloud_secret_access_key = args.cloud_secret_access_key
anon = args.anon
ordinarycallingformat = args.ordinarycallingformat
insecure = args.insecure
endpoint = args.endpoint
grant = args.grant
metadata = args.metadata
Expand Down Expand Up @@ -410,16 +422,22 @@ def main():


# Connect to Cloud
parameters = {}
if cloud_service == 'gs':
c = boto.connect_gs(gs_access_key_id=cloud_access_key_id,
gs_secret_access_key=cloud_secret_access_key)
parameters['gs_access_key_id'] = cloud_access_key_id
parameters['gs_secret_access_key'] = cloud_secret_access_key
else:
parameters['host'] = endpoint
if anon:
c = boto.connect_s3(host=endpoint, anon=True)
parameters['anon'] = True
else:
c = boto.connect_s3(aws_access_key_id=cloud_access_key_id,
aws_secret_access_key=cloud_secret_access_key,
host=endpoint)
parameters['aws_access_key_id'] = cloud_access_key_id
parameters['aws_secret_access_key'] = cloud_secret_access_key
if ordinarycallingformat:
parameters['calling_format'] = boto.s3.connection.OrdinaryCallingFormat()
if insecure:
parameters['is_secure'] = False
c = boto.connect_s3(**parameters)
c.debug = debug
b = c.get_bucket(cloud_bucket)
if xfer_type in ['sync']:
Expand Down