Merge "Add set-custom-config subcommand to venusclient"
This commit is contained in:
@@ -34,3 +34,19 @@ class ConfigManager(basemodels.BaseModelManager):
|
||||
return body
|
||||
except Exception as e:
|
||||
raise RuntimeError(str(e))
|
||||
|
||||
def set_custom_config(self, config_id, value):
|
||||
"""Set custom config to the specified value.
|
||||
|
||||
:param config_id: The ID of the custom config
|
||||
:param value: The value to set
|
||||
:returns: The result of the set action.
|
||||
"""
|
||||
url = '/v1/custom_config'
|
||||
body = {'id': config_id,
|
||||
'value': value}
|
||||
try:
|
||||
resp, body = self.api.json_request('POST', url, body=body)
|
||||
return body
|
||||
except Exception as e:
|
||||
raise RuntimeError(str(e))
|
||||
|
||||
@@ -12,9 +12,24 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from venusclient.common import cliutils as utils
|
||||
|
||||
|
||||
def do_get_log_storage_days(cs, args):
|
||||
"""get the days of saved logs in elasticsearch(unit day)."""
|
||||
endpoint = cs.config.get_days()
|
||||
print(endpoint)
|
||||
return endpoint
|
||||
|
||||
|
||||
@utils.arg('id',
|
||||
metavar='<id>',
|
||||
help='The id of custom config')
|
||||
@utils.arg('value',
|
||||
metavar='<value>',
|
||||
help='The value set to custom config')
|
||||
def do_set_custom_config(cs, args):
|
||||
"""set the custom config."""
|
||||
endpoint = cs.config.set_custom_config(args.id, args.value)
|
||||
print(endpoint)
|
||||
return endpoint
|
||||
|
||||
Reference in New Issue
Block a user