Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
resp, body = self.get(url, headers={})
if params and params.get('format') == 'json':
body = json.loads(body)
elif params and params.get('format') == 'xml':
body = etree.fromstring(body)
# Else the content-type is plain/text
else:
body = [
obj_name for obj_name in body.decode().split('\n') if obj_name
]
self.expected_success([200, 204], resp.status)
return resp, body
list_container_contents = debtcollector.moves.moved_function(
list_container_objects, 'list_container_contents', __name__,
version='Queens', removal_version='Rocky')
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
"""
NOTE: Do not use this module to add random utils.
We want to avoid having a generic utils.py dumping ground.
"""
from debtcollector import moves
from neutron_lib.api import attributes
populate_project_info = moves.moved_function(
attributes.populate_project_info, 'populate_project_info', __name__)
"""
url = str(container_name)
headers = {}
if create_update_metadata:
for key in create_update_metadata:
metadata_header_name = create_update_metadata_prefix + key
headers[metadata_header_name] = create_update_metadata[key]
if delete_metadata:
for key in delete_metadata:
headers[delete_metadata_prefix + key] = delete_metadata[key]
resp, body = self.post(url, headers=headers, body=None)
self.expected_success(204, resp.status)
return resp, body
update_container_metadata = debtcollector.moves.moved_function(
create_update_or_delete_container_metadata,
'update_container_metadata', __name__,
version='Queens', removal_version='Rocky')
def list_container_metadata(self, container_name):
"""List all container metadata."""
url = str(container_name)
resp, body = self.head(url)
self.expected_success(204, resp.status)
return resp, body
def list_container_objects(self, container_name, params=None):
"""List the objects in a container, given the container name
Returns the container object listing as a plain text list, or as
xml or json if that option is specified via the 'format' argument.
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
# TODO(amotoki): Remove this file at the beginning of Nxx cycle.
from debtcollector import moves
from neutronclient import _i18n
message = ("moved to neutronclient._i18n; please migrate to local "
"oslo_i18n usage, as defined at "
"http://docs.openstack.org/developer/oslo.i18n/usage.html")
_ = moves.moved_function(_i18n._, '_', __name__, message=message)