'RHEL6_NetworkData' object has no attribute 'activate'

Romu <[email protected]>
Newsgroups gmane.linux.redhat.kickstart.general
Message-ID <[email protected]>
Hi,

I wrote a simple script to try to use pykickstart:

#!/usr/bin/python

from pykickstart.parser import *
from pykickstart.version import makeVersion

text=True
source='http://test.123.com/abc/123'

ksp = KickstartParser(makeVersion('RHEL6'))
h = ksp.handler
# test or graphical?
if text:
    h.displaymode.displayMode = DISPLAY_MODE_TEXT
# source
if source[:6] == 'nfs://':
    server, dir = source[6:].split('/', 1)
    dir = '/' + dir
    h.method(method='nfs', server=server, dir=dir)
elif source[:6] == 'ftp://' or source[:7] == 'http://':
    h.method(method='url', url=source)
else:
    print 'Error!'
# lang keyboard rootpw
h.lang(lang='en_US.UTF-8')
h.keyboard(keyboard='us')
h.rootpw(isCrypted=False,password='test')
# network
eth = h.NetworkData(device='eth0', bootproto='static', ip='210.179.60.212',
            netmask='255.255.252.0',hostname='ca-ostest212.us.oracle.com',
            onboot='yes')
h.network.dataList().append(eth)
# bootloader
h.bootloader.location='mbr'
# firewall & selinux
h.firewall.enabled = False
h.selinux(selinux=SELINUX_DISABLED)
# reboot
h.reboot(action=KS_REBOOT)
# packages
h.packages.packageList.append('*')
#print dir(h.bootloader)

outfile = open("out.cfg", 'w')
outfile.write(h.__str__())
outfile.close()

When I run this script, I get:

Traceback (most recent call last):
  File "./kstest.py", line 44, in <module>
    outfile.write(h.__str__())
  File "/home/simon/oltest/pykickstart/base.py", line 284, in __str__
    retval += obj.__str__()
  File "/home/simon/oltest/pykickstart/commands/network.py", line 204,
in __str__
    retval += nic.__str__()
  File "/home/simon/oltest/pykickstart/commands/network.py", line 89, in __str__
    retval += "network %s\n" % self._getArgsAsStr()
  File "/home/simon/oltest/pykickstart/commands/network.py", line 180,
in _getArgsAsStr
    if self.activate:
AttributeError: 'RHEL6_NetworkData' object has no attribute 'activate'


Any idea?


Thanks,
rmu
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.