~ubuntu-branches/ubuntu/trusty/maas/trusty-security

« back to all changes in this revision

Viewing changes to src/provisioningserver/tasks.py

  • Committer: Package Import Robot
  • Author(s): Greg Lutostanski
  • Date: 2014-06-02 11:57:58 UTC
  • mto: (61.1.2 trusty-proposed)
  • mto: This revision was merged to the branch mainline in revision 62.
  • Revision ID: package-import@ubuntu.com-20140602115758-iu3455vh53mhpd0f
Tags: upstream-1.5.2+bzr2282
ImportĀ upstreamĀ versionĀ 1.5.2+bzr2282

Show diffs side-by-side

added added

removed removed

Lines of Context:
46
46
    probe_seamicro15k_and_enlist,
47
47
    )
48
48
from provisioningserver.custom_hardware.ucsm import probe_and_enlist_ucsm
 
49
from provisioningserver.custom_hardware.virsh import probe_virsh_and_enlist
49
50
from provisioningserver.dhcp import (
50
51
    config,
51
52
    detect,
384
385
    call_and_check(['sudo', '-n', 'service', 'maas-dhcp-server', 'restart'])
385
386
 
386
387
 
 
388
# Message to put in the DHCP config file when the DHCP server gets stopped.
 
389
DISABLED_DHCP_SERVER = "# DHCP server stopped."
 
390
 
 
391
 
387
392
@task
388
393
@log_exception_text
389
394
def stop_dhcp_server():
390
 
    """Stop a DHCP server."""
 
395
    """Write a blank config file and stop a DHCP server."""
 
396
    # Write an empty config file to avoid having an outdated config laying
 
397
    # around.
 
398
    sudo_write_file(
 
399
        celery_config.DHCP_CONFIG_FILE, DISABLED_DHCP_SERVER)
391
400
    call_and_check(['sudo', '-n', 'service', 'maas-dhcp-server', 'stop'])
392
401
 
393
402
 
464
473
@task
465
474
@log_exception_text
466
475
def add_seamicro15k(mac, username, password, power_control=None):
467
 
    """ See `maasserver.api.NodeGroupsHandler.add_seamicro15k`. """
 
476
    """ See `maasserver.api.NodeGroup.add_seamicro15k`. """
468
477
    ip = find_ip_via_arp(mac)
469
478
    if ip is not None:
470
479
        probe_seamicro15k_and_enlist(
476
485
 
477
486
@task
478
487
@log_exception_text
 
488
def add_virsh(poweraddr, password=None):
 
489
    """ See `maasserver.api.NodeGroup.add_virsh`. """
 
490
    probe_virsh_and_enlist(poweraddr, password=password)
 
491
 
 
492
 
 
493
@task
 
494
@log_exception_text
479
495
def enlist_nodes_from_ucsm(url, username, password):
480
496
    """ See `maasserver.api.NodeGroupsHandler.enlist_nodes_from_ucsm`. """
481
497
    probe_and_enlist_ucsm(url, username, password)