()
| 232 | |
| 233 | |
| 234 | def main(): |
| 235 | if len(sys.argv) < 3: |
| 236 | fail("Usage: maas.py <action> <json-file-path>") |
| 237 | |
| 238 | action = sys.argv[1].lower() |
| 239 | json_file = sys.argv[2] |
| 240 | |
| 241 | try: |
| 242 | manager = MaasManager(json_file) |
| 243 | except FileNotFoundError: |
| 244 | fail(f"JSON file not found: {json_file}") |
| 245 | |
| 246 | actions = { |
| 247 | "prepare": manager.prepare, |
| 248 | "create": manager.create, |
| 249 | "delete": manager.delete, |
| 250 | "start": manager.start, |
| 251 | "stop": manager.stop, |
| 252 | "reboot": manager.reboot, |
| 253 | "status": manager.status, |
| 254 | } |
| 255 | |
| 256 | if action not in actions: |
| 257 | fail("Invalid action") |
| 258 | |
| 259 | actions[action]() |
| 260 | |
| 261 | |
| 262 | if __name__ == "__main__": |
no test coverage detected