{"action":"created","comment":{"url":"https://api.github.com/repos/nmstate/nmstate/pulls/comments/215161820","pull_request_review_id":152365366,"id":215161820,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxNTE2MTgyMA==","diff_hunk":"@@ -79,28 +81,33 @@ def prepare_edited_ifaces_configuration(ifaces_desired_state):\n \n \n def set_ifaces_admin_state(ifaces_desired_state):\n+    devs_actions = {}\n     for iface_desired_state in ifaces_desired_state:\n+        devs = _get_devs_from_iface_state(iface_desired_state)\n         if iface_desired_state['state'] == 'up':\n-            _set_dev_state(iface_desired_state, device.activate)\n+            devs_actions.update({dev: device.activate for dev in devs})\n         elif iface_desired_state['state'] == 'down':\n-            _set_dev_state(iface_desired_state, device.delete)\n+            devs_actions.update({dev: device.delete for dev in devs})\n         elif iface_desired_state['state'] == 'absent':\n-            _set_dev_state(iface_desired_state, device.delete)\n+            devs_actions.update({dev: device.delete for dev in devs})\n         else:\n             raise UnsupportedIfaceStateError(iface_desired_state)\n \n+    for dev, action in six.viewitems(devs_actions):\n+        action(dev)\n+\n \n-def _set_dev_state(iface_state, func_action):\n+def _get_devs_from_iface_state(iface_state):\n     nmdev = device.get_device_by_name(iface_state['name'])\n+    devs = []\n     if nmdev:\n-        devs = [nmdev]\n+        devs += [nmdev]","path":"libnmstate/nm/applier.py","position":38,"original_position":38,"commit_id":"dd2ba20b1665df0d32385f7344e1ce3d5f37193a","original_commit_id":"dd2ba20b1665df0d32385f7344e1ce3d5f37193a","user":{"login":"EdDev","id":9546119,"node_id":"MDQ6VXNlcjk1NDYxMTk=","avatar_url":"https://avatars1.githubusercontent.com/u/9546119?v=4","gravatar_id":"","url":"https://api.github.com/users/EdDev","html_url":"https://github.com/EdDev","followers_url":"https://api.github.com/users/EdDev/followers","following_url":"https://api.github.com/users/EdDev/following{/other_user}","gists_url":"https://api.github.com/users/EdDev/gists{/gist_id}","starred_url":"https://api.github.com/users/EdDev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/EdDev/subscriptions","organizations_url":"https://api.github.com/users/EdDev/orgs","repos_url":"https://api.github.com/users/EdDev/repos","events_url":"https://api.github.com/users/EdDev/events{/privacy}","received_events_url":"https://api.github.com/users/EdDev/received_events","type":"User","site_admin":false},"body":"Just to express it is already defined. After it was defined at the top, one may assume it will not get overwritten afterwards. Feels safer for future changes.","created_at":"2018-09-05T07:30:12Z","updated_at":"2018-09-05T07:30:13Z","html_url":"https://github.com/nmstate/nmstate/pull/65#discussion_r215161820","pull_request_url":"https://api.github.com/repos/nmstate/nmstate/pulls/65","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/nmstate/nmstate/pulls/comments/215161820"},"html":{"href":"https://github.com/nmstate/nmstate/pull/65#discussion_r215161820"},"pull_request":{"href":"https://api.github.com/repos/nmstate/nmstate/pulls/65"}},"in_reply_to_id":214745638},"pull_request":{"url":"https://api.github.com/repos/nmstate/nmstate/pulls/65","id":212592189,"node_id":"MDExOlB1bGxSZXF1ZXN0MjEyNTkyMTg5","html_url":"https://github.com/nmstate/nmstate/pull/65","diff_url":"https://github.com/nmstate/nmstate/pull/65.diff","patch_url":"https://github.com/nmstate/nmstate/pull/65.patch","issue_url":"https://api.github.com/repos/nmstate/nmstate/issues/65","number":65,"state":"open","locked":false,"title":"Set admin state once when master/slave interfaces are involved","user":{"login":"EdDev","id":9546119,"node_id":"MDQ6VXNlcjk1NDYxMTk=","avatar_url":"https://avatars1.githubusercontent.com/u/9546119?v=4","gravatar_id":"","url":"https://api.github.com/users/EdDev","html_url":"https://github.com/EdDev","followers_url":"https://api.github.com/users/EdDev/followers","following_url":"https://api.github.com/users/EdDev/following{/other_user}","gists_url":"https://api.github.com/users/EdDev/gists{/gist_id}","starred_url":"https://api.github.com/users/EdDev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/EdDev/subscriptions","organizations_url":"https://api.github.com/users/EdDev/orgs","repos_url":"https://api.github.com/users/EdDev/repos","events_url":"https://api.github.com/users/EdDev/events{/privacy}","received_events_url":"https://api.github.com/users/EdDev/received_events","type":"User","site_admin":false},"body":"When there are bonds or OVS bridges, the current admin-state handling may execute an activation/deactivation multiple times on a single iface (on slaves in particular).\r\n\r\nWe should avoid this and perform the action once per device.","created_at":"2018-09-02T13:12:58Z","updated_at":"2018-09-05T07:30:13Z","closed_at":null,"merged_at":null,"merge_commit_sha":"fee1d29f7f11931f1d1bc71e74f4a680d8c04dcc","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/nmstate/nmstate/pulls/65/commits","review_comments_url":"https://api.github.com/repos/nmstate/nmstate/pulls/65/comments","review_comment_url":"https://api.github.com/repos/nmstate/nmstate/pulls/comments{/number}","comments_url":"https://api.github.com/repos/nmstate/nmstate/issues/65/comments","statuses_url":"https://api.github.com/repos/nmstate/nmstate/statuses/dd2ba20b1665df0d32385f7344e1ce3d5f37193a","head":{"label":"EdDev:set-admin-state-once","ref":"set-admin-state-once","sha":"dd2ba20b1665df0d32385f7344e1ce3d5f37193a","user":{"login":"EdDev","id":9546119,"node_id":"MDQ6VXNlcjk1NDYxMTk=","avatar_url":"https://avatars1.githubusercontent.com/u/9546119?v=4","gravatar_id":"","url":"https://api.github.com/users/EdDev","html_url":"https://github.com/EdDev","followers_url":"https://api.github.com/users/EdDev/followers","following_url":"https://api.github.com/users/EdDev/following{/other_user}","gists_url":"https://api.github.com/users/EdDev/gists{/gist_id}","starred_url":"https://api.github.com/users/EdDev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/EdDev/subscriptions","organizations_url":"https://api.github.com/users/EdDev/orgs","repos_url":"https://api.github.com/users/EdDev/repos","events_url":"https://api.github.com/users/EdDev/events{/privacy}","received_events_url":"https://api.github.com/users/EdDev/received_events","type":"User","site_admin":false},"repo":{"id":133216954,"node_id":"MDEwOlJlcG9zaXRvcnkxMzMyMTY5NTQ=","name":"nmstate","full_name":"EdDev/nmstate","owner":{"login":"EdDev","id":9546119,"node_id":"MDQ6VXNlcjk1NDYxMTk=","avatar_url":"https://avatars1.githubusercontent.com/u/9546119?v=4","gravatar_id":"","url":"https://api.github.com/users/EdDev","html_url":"https://github.com/EdDev","followers_url":"https://api.github.com/users/EdDev/followers","following_url":"https://api.github.com/users/EdDev/following{/other_user}","gists_url":"https://api.github.com/users/EdDev/gists{/gist_id}","starred_url":"https://api.github.com/users/EdDev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/EdDev/subscriptions","organizations_url":"https://api.github.com/users/EdDev/orgs","repos_url":"https://api.github.com/users/EdDev/repos","events_url":"https://api.github.com/users/EdDev/events{/privacy}","received_events_url":"https://api.github.com/users/EdDev/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/EdDev/nmstate","description":null,"fork":true,"url":"https://api.github.com/repos/EdDev/nmstate","forks_url":"https://api.github.com/repos/EdDev/nmstate/forks","keys_url":"https://api.github.com/repos/EdDev/nmstate/keys{/key_id}","collaborators_url":"https://api.github.com/repos/EdDev/nmstate/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/EdDev/nmstate/teams","hooks_url":"https://api.github.com/repos/EdDev/nmstate/hooks","issue_events_url":"https://api.github.com/repos/EdDev/nmstate/issues/events{/number}","events_url":"https://api.github.com/repos/EdDev/nmstate/events","assignees_url":"https://api.github.com/repos/EdDev/nmstate/assignees{/user}","branches_url":"https://api.github.com/repos/EdDev/nmstate/branches{/branch}","tags_url":"https://api.github.com/repos/EdDev/nmstate/tags","blobs_url":"https://api.github.com/repos/EdDev/nmstate/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/EdDev/nmstate/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/EdDev/nmstate/git/refs{/sha}","trees_url":"https://api.github.com/repos/EdDev/nmstate/git/trees{/sha}","statuses_url":"https://api.github.com/repos/EdDev/nmstate/statuses/{sha}","languages_url":"https://api.github.com/repos/EdDev/nmstate/languages","stargazers_url":"https://api.github.com/repos/EdDev/nmstate/stargazers","contributors_url":"https://api.github.com/repos/EdDev/nmstate/contributors","subscribers_url":"https://api.github.com/repos/EdDev/nmstate/subscribers","subscription_url":"https://api.github.com/repos/EdDev/nmstate/subscription","commits_url":"https://api.github.com/repos/EdDev/nmstate/commits{/sha}","git_commits_url":"https://api.github.com/repos/EdDev/nmstate/git/commits{/sha}","comments_url":"https://api.github.com/repos/EdDev/nmstate/comments{/number}","issue_comment_url":"https://api.github.com/repos/EdDev/nmstate/issues/comments{/number}","contents_url":"https://api.github.com/repos/EdDev/nmstate/contents/{+path}","compare_url":"https://api.github.com/repos/EdDev/nmstate/compare/{base}...{head}","merges_url":"https://api.github.com/repos/EdDev/nmstate/merges","archive_url":"https://api.github.com/repos/EdDev/nmstate/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/EdDev/nmstate/downloads","issues_url":"https://api.github.com/repos/EdDev/nmstate/issues{/number}","pulls_url":"https://api.github.com/repos/EdDev/nmstate/pulls{/number}","milestones_url":"https://api.github.com/repos/EdDev/nmstate/milestones{/number}","notifications_url":"https://api.github.com/repos/EdDev/nmstate/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/EdDev/nmstate/labels{/name}","releases_url":"https://api.github.com/repos/EdDev/nmstate/releases{/id}","deployments_url":"https://api.github.com/repos/EdDev/nmstate/deployments","created_at":"2018-05-13T07:58:22Z","updated_at":"2018-07-25T13:49:31Z","pushed_at":"2018-09-03T13:53:31Z","git_url":"git://github.com/EdDev/nmstate.git","ssh_url":"git@github.com:EdDev/nmstate.git","clone_url":"https://github.com/EdDev/nmstate.git","svn_url":"https://github.com/EdDev/nmstate","homepage":null,"size":142,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"gpl-2.0","name":"GNU General Public License v2.0","spdx_id":"GPL-2.0","url":"https://api.github.com/licenses/gpl-2.0","node_id":"MDc6TGljZW5zZTg="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"nmstate:master","ref":"master","sha":"41c39d4938baab35ec9576279a5d245145d2e416","user":{"login":"nmstate","id":39068239,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM5MDY4MjM5","avatar_url":"https://avatars0.githubusercontent.com/u/39068239?v=4","gravatar_id":"","url":"https://api.github.com/users/nmstate","html_url":"https://github.com/nmstate","followers_url":"https://api.github.com/users/nmstate/followers","following_url":"https://api.github.com/users/nmstate/following{/other_user}","gists_url":"https://api.github.com/users/nmstate/gists{/gist_id}","starred_url":"https://api.github.com/users/nmstate/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nmstate/subscriptions","organizations_url":"https://api.github.com/users/nmstate/orgs","repos_url":"https://api.github.com/users/nmstate/repos","events_url":"https://api.github.com/users/nmstate/events{/privacy}","received_events_url":"https://api.github.com/users/nmstate/received_events","type":"Organization","site_admin":false},"repo":{"id":132556280,"node_id":"MDEwOlJlcG9zaXRvcnkxMzI1NTYyODA=","name":"nmstate","full_name":"nmstate/nmstate","owner":{"login":"nmstate","id":39068239,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM5MDY4MjM5","avatar_url":"https://avatars0.githubusercontent.com/u/39068239?v=4","gravatar_id":"","url":"https://api.github.com/users/nmstate","html_url":"https://github.com/nmstate","followers_url":"https://api.github.com/users/nmstate/followers","following_url":"https://api.github.com/users/nmstate/following{/other_user}","gists_url":"https://api.github.com/users/nmstate/gists{/gist_id}","starred_url":"https://api.github.com/users/nmstate/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nmstate/subscriptions","organizations_url":"https://api.github.com/users/nmstate/orgs","repos_url":"https://api.github.com/users/nmstate/repos","events_url":"https://api.github.com/users/nmstate/events{/privacy}","received_events_url":"https://api.github.com/users/nmstate/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/nmstate/nmstate","description":"A declarative network manager API for hosts","fork":false,"url":"https://api.github.com/repos/nmstate/nmstate","forks_url":"https://api.github.com/repos/nmstate/nmstate/forks","keys_url":"https://api.github.com/repos/nmstate/nmstate/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nmstate/nmstate/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nmstate/nmstate/teams","hooks_url":"https://api.github.com/repos/nmstate/nmstate/hooks","issue_events_url":"https://api.github.com/repos/nmstate/nmstate/issues/events{/number}","events_url":"https://api.github.com/repos/nmstate/nmstate/events","assignees_url":"https://api.github.com/repos/nmstate/nmstate/assignees{/user}","branches_url":"https://api.github.com/repos/nmstate/nmstate/branches{/branch}","tags_url":"https://api.github.com/repos/nmstate/nmstate/tags","blobs_url":"https://api.github.com/repos/nmstate/nmstate/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nmstate/nmstate/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nmstate/nmstate/git/refs{/sha}","trees_url":"https://api.github.com/repos/nmstate/nmstate/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nmstate/nmstate/statuses/{sha}","languages_url":"https://api.github.com/repos/nmstate/nmstate/languages","stargazers_url":"https://api.github.com/repos/nmstate/nmstate/stargazers","contributors_url":"https://api.github.com/repos/nmstate/nmstate/contributors","subscribers_url":"https://api.github.com/repos/nmstate/nmstate/subscribers","subscription_url":"https://api.github.com/repos/nmstate/nmstate/subscription","commits_url":"https://api.github.com/repos/nmstate/nmstate/commits{/sha}","git_commits_url":"https://api.github.com/repos/nmstate/nmstate/git/commits{/sha}","comments_url":"https://api.github.com/repos/nmstate/nmstate/comments{/number}","issue_comment_url":"https://api.github.com/repos/nmstate/nmstate/issues/comments{/number}","contents_url":"https://api.github.com/repos/nmstate/nmstate/contents/{+path}","compare_url":"https://api.github.com/repos/nmstate/nmstate/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nmstate/nmstate/merges","archive_url":"https://api.github.com/repos/nmstate/nmstate/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nmstate/nmstate/downloads","issues_url":"https://api.github.com/repos/nmstate/nmstate/issues{/number}","pulls_url":"https://api.github.com/repos/nmstate/nmstate/pulls{/number}","milestones_url":"https://api.github.com/repos/nmstate/nmstate/milestones{/number}","notifications_url":"https://api.github.com/repos/nmstate/nmstate/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nmstate/nmstate/labels{/name}","releases_url":"https://api.github.com/repos/nmstate/nmstate/releases{/id}","deployments_url":"https://api.github.com/repos/nmstate/nmstate/deployments","created_at":"2018-05-08T05:02:22Z","updated_at":"2018-09-04T14:02:47Z","pushed_at":"2018-09-04T18:56:48Z","git_url":"git://github.com/nmstate/nmstate.git","ssh_url":"git@github.com:nmstate/nmstate.git","clone_url":"https://github.com/nmstate/nmstate.git","svn_url":"https://github.com/nmstate/nmstate","homepage":"https://nmstate.github.io","size":129,"stargazers_count":5,"watchers_count":5,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"archived":false,"open_issues_count":14,"license":{"key":"gpl-2.0","name":"GNU General Public License v2.0","spdx_id":"GPL-2.0","url":"https://api.github.com/licenses/gpl-2.0","node_id":"MDc6TGljZW5zZTg="},"forks":4,"open_issues":14,"watchers":5,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/nmstate/nmstate/pulls/65"},"html":{"href":"https://github.com/nmstate/nmstate/pull/65"},"issue":{"href":"https://api.github.com/repos/nmstate/nmstate/issues/65"},"comments":{"href":"https://api.github.com/repos/nmstate/nmstate/issues/65/comments"},"review_comments":{"href":"https://api.github.com/repos/nmstate/nmstate/pulls/65/comments"},"review_comment":{"href":"https://api.github.com/repos/nmstate/nmstate/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/nmstate/nmstate/pulls/65/commits"},"statuses":{"href":"https://api.github.com/repos/nmstate/nmstate/statuses/dd2ba20b1665df0d32385f7344e1ce3d5f37193a"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"EdDev"}}