spotify/pyfg

d.load_config('user adgrp') fail in one vdom

Closed this issue · 2 comments

Hi

We have problem load full-config in one vdom.

The fortigate/vdom work as expected and we have found d.load_config('user adgrp') fails as well for all groups. As we have 4563 adgrp it is hard to say were it fail. So we think there is one ore more group that make it fail. a quick check do not find any group without "set"

get system status

Version: FortiGate-1000C v5.2.4,build0688,150722 (GA)

pip show pyfg

Name: pyfg Version: 0.47

[chris@automata pyfg]$ python fg_backup.py fnet01 vdom01
Traceback (most recent call last):
File "fg_backup.py", line 16, in
d.load_config('user adgrp')
File "/usr/local/lib/python2.7/site-packages/pyFG/fortios.py", line 220, in load_config
self.running_config.parse_config_output(config_text)
File "/usr/local/lib/python2.7/site-packages/pyFG/forticonfig.py", line 383, in parse_config_output
current_block.set_param(parameter, ' '.join(data))
AttributeError: 'NoneType' object has no attribute 'set_param'
[chris@automata01 pyfg]$ more fg_backup.py

!/usr/bin/env python

Gets the entire Fortigate config and prints it

from pyFG import FortiOS
import sys

if name == 'main':
hostname = sys.argv[1]
vdom = sys.argv[2]

d = FortiOS(hostname, vdom=vdom, username='admin', password='password')
d.open()
d.load_config('user adgrp')
#d.load_config('full-configuration')
print d.running_config.to_text()
d.close()

[chris@automata pyfg]$

Hi there @hemskgren !
I'm very sorry for the extreme delay in getting back to you...
Is this still an issue for you? If yes, I will try to replicate the issue with some fake data, with addresses / addrgrp's.

/Stefan Lindblom

We solve the issue by filter only needed adgrp in fortigate.

/Christer