Add operation and type since set option is batch command

This commit is contained in:
WQY\qiong
2023-03-08 23:04:20 +08:00
parent 9d5db44b22
commit 6a9b4ec87c
3 changed files with 10 additions and 0 deletions

View File

@@ -4,6 +4,8 @@ from .batch_cmd import execute_batch_command
def set_option(name: str, cs: ChangeSet) -> ChangeSet:
cs.operations[0]['operation'] = API_UPDATE
cs.operations[0]['type'] = 'option'
new_cs = cs
new_cs.merge(generate_v3(cs))
return execute_batch_command(name, new_cs)

View File

@@ -336,6 +336,9 @@ _key_map_32 = {
def generate_v2(cs: ChangeSet) -> ChangeSet:
op = cs.operations[0]
if op['type'] == 'option':
return cs
map = _key_map_32
cs_v2 = {}
@@ -367,6 +370,9 @@ def generate_v2(cs: ChangeSet) -> ChangeSet:
def generate_v3(cs: ChangeSet) -> ChangeSet:
op = cs.operations[0]
if op['type'] == 'option_v3':
return cs
map = _key_map_23
cs_v3 = {}

View File

@@ -4,6 +4,8 @@ from .batch_cmd import execute_batch_command
def set_option_v3(name: str, cs: ChangeSet) -> ChangeSet:
cs.operations[0]['operation'] = API_UPDATE
cs.operations[0]['type'] = 'option_v3'
new_cs = cs
new_cs.merge(generate_v2(cs))
return execute_batch_command(name, new_cs)