Created
March 12, 2019 14:30
-
-
Save mbaldessari/f65fe90db3d2355ffbec97944fd7987b to your computer and use it in GitHub Desktop.
swift upload example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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