supply.py 766 Bytes
# -*- coding: utf-8 -*-

import logging

from slapos.cli.config import ClientConfigCommand
from slapos.client import init, do_supply, ClientConfig


class SupplyCommand(ClientConfigCommand):
    """
    supply a Software to a node
    """

    log = logging.getLogger('supply')

    def get_parser(self, prog_name):
        ap = super(SupplyCommand, self).get_parser(prog_name)

        ap.add_argument('software_url',
                        help='Your software url')

        ap.add_argument('node',
                        help='Target node')

        return ap

    def take_action(self, args):
        configp = self.fetch_config(args)
        conf = ClientConfig(args, configp)
        local = init(conf)
        do_supply(args.software_url, args.node, local)