diff options
author | Michael DeHaan <mdehaan@redhat.com> | 2008-05-08 10:09:08 -0400 |
---|---|---|
committer | Michael DeHaan <mdehaan@redhat.com> | 2008-05-08 10:09:08 -0400 |
commit | 072204fb8d3e351c2c6e67beb52de175cad0c979 (patch) | |
tree | 94cdd595ccace67f915e8467deb8570390783add /cobbler/modules/cli_system.py | |
parent | e9cba0c5d8ca7356621a737a09b6a22d8b00e9fc (diff) | |
download | third_party-cobbler-072204fb8d3e351c2c6e67beb52de175cad0c979.tar.gz third_party-cobbler-072204fb8d3e351c2c6e67beb52de175cad0c979.tar.xz third_party-cobbler-072204fb8d3e351c2c6e67beb52de175cad0c979.zip |
Apply John Eckersberg's patch to allow random mac usage from the command line.
Diffstat (limited to 'cobbler/modules/cli_system.py')
-rw-r--r-- | cobbler/modules/cli_system.py | 8 |
1 files changed, 6 insertions, 2 deletions
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) |