Skip to content

Commit f19240f

Browse files
Jenkinsopenstack-gerrit
authored andcommitted
Merge "Add default limit for container/object"
2 parents 10d1c2f + 9912fdd commit f19240f

2 files changed

Lines changed: 21 additions & 0 deletions

File tree

openstackclient/object/v1/container.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,18 @@
1515

1616
"""Container v1 action implementations"""
1717

18+
import logging
19+
1820
from osc_lib.cli import parseractions
1921
from osc_lib.command import command
2022
from osc_lib import utils
2123
import six
2224

25+
from openstackclient.i18n import _
26+
27+
28+
LOG = logging.getLogger(__name__)
29+
2330

2431
class CreateContainer(command.Lister):
2532
"""Create new container"""
@@ -38,6 +45,10 @@ def take_action(self, parsed_args):
3845

3946
results = []
4047
for container in parsed_args.containers:
48+
if len(container) > 256:
49+
LOG.warning(
50+
_('Container name is %s characters long, the default limit'
51+
' is 256'), len(container))
4152
data = self.app.client_manager.object_store.container_create(
4253
container=container,
4354
)

openstackclient/object/v1/object.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,18 @@
1515

1616
"""Object v1 action implementations"""
1717

18+
import logging
1819

1920
from osc_lib.cli import parseractions
2021
from osc_lib.command import command
2122
from osc_lib import utils
2223
import six
2324

25+
from openstackclient.i18n import _
26+
27+
28+
LOG = logging.getLogger(__name__)
29+
2430

2531
class CreateObject(command.Lister):
2632
"""Upload object to container"""
@@ -44,6 +50,10 @@ def take_action(self, parsed_args):
4450

4551
results = []
4652
for obj in parsed_args.objects:
53+
if len(obj) > 1024:
54+
LOG.warning(
55+
_('Object name is %s characters long, default limit'
56+
' is 1024'), len(obj))
4757
data = self.app.client_manager.object_store.object_create(
4858
container=parsed_args.container,
4959
object=obj,

0 commit comments

Comments
 (0)