pschmitt / fortipy

FortiManger API bindings for Python
GNU General Public License v3.0
11 stars 11 forks source link

Fortimanager lock_adom() does not work #6

Closed robertpenz closed 6 years ago

robertpenz commented 6 years ago

Hi!

fortimanager.lock_adom() calls return self._request(data), but _requests is defined as

 def _request(self, method, url, option=None, data=None, request_id=1,
                 verbose=False):

which leads to TypeError: _request() takes at least 3 arguments (2 given). Should the data json dict split up and provided as parameters for the method?

robertpenz commented 6 years ago

if I change the methods to following it works

    @login_required
    def lock_adom(self, adom):
        '''
        Lock an ADOM
        '''
        return self._exec(url="pm/config/adom/{}/_workspace/lock".format(adom), request_id = 5612)

    @login_required
    def unlock_adom(self, adom):
        '''
        Unclock an ADOM
        '''
        return self._exec(url="pm/config/adom/{}/_workspace/unlock".format(adom), request_id = 5613)

    @login_required
    def commit(self, adom):
        '''
        Commit changes made to ADOM
        '''
        return self._exec(url="pm/config/adom/{}/_workspace/commit".format(adom), request_id = 5614)
pschmitt commented 6 years ago

Thanks for letting me know. What FortiManager version are you using? Can you issue a PR with these changes?

robertpenz commented 6 years ago

Did a PR.