Révision 54330cc3
kvm_net: simplify argument handling
| plugins/libvirt/kvm_net | ||
|---|---|---|
| 135 | 135 |
|
| 136 | 136 |
|
| 137 | 137 |
if __name__ == "__main__": |
| 138 |
if len(sys.argv) > 1: |
|
| 139 |
if sys.argv[1] in ["autoconf", "detect"]: |
|
| 140 |
if detect_kvm(): |
|
| 141 |
print("yes")
|
|
| 142 |
else: |
|
| 143 |
print("no")
|
|
| 144 |
elif sys.argv[1] == "config": |
|
| 145 |
config(find_vm_names(list_pids()).values()) |
|
| 138 |
action = sys.argv[1] if len(sys.argv) > 1 else None |
|
| 139 |
if action == "autoconf": |
|
| 140 |
if detect_kvm(): |
|
| 141 |
print("yes")
|
|
| 146 | 142 |
else: |
| 147 |
fetch(find_vm_names(list_pids())) |
|
| 143 |
print("no")
|
|
| 144 |
elif action == "config": |
|
| 145 |
vm_data = find_vm_names(list_pids()) |
|
| 146 |
config(vm_data.values()) |
|
| 148 | 147 |
else: |
| 149 |
fetch(find_vm_names(list_pids())) |
|
| 148 |
vm_data = find_vm_names(list_pids()) |
|
| 149 |
fetch(vm_data) |
|
Formats disponibles : Unified diff