From c258ba8f238b503b978ea252b9a7f854d82c8c6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn?= Date: Tue, 8 Apr 2014 16:49:16 +0200 Subject: [PATCH] Bug #2504: Improve defaultquota help text --- src/cli/one_helper/onequota_helper.rb | 25 +++++++++++++++++++++++-- src/cli/onegroup | 2 +- src/cli/oneuser | 2 +- 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/src/cli/one_helper/onequota_helper.rb b/src/cli/one_helper/onequota_helper.rb index 7fa9cf9d2c..286d1fb59f 100644 --- a/src/cli/one_helper/onequota_helper.rb +++ b/src/cli/one_helper/onequota_helper.rb @@ -46,9 +46,12 @@ class OneQuotaHelper # ID = # RVMS = # ] + EOT + + HELP_QUOTA_FOOTER = <<-EOT.unindent # # In any quota: - # -1 means use the default limit ('defaultquota' command) + # -1 means use the default limit (set with the 'defaultquota' command) # 0 means unlimited. # # The usage counters "*_USED" are shown for information @@ -56,12 +59,23 @@ class OneQuotaHelper #----------------------------------------------------------------------- EOT + HELP_DEFAULT_QUOTA_FOOTER = <<-EOT.unindent + # + # In any quota: + # 0 means unlimited. + # + # The usage counters "*_USED" will always be 0 for the default + # quotas, and can be ignored. + #----------------------------------------------------------------------- + EOT + # Edits the quota template of a resource # @param [XMLElement] resource to get the current info from # @param [String] path to the new contents. If nil a editor will be # used + # @param [True|False] is_default To change the help text # @return [String] contents of the new quotas - def self.set_quota(resource, path) + def self.set_quota(resource, path, is_default=false) str = "" if path.nil? @@ -71,6 +85,13 @@ class OneQuotaHelper path = tmp.path tmp << HELP_QUOTA + + if (is_default) + tmp << HELP_DEFAULT_QUOTA_FOOTER + else + tmp << HELP_QUOTA_FOOTER + end + tmp << resource.template_like_str("DATASTORE_QUOTA") << "\n" tmp << resource.template_like_str("VM_QUOTA") << "\n" tmp << resource.template_like_str("NETWORK_QUOTA") << "\n" diff --git a/src/cli/onegroup b/src/cli/onegroup index 60f7c97a7f..29eb5d03c9 100755 --- a/src/cli/onegroup +++ b/src/cli/onegroup @@ -232,7 +232,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do exit(-1) end - str = OneQuotaHelper.set_quota(default_quotas, args[0]) + str = OneQuotaHelper.set_quota(default_quotas, args[0], true) rc = system.set_group_quotas(str) diff --git a/src/cli/oneuser b/src/cli/oneuser index 2f3e908427..2e11338ee5 100755 --- a/src/cli/oneuser +++ b/src/cli/oneuser @@ -265,7 +265,7 @@ cmd=CommandParser::CmdParser.new(ARGV) do exit(-1) end - str = OneQuotaHelper.set_quota(default_quotas, args[0]) + str = OneQuotaHelper.set_quota(default_quotas, args[0], true) rc = system.set_user_quotas(str)