From 072204fb8d3e351c2c6e67beb52de175cad0c979 Mon Sep 17 00:00:00 2001 From: Michael DeHaan Date: Thu, 8 May 2008 10:09:08 -0400 Subject: Apply John Eckersberg's patch to allow random mac usage from the command line. --- cobbler/modules/cli_system.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'cobbler/modules/cli_system.py') diff --git a/cobbler/modules/cli_system.py b/cobbler/modules/cli_system.py index 0c9a5b8..419b561 100644 --- a/cobbler/modules/cli_system.py +++ b/cobbler/modules/cli_system.py @@ -19,7 +19,7 @@ plib = distutils.sysconfig.get_python_lib() mod_path="%s/cobbler" % plib sys.path.insert(0, mod_path) -from utils import _ +from utils import _, get_random_mac import commands import cexceptions @@ -98,7 +98,11 @@ class SystemFunction(commands.CobblerFunction): my_interface = "intf0" if self.options.hostname: obj.set_hostname(self.options.hostname, my_interface) - if self.options.mac: obj.set_mac_address(self.options.mac, my_interface) + if self.options.mac: + if self.options.mac.lower() == 'random': + obj.set_mac_address(get_random_mac(self.api), my_interface) + else: + obj.set_mac_address(self.options.mac, my_interface) if self.options.ip: obj.set_ip_address(self.options.ip, my_interface) if self.options.subnet: obj.set_subnet(self.options.subnet, my_interface) if self.options.gateway: obj.set_gateway(self.options.gateway, my_interface) -- cgit