Deploy machines added to module
diff --git a/_modules/maas.py b/_modules/maas.py
index 8be8c90..97e2280 100644
--- a/_modules/maas.py
+++ b/_modules/maas.py
@@ -389,6 +389,26 @@
return data
+class DeployMachines(MaasObject):
+ def __init__(self):
+ super(DeployMachines, self).__init__()
+ self._all_elements_url = None
+ self._create_url = (u'api/2.0/machines/{system_id}/', 'deploy')
+ self._config_path = 'region.machines'
+ self._element_key = 'hostname'
+ self._extra_data_urls = {'machines': (u'api/2.0/machines/', 'system_id', 'hostname')}
+
+ def fill_data(self, name, machine_data, machines):
+ data = {
+ 'system_id': machines[name],
+ }
+ if 'os' in machine_data:
+ data['distro_series'] = machine_data['os']
+ if 'hwe_kernel' in machine_data:
+ data['hwe_kernel'] = machine_data['kernel']
+ return data
+
+
class BootResource(MaasObject):
def __init__(self):
super(BootResource, self).__init__()
@@ -415,6 +435,7 @@
self._update = False
return new
+
class CommissioningScripts(MaasObject):
def __init__(self):
super(CommissioningScripts, self).__init__()
@@ -626,6 +647,9 @@
def machines_status():
return MachinesStatus.execute()
+def deploy_machines():
+ return DeployMachines().process()
+
def process_boot_resources():
return BootResource().process()