diff --git a/barbican/common/config.py b/barbican/common/config.py index 890900d9c..3295d9fd1 100644 --- a/barbican/common/config.py +++ b/barbican/common/config.py @@ -129,6 +129,27 @@ ks_queue_opts = [ 'notification server processing functionality.')), ] +quota_opt_group = cfg.OptGroup(name='quotas', + title='Quota Options') + +quota_opts = [ + cfg.IntOpt('quota_secrets', + default=-1, + help='Number of secrets allowed per project'), + cfg.IntOpt('quota_orders', + default=-1, + help='Number of orders allowed per project'), + cfg.IntOpt('quota_containers', + default=-1, + help='Number of containers allowed per project'), + cfg.IntOpt('quota_consumers', + default=-1, + help='Number of consumers allowed per project'), + cfg.IntOpt('quota_cas', + default=-1, + help='Number of CAs allowed per project') +] + def parse_args(conf, args=None, usage=None, default_config_files=None): conf(args=args if args else [], @@ -162,6 +183,10 @@ def new_config(): conf.register_group(ks_queue_opt_group) conf.register_opts(ks_queue_opts, group=ks_queue_opt_group) + + conf.register_group(quota_opt_group) + conf.register_opts(quota_opts, group=quota_opt_group) + return conf diff --git a/barbican/common/quota.py b/barbican/common/quota.py index 0a5588b51..c05ae70c7 100644 --- a/barbican/common/quota.py +++ b/barbican/common/quota.py @@ -13,9 +13,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -from oslo_config import cfg from oslo_log import log as logging +from barbican.common import config from barbican.common import exception from barbican.common import hrefs from barbican.common import resources as res @@ -27,30 +27,7 @@ LOG = logging.getLogger(__name__) UNLIMITED_VALUE = -1 DISABLED_VALUE = 0 - -quota_opt_group = cfg.OptGroup(name='quotas', - title='Quota Options') - -quota_opts = [ - cfg.IntOpt('quota_secrets', - default=-1, - help='Number of secrets allowed per project'), - cfg.IntOpt('quota_orders', - default=-1, - help='Number of orders allowed per project'), - cfg.IntOpt('quota_containers', - default=-1, - help='Number of containers allowed per project'), - cfg.IntOpt('quota_consumers', - default=-1, - help='Number of consumers allowed per project'), - cfg.IntOpt('quota_cas', - default=-1, - help='Number of CAs allowed per project')] - -CONF = cfg.CONF -CONF.register_group(quota_opt_group) -CONF.register_opts(quota_opts, group=quota_opt_group) +CONF = config.CONF class QuotaDriver(object):