Add mass ack/delete of faults
This commit is contained in:
@ -549,6 +549,24 @@ def cli_cluster_fault_acknowledge(fault_id):
|
||||
finish(retcode, retdata)
|
||||
|
||||
|
||||
###############################################################################
|
||||
# > pvc cluster fault ack-all
|
||||
###############################################################################
|
||||
@click.command(
|
||||
name="ack-all",
|
||||
short_help="Acknowledge all cluster faults.",
|
||||
)
|
||||
@confirm_opt("Acknowledge all current cluster faults")
|
||||
@connection_req
|
||||
def cli_cluster_fault_acknowledge_all():
|
||||
"""
|
||||
Acknowledge all cluster faults.
|
||||
"""
|
||||
|
||||
retcode, retdata = pvc.lib.faults.acknowledge_all(CLI_CONFIG)
|
||||
finish(retcode, retdata)
|
||||
|
||||
|
||||
###############################################################################
|
||||
# > pvc cluster fault delete
|
||||
###############################################################################
|
||||
@ -567,6 +585,24 @@ def cli_cluster_fault_delete(fault_id):
|
||||
finish(retcode, retdata)
|
||||
|
||||
|
||||
###############################################################################
|
||||
# > pvc cluster fault delete-all
|
||||
###############################################################################
|
||||
@click.command(
|
||||
name="delete-all",
|
||||
short_help="Delete all cluster faults.",
|
||||
)
|
||||
@confirm_opt("Delete all current cluster faults")
|
||||
@connection_req
|
||||
def cli_cluster_fault_delete_all():
|
||||
"""
|
||||
Delete all cluster faults.
|
||||
"""
|
||||
|
||||
retcode, retdata = pvc.lib.faults.delete_all(CLI_CONFIG)
|
||||
finish(retcode, retdata)
|
||||
|
||||
|
||||
###############################################################################
|
||||
# > pvc cluster maintenance
|
||||
###############################################################################
|
||||
@ -6258,7 +6294,9 @@ cli_cluster.add_command(cli_cluster_restore)
|
||||
cli_cluster.add_command(cli_cluster_status)
|
||||
cli_cluster_fault.add_command(cli_cluster_fault_list)
|
||||
cli_cluster_fault.add_command(cli_cluster_fault_acknowledge)
|
||||
cli_cluster_fault.add_command(cli_cluster_fault_acknowledge_all)
|
||||
cli_cluster_fault.add_command(cli_cluster_fault_delete)
|
||||
cli_cluster_fault.add_command(cli_cluster_fault_delete_all)
|
||||
cli_cluster.add_command(cli_cluster_fault)
|
||||
cli_cluster_maintenance.add_command(cli_cluster_maintenance_on)
|
||||
cli_cluster_maintenance.add_command(cli_cluster_maintenance_off)
|
||||
|
@ -55,7 +55,22 @@ def acknowledge(config, fault_id):
|
||||
"""
|
||||
response = call_api(config, "put", f"/faults/{fault_id}")
|
||||
|
||||
print(response.json())
|
||||
if response.status_code == 200:
|
||||
return True, response.json().get("message", "")
|
||||
else:
|
||||
return False, response.json().get("message", "")
|
||||
|
||||
|
||||
def acknowledge_all(config):
|
||||
"""
|
||||
Acknowledge all PVC faults
|
||||
|
||||
API endpoint: PUT /api/v1/faults
|
||||
API arguments:
|
||||
API schema: {json_message}
|
||||
"""
|
||||
response = call_api(config, "put", "/faults")
|
||||
|
||||
if response.status_code == 200:
|
||||
return True, response.json().get("message", "")
|
||||
else:
|
||||
@ -76,3 +91,19 @@ def delete(config, fault_id):
|
||||
return True, response.json().get("message", "")
|
||||
else:
|
||||
return False, response.json().get("message", "")
|
||||
|
||||
|
||||
def delete_all(config):
|
||||
"""
|
||||
Delete all PVC faults
|
||||
|
||||
API endpoint: DELETE /api/v1/faults
|
||||
API arguments:
|
||||
API schema: {json_message}
|
||||
"""
|
||||
response = call_api(config, "delete", "/faults")
|
||||
|
||||
if response.status_code == 200:
|
||||
return True, response.json().get("message", "")
|
||||
else:
|
||||
return False, response.json().get("message", "")
|
||||
|
Reference in New Issue
Block a user