{"action":"created","comment":{"url":"https://api.github.com/repos/F5Networks/f5-common-python/pulls/comments/66095798","id":66095798,"diff_hunk":"@@ -295,6 +305,37 @@ def _handle_requests_params(self, kwargs):\n             requests_params.update({'params': params})\n         return requests_params\n \n+    def _check_exclusive_parameters(self, **kwargs):\n+        \"\"\"Check for mutually exclusive attributes in kwargs.\n+\n+        :raises ExclusiveAttributesPresent\n+        \"\"\"\n+        if len(self._meta_data['exclusive_attributes']) > 0:\n+            attr_set = set(kwargs.keys())\n+            ex_set = set(self._meta_data['exclusive_attributes'][0])\n+            common_set = attr_set.intersection(ex_set)\n+            if len(common_set) > 1:\n+                cset = ', '.join(common_set)\n+                error = 'Mutually exclusive arguments submitted. ' \\\n+                        'The following arguments cannot be set ' \\\n+                        'together: \"%s\".' % cset\n+                raise ExclusiveAttributesPresent(error)\n+\n+    @staticmethod\n+    def _check_required_parameters(rqset, **kwargs):\n+        \"\"\"Helper function to do operation on sets\n+\n+        ::returns bool and variable\n+        \"\"\"\n+        key_set = set(kwargs.keys())\n+        required_minus_received = rqset - key_set\n+        if required_minus_received != set():","path":"f5/bigip/resource.py","position":86,"original_position":86,"commit_id":"fa76ba63e795475ddd79bf6fc4d0dc32cb3c4eb5","original_commit_id":"fa76ba63e795475ddd79bf6fc4d0dc32cb3c4eb5","user":{"login":"pjbreaux","id":14225800,"avatar_url":"https://avatars.githubusercontent.com/u/14225800?v=3","gravatar_id":"","url":"https://api.github.com/users/pjbreaux","html_url":"https://github.com/pjbreaux","followers_url":"https://api.github.com/users/pjbreaux/followers","following_url":"https://api.github.com/users/pjbreaux/following{/other_user}","gists_url":"https://api.github.com/users/pjbreaux/gists{/gist_id}","starred_url":"https://api.github.com/users/pjbreaux/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pjbreaux/subscriptions","organizations_url":"https://api.github.com/users/pjbreaux/orgs","repos_url":"https://api.github.com/users/pjbreaux/repos","events_url":"https://api.github.com/users/pjbreaux/events{/privacy}","received_events_url":"https://api.github.com/users/pjbreaux/received_events","type":"User","site_admin":false},"body":"Why not raise the exception here? Allowing the caller to deal with it in whatever way they choose.","created_at":"2016-06-07T15:38:34Z","updated_at":"2016-06-07T15:38:34Z","html_url":"https://github.com/F5Networks/f5-common-python/pull/486#discussion_r66095798","pull_request_url":"https://api.github.com/repos/F5Networks/f5-common-python/pulls/486","_links":{"self":{"href":"https://api.github.com/repos/F5Networks/f5-common-python/pulls/comments/66095798"},"html":{"href":"https://github.com/F5Networks/f5-common-python/pull/486#discussion_r66095798"},"pull_request":{"href":"https://api.github.com/repos/F5Networks/f5-common-python/pulls/486"}}},"pull_request":{"url":"https://api.github.com/repos/F5Networks/f5-common-python/pulls/486","id":72883326,"html_url":"https://github.com/F5Networks/f5-common-python/pull/486","diff_url":"https://github.com/F5Networks/f5-common-python/pull/486.diff","patch_url":"https://github.com/F5Networks/f5-common-python/pull/486.patch","issue_url":"https://api.github.com/repos/F5Networks/f5-common-python/issues/486","number":486,"state":"open","locked":false,"title":"Multibugfixes_ #378, #452, #474, #481, #484, #485","user":{"login":"wojtek0806","id":18006037,"avatar_url":"https://avatars.githubusercontent.com/u/18006037?v=3","gravatar_id":"","url":"https://api.github.com/users/wojtek0806","html_url":"https://github.com/wojtek0806","followers_url":"https://api.github.com/users/wojtek0806/followers","following_url":"https://api.github.com/users/wojtek0806/following{/other_user}","gists_url":"https://api.github.com/users/wojtek0806/gists{/gist_id}","starred_url":"https://api.github.com/users/wojtek0806/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wojtek0806/subscriptions","organizations_url":"https://api.github.com/users/wojtek0806/orgs","repos_url":"https://api.github.com/users/wojtek0806/repos","events_url":"https://api.github.com/users/wojtek0806/events{/privacy}","received_events_url":"https://api.github.com/users/wojtek0806/received_events","type":"User","site_admin":false},"body":"Fixes #378, #452, #474, #481, #484, #485\r\n\r\nProblem:\r\nGiven the latest additions and changes to the core classes some of the sub-modules coding needed change, also during the process few issues were discovered with create method allowing mutually exclusive attributes to be sent to the BIGIP. Also a decision was made to create a helper class to handle required attributes within different parts of code.\r\n\r\nAnalysis:\r\n\r\nRemoved the hardcoded payload in failover.py. Kept the legacy method in failover.py for backwards compatibility. Added 2 new helper methods inside PathElement:,\r\n\r\n - _check_exclusive_parameters to handle those exclusive attributes during create/exec_cmd.\r\n - _check_required_parameters - a static method to handle checking for required paremeters\r\n\r\nModified CommandExecutionMixin _exec_cmd method to utilize the 2 new helpers from PathElement, modified Resource _create method to do the same. Modified _check_load_parameters method inside PathElement to call _check_required_parameters. In addition to the above I have moved self._meta_data['exclusive_attributes'] declaration into ResourceBase. Added new dictionary entry for: self._meta_data['required_command_parameters'] into PathElement to accomodate splitting this from required_creation_parameters as per discussion with @za. The self._meta_data['required_command_parameters'] is empty by default, this is to allow utilizing classes where 'name' attribute is not present or required, also to allow utilizing commands by the means of  utilCmdArgs= argument.\r\n\r\ne.g.\r\n\r\n    exec_cmd('foocommand', utilCmdArgs='foo bar')\r\n\r\nFiles modified:\r\n\r\nf5\\bigip\\resource.py\r\nf5\\bigip\\mixins.py\r\nf5\\bigip\\tm\\cm\\device_group.py\r\nf5\\bigip\\tm\\cm\\sync_status.py\r\nf5\\bigip\\tm\\cm\\traffic_group.py\r\nf5\\bigip\\tm\\cm\\trust.py\r\nf5\\bigip\\tm\\cm\\trust_domain.py\r\nf5\\bigip\\tm\\ltm\\profile.py\r\nf5\\bigip\\tm\\sys\\failover.py\r\nf5-common-python\\test\\functional\\cm\\test_sync_status.py\r\nf5-common-python\\test\\functional\\tm\\sys\\test_failover.py\r\n\r\nNew files added:\r\n\r\nf5\\bigip\\tm\\sys\\test\\test_failover.py\r\nf5\\bigip\\tm\\ltm\\test\\test_profile_ocsp.py","created_at":"2016-06-07T14:17:10Z","updated_at":"2016-06-07T15:38:34Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ea2a6088b5ed913a1062cf2cc75421885b8eaae8","assignee":{"login":"zancas","id":640955,"avatar_url":"https://avatars.githubusercontent.com/u/640955?v=3","gravatar_id":"","url":"https://api.github.com/users/zancas","html_url":"https://github.com/zancas","followers_url":"https://api.github.com/users/zancas/followers","following_url":"https://api.github.com/users/zancas/following{/other_user}","gists_url":"https://api.github.com/users/zancas/gists{/gist_id}","starred_url":"https://api.github.com/users/zancas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zancas/subscriptions","organizations_url":"https://api.github.com/users/zancas/orgs","repos_url":"https://api.github.com/users/zancas/repos","events_url":"https://api.github.com/users/zancas/events{/privacy}","received_events_url":"https://api.github.com/users/zancas/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/F5Networks/f5-common-python/milestones/14","html_url":"https://github.com/F5Networks/f5-common-python/milestones/v0.1.8","labels_url":"https://api.github.com/repos/F5Networks/f5-common-python/milestones/14/labels","id":1791217,"number":14,"title":"v0.1.8","description":"This is the second \"heartbeat\" milestone.   Heartbeats occur every 2 weeks.   During a heartbeat release all PRs that have been accepted into the release are formally merged into the release branch.\r\n\r\nPriorities:","creator":{"login":"zancas","id":640955,"avatar_url":"https://avatars.githubusercontent.com/u/640955?v=3","gravatar_id":"","url":"https://api.github.com/users/zancas","html_url":"https://github.com/zancas","followers_url":"https://api.github.com/users/zancas/followers","following_url":"https://api.github.com/users/zancas/following{/other_user}","gists_url":"https://api.github.com/users/zancas/gists{/gist_id}","starred_url":"https://api.github.com/users/zancas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zancas/subscriptions","organizations_url":"https://api.github.com/users/zancas/orgs","repos_url":"https://api.github.com/users/zancas/repos","events_url":"https://api.github.com/users/zancas/events{/privacy}","received_events_url":"https://api.github.com/users/zancas/received_events","type":"User","site_admin":false},"open_issues":13,"closed_issues":3,"state":"open","created_at":"2016-05-27T02:14:21Z","updated_at":"2016-06-07T15:10:48Z","due_on":"2016-06-17T06:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/F5Networks/f5-common-python/pulls/486/commits","review_comments_url":"https://api.github.com/repos/F5Networks/f5-common-python/pulls/486/comments","review_comment_url":"https://api.github.com/repos/F5Networks/f5-common-python/pulls/comments{/number}","comments_url":"https://api.github.com/repos/F5Networks/f5-common-python/issues/486/comments","statuses_url":"https://api.github.com/repos/F5Networks/f5-common-python/statuses/fa76ba63e795475ddd79bf6fc4d0dc32cb3c4eb5","head":{"label":"wojtek0806:fixes_378_474_452","ref":"fixes_378_474_452","sha":"fa76ba63e795475ddd79bf6fc4d0dc32cb3c4eb5","user":{"login":"wojtek0806","id":18006037,"avatar_url":"https://avatars.githubusercontent.com/u/18006037?v=3","gravatar_id":"","url":"https://api.github.com/users/wojtek0806","html_url":"https://github.com/wojtek0806","followers_url":"https://api.github.com/users/wojtek0806/followers","following_url":"https://api.github.com/users/wojtek0806/following{/other_user}","gists_url":"https://api.github.com/users/wojtek0806/gists{/gist_id}","starred_url":"https://api.github.com/users/wojtek0806/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wojtek0806/subscriptions","organizations_url":"https://api.github.com/users/wojtek0806/orgs","repos_url":"https://api.github.com/users/wojtek0806/repos","events_url":"https://api.github.com/users/wojtek0806/events{/privacy}","received_events_url":"https://api.github.com/users/wojtek0806/received_events","type":"User","site_admin":false},"repo":{"id":55151874,"name":"f5-common-python","full_name":"wojtek0806/f5-common-python","owner":{"login":"wojtek0806","id":18006037,"avatar_url":"https://avatars.githubusercontent.com/u/18006037?v=3","gravatar_id":"","url":"https://api.github.com/users/wojtek0806","html_url":"https://github.com/wojtek0806","followers_url":"https://api.github.com/users/wojtek0806/followers","following_url":"https://api.github.com/users/wojtek0806/following{/other_user}","gists_url":"https://api.github.com/users/wojtek0806/gists{/gist_id}","starred_url":"https://api.github.com/users/wojtek0806/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wojtek0806/subscriptions","organizations_url":"https://api.github.com/users/wojtek0806/orgs","repos_url":"https://api.github.com/users/wojtek0806/repos","events_url":"https://api.github.com/users/wojtek0806/events{/privacy}","received_events_url":"https://api.github.com/users/wojtek0806/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/wojtek0806/f5-common-python","description":"Python SDK for configuration and monitoring of F5® BIG-IP® devices via the iControl® REST API.","fork":true,"url":"https://api.github.com/repos/wojtek0806/f5-common-python","forks_url":"https://api.github.com/repos/wojtek0806/f5-common-python/forks","keys_url":"https://api.github.com/repos/wojtek0806/f5-common-python/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wojtek0806/f5-common-python/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wojtek0806/f5-common-python/teams","hooks_url":"https://api.github.com/repos/wojtek0806/f5-common-python/hooks","issue_events_url":"https://api.github.com/repos/wojtek0806/f5-common-python/issues/events{/number}","events_url":"https://api.github.com/repos/wojtek0806/f5-common-python/events","assignees_url":"https://api.github.com/repos/wojtek0806/f5-common-python/assignees{/user}","branches_url":"https://api.github.com/repos/wojtek0806/f5-common-python/branches{/branch}","tags_url":"https://api.github.com/repos/wojtek0806/f5-common-python/tags","blobs_url":"https://api.github.com/repos/wojtek0806/f5-common-python/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wojtek0806/f5-common-python/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wojtek0806/f5-common-python/git/refs{/sha}","trees_url":"https://api.github.com/repos/wojtek0806/f5-common-python/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wojtek0806/f5-common-python/statuses/{sha}","languages_url":"https://api.github.com/repos/wojtek0806/f5-common-python/languages","stargazers_url":"https://api.github.com/repos/wojtek0806/f5-common-python/stargazers","contributors_url":"https://api.github.com/repos/wojtek0806/f5-common-python/contributors","subscribers_url":"https://api.github.com/repos/wojtek0806/f5-common-python/subscribers","subscription_url":"https://api.github.com/repos/wojtek0806/f5-common-python/subscription","commits_url":"https://api.github.com/repos/wojtek0806/f5-common-python/commits{/sha}","git_commits_url":"https://api.github.com/repos/wojtek0806/f5-common-python/git/commits{/sha}","comments_url":"https://api.github.com/repos/wojtek0806/f5-common-python/comments{/number}","issue_comment_url":"https://api.github.com/repos/wojtek0806/f5-common-python/issues/comments{/number}","contents_url":"https://api.github.com/repos/wojtek0806/f5-common-python/contents/{+path}","compare_url":"https://api.github.com/repos/wojtek0806/f5-common-python/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wojtek0806/f5-common-python/merges","archive_url":"https://api.github.com/repos/wojtek0806/f5-common-python/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wojtek0806/f5-common-python/downloads","issues_url":"https://api.github.com/repos/wojtek0806/f5-common-python/issues{/number}","pulls_url":"https://api.github.com/repos/wojtek0806/f5-common-python/pulls{/number}","milestones_url":"https://api.github.com/repos/wojtek0806/f5-common-python/milestones{/number}","notifications_url":"https://api.github.com/repos/wojtek0806/f5-common-python/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wojtek0806/f5-common-python/labels{/name}","releases_url":"https://api.github.com/repos/wojtek0806/f5-common-python/releases{/id}","deployments_url":"https://api.github.com/repos/wojtek0806/f5-common-python/deployments","created_at":"2016-03-31T13:15:04Z","updated_at":"2016-03-31T13:15:05Z","pushed_at":"2016-06-07T14:35:37Z","git_url":"git://github.com/wojtek0806/f5-common-python.git","ssh_url":"git@github.com:wojtek0806/f5-common-python.git","clone_url":"https://github.com/wojtek0806/f5-common-python.git","svn_url":"https://github.com/wojtek0806/f5-common-python","homepage":"https://f5-sdk.readthedocs.org","size":958,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"0.1"}},"base":{"label":"F5Networks:development","ref":"development","sha":"def3f1db0b862422cd2da68d3fcad34c6295d473","user":{"login":"F5Networks","id":8935905,"avatar_url":"https://avatars.githubusercontent.com/u/8935905?v=3","gravatar_id":"","url":"https://api.github.com/users/F5Networks","html_url":"https://github.com/F5Networks","followers_url":"https://api.github.com/users/F5Networks/followers","following_url":"https://api.github.com/users/F5Networks/following{/other_user}","gists_url":"https://api.github.com/users/F5Networks/gists{/gist_id}","starred_url":"https://api.github.com/users/F5Networks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/F5Networks/subscriptions","organizations_url":"https://api.github.com/users/F5Networks/orgs","repos_url":"https://api.github.com/users/F5Networks/repos","events_url":"https://api.github.com/users/F5Networks/events{/privacy}","received_events_url":"https://api.github.com/users/F5Networks/received_events","type":"Organization","site_admin":false},"repo":{"id":45062555,"name":"f5-common-python","full_name":"F5Networks/f5-common-python","owner":{"login":"F5Networks","id":8935905,"avatar_url":"https://avatars.githubusercontent.com/u/8935905?v=3","gravatar_id":"","url":"https://api.github.com/users/F5Networks","html_url":"https://github.com/F5Networks","followers_url":"https://api.github.com/users/F5Networks/followers","following_url":"https://api.github.com/users/F5Networks/following{/other_user}","gists_url":"https://api.github.com/users/F5Networks/gists{/gist_id}","starred_url":"https://api.github.com/users/F5Networks/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/F5Networks/subscriptions","organizations_url":"https://api.github.com/users/F5Networks/orgs","repos_url":"https://api.github.com/users/F5Networks/repos","events_url":"https://api.github.com/users/F5Networks/events{/privacy}","received_events_url":"https://api.github.com/users/F5Networks/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/F5Networks/f5-common-python","description":"Python SDK for configuration and monitoring of F5® BIG-IP® devices via the iControl® REST API.","fork":false,"url":"https://api.github.com/repos/F5Networks/f5-common-python","forks_url":"https://api.github.com/repos/F5Networks/f5-common-python/forks","keys_url":"https://api.github.com/repos/F5Networks/f5-common-python/keys{/key_id}","collaborators_url":"https://api.github.com/repos/F5Networks/f5-common-python/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/F5Networks/f5-common-python/teams","hooks_url":"https://api.github.com/repos/F5Networks/f5-common-python/hooks","issue_events_url":"https://api.github.com/repos/F5Networks/f5-common-python/issues/events{/number}","events_url":"https://api.github.com/repos/F5Networks/f5-common-python/events","assignees_url":"https://api.github.com/repos/F5Networks/f5-common-python/assignees{/user}","branches_url":"https://api.github.com/repos/F5Networks/f5-common-python/branches{/branch}","tags_url":"https://api.github.com/repos/F5Networks/f5-common-python/tags","blobs_url":"https://api.github.com/repos/F5Networks/f5-common-python/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/F5Networks/f5-common-python/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/F5Networks/f5-common-python/git/refs{/sha}","trees_url":"https://api.github.com/repos/F5Networks/f5-common-python/git/trees{/sha}","statuses_url":"https://api.github.com/repos/F5Networks/f5-common-python/statuses/{sha}","languages_url":"https://api.github.com/repos/F5Networks/f5-common-python/languages","stargazers_url":"https://api.github.com/repos/F5Networks/f5-common-python/stargazers","contributors_url":"https://api.github.com/repos/F5Networks/f5-common-python/contributors","subscribers_url":"https://api.github.com/repos/F5Networks/f5-common-python/subscribers","subscription_url":"https://api.github.com/repos/F5Networks/f5-common-python/subscription","commits_url":"https://api.github.com/repos/F5Networks/f5-common-python/commits{/sha}","git_commits_url":"https://api.github.com/repos/F5Networks/f5-common-python/git/commits{/sha}","comments_url":"https://api.github.com/repos/F5Networks/f5-common-python/comments{/number}","issue_comment_url":"https://api.github.com/repos/F5Networks/f5-common-python/issues/comments{/number}","contents_url":"https://api.github.com/repos/F5Networks/f5-common-python/contents/{+path}","compare_url":"https://api.github.com/repos/F5Networks/f5-common-python/compare/{base}...{head}","merges_url":"https://api.github.com/repos/F5Networks/f5-common-python/merges","archive_url":"https://api.github.com/repos/F5Networks/f5-common-python/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/F5Networks/f5-common-python/downloads","issues_url":"https://api.github.com/repos/F5Networks/f5-common-python/issues{/number}","pulls_url":"https://api.github.com/repos/F5Networks/f5-common-python/pulls{/number}","milestones_url":"https://api.github.com/repos/F5Networks/f5-common-python/milestones{/number}","notifications_url":"https://api.github.com/repos/F5Networks/f5-common-python/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/F5Networks/f5-common-python/labels{/name}","releases_url":"https://api.github.com/repos/F5Networks/f5-common-python/releases{/id}","deployments_url":"https://api.github.com/repos/F5Networks/f5-common-python/deployments","created_at":"2015-10-27T18:48:06Z","updated_at":"2016-06-03T14:40:26Z","pushed_at":"2016-06-07T14:35:38Z","git_url":"git://github.com/F5Networks/f5-common-python.git","ssh_url":"git@github.com:F5Networks/f5-common-python.git","clone_url":"https://github.com/F5Networks/f5-common-python.git","svn_url":"https://github.com/F5Networks/f5-common-python","homepage":"https://f5-sdk.readthedocs.org","size":1054,"stargazers_count":16,"watchers_count":16,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":15,"mirror_url":null,"open_issues_count":40,"forks":15,"open_issues":40,"watchers":16,"default_branch":"development"}},"_links":{"self":{"href":"https://api.github.com/repos/F5Networks/f5-common-python/pulls/486"},"html":{"href":"https://github.com/F5Networks/f5-common-python/pull/486"},"issue":{"href":"https://api.github.com/repos/F5Networks/f5-common-python/issues/486"},"comments":{"href":"https://api.github.com/repos/F5Networks/f5-common-python/issues/486/comments"},"review_comments":{"href":"https://api.github.com/repos/F5Networks/f5-common-python/pulls/486/comments"},"review_comment":{"href":"https://api.github.com/repos/F5Networks/f5-common-python/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/F5Networks/f5-common-python/pulls/486/commits"},"statuses":{"href":"https://api.github.com/repos/F5Networks/f5-common-python/statuses/fa76ba63e795475ddd79bf6fc4d0dc32cb3c4eb5"}}}}
{"actor":{"display_login":"pjbreaux"}}