{"action":"opened","issue":{"url":"https://api.github.com/repos/favoretti/nsnitro/issues/91","labels_url":"https://api.github.com/repos/favoretti/nsnitro/issues/91/labels{/name}","comments_url":"https://api.github.com/repos/favoretti/nsnitro/issues/91/comments","events_url":"https://api.github.com/repos/favoretti/nsnitro/issues/91/events","html_url":"https://github.com/favoretti/nsnitro/issues/91","id":88443673,"number":91,"title":"NSCSPolicy .get method fails","user":{"login":"ryaner","id":4699198,"avatar_url":"https://avatars.githubusercontent.com/u/4699198?v=3","gravatar_id":"","url":"https://api.github.com/users/ryaner","html_url":"https://github.com/ryaner","followers_url":"https://api.github.com/users/ryaner/followers","following_url":"https://api.github.com/users/ryaner/following{/other_user}","gists_url":"https://api.github.com/users/ryaner/gists{/gist_id}","starred_url":"https://api.github.com/users/ryaner/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ryaner/subscriptions","organizations_url":"https://api.github.com/users/ryaner/orgs","repos_url":"https://api.github.com/users/ryaner/repos","events_url":"https://api.github.com/users/ryaner/events{/privacy}","received_events_url":"https://api.github.com/users/ryaner/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-06-15T14:30:15Z","updated_at":"2015-06-15T14:30:15Z","closed_at":null,"body":"The internal name is 'policyname' and this causes .get to fail on a key error.\r\n\r\nTest code\r\n```\r\nnspolicy= NSCSPolicy()\r\nnspolicy.set_policyname(rule_name)\r\npolicy = NSCSPolicy.get(nitro, nspolicy)\r\n```\r\n\r\n```\r\nTraceback (most recent call last):\r\n  File \"./nstest.py\", line 10, in <module>\r\n    policy = NSCSPolicy.get(nitro, nspolicy)\r\n  File \"/usr/local/lib/python2.7/dist-packages/nsnitro/nsresources/nscspolicy.py\", line 195, in get\r\n    __cspolicy.get_resource(nitro)\r\n  File \"/usr/local/lib/python2.7/dist-packages/nsnitro/nsresources/nsbaseresource.py\", line 70, in get_resource\r\n    object_name if object_name else self.options['name'])\r\nKeyError: 'name'\r\n```\r\n\r\nChanging the internal name in nscspolicy.py to 'name' to match other classes won't work as .add will then fail with an invalid argument error.\r\n```\r\n  File \"nstest2.py\", line 436, in add_cs_policy\r\n    NSCSPolicy.add(self.nitro, nspolicy)\r\n  File \"/usr/local/lib/python2.7/dist-packages/nsnitro/nsresources/nscspolicy.py\", line 220, in add\r\n    return __cspolicy.add_resource(nitro)\r\n  File \"/usr/local/lib/python2.7/dist-packages/nsnitro/nsresources/nsbaseresource.py\", line 81, in add_resource\r\n    response = nitro.post(self.get_payload())\r\n  File \"/usr/local/lib/python2.7/dist-packages/nsnitro/nsnitro.py\", line 82, in post\r\n    return NSNitroResponse(response.read())\r\n  File \"/usr/local/lib/python2.7/dist-packages/nsnitro/nsutil.py\", line 21, in __init__\r\n    self.__parse_response()\r\n  File \"/usr/local/lib/python2.7/dist-packages/nsnitro/nsutil.py\", line 35, in __parse_response\r\n    self._raise_exception()\r\n  File \"/usr/local/lib/python2.7/dist-packages/nsnitro/nsutil.py\", line 51, in _raise_exception\r\n    raise exception_class(self.message, self.errorcode)\r\nnsnitro.nsexceptions.nsexceptions.NSNitroNserrInval: u'Invalid argument [name]'\r\n```\r\n\r\n"}}