Skip to content

Instantly share code, notes, and snippets.

@mbaldessari
Created March 12, 2019 14:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mbaldessari/f65fe90db3d2355ffbec97944fd7987b to your computer and use it in GitHub Desktop.
Save mbaldessari/f65fe90db3d2355ffbec97944fd7987b to your computer and use it in GitHub Desktop.
swift upload example
from keystoneauth1 import session
from keystoneauth1.identity import v3
from swiftclient.client import Connection
from tripleo_common.utils import swift as swiftutils
_authurl = 'http://192.168.24.1:5000/v3/'
_auth_version = '3'
_user = 'admin'
# (sudo hiera -c /etc/puppet/hiera.yaml keystone::admin_password)
_key = '6aMpWobr5ySX47vwJefUgMGAA'
_os_options = {
'user_domain_name': 'Default',
'project_domain_name': 'Default',
'project_name': 'admin'
}
conn = Connection(
authurl=_authurl,
user=_user,
key=_key,
os_options=_os_options,
auth_version=_auth_version
)
with open('/tmp/foo') as file_content:
swiftutils.put_object_string(conn, 'overcloud', 'foo', file_content)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment