{"action":"created","comment":{"url":"https://api.github.com/repos/crowbar/crowbar-core/pulls/comments/80496973","id":80496973,"diff_hunk":"@@ -0,0 +1,323 @@\n+#\n+# Copyright 2011-2013, Dell\n+# Copyright 2014, SUSE LINUX Products GmbH\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\");\n+# you may not use this file except in compliance with the License.\n+# You may obtain a copy of the License at\n+#\n+#  http://www.apache.org/licenses/LICENSE-2.0\n+#\n+# Unless required by applicable law or agreed to in writing, software\n+# distributed under the License is distributed on an \"AS IS\" BASIS,\n+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+# See the License for the specific language governing permissions and\n+# limitations under the License.\n+#\n+\n+module Crowbar\n+  module ConduitResolver\n+\n+    ### Public methods\n+\n+    ## Bus order for this node\n+    # It depends on the DMI information of the node.\n+    def bus_order\n+      @bus_order ||= begin\n+        result = nil\n+\n+        if cr_network_config.has_key?(\"interface_map\")\n+          cr_network_config[\"interface_map\"].each do |data|\n+            next unless cr_dmi_system[\"product_name\"] =~ /#{data[\"pattern\"]}/\n+            next if data.has_key?(\"serial_number\") && cr_dmi_system[\"serial_number\"].strip != data[\"serial_number\"].strip\n+\n+            result = data[\"bus_order\"]\n+            break\n+          end\n+        end\n+\n+        result || []\n+      end\n+    end\n+\n+    ## List of interfaces, sorted by the interface map\n+    def sorted_ifs\n+      @sorted_ifs ||= begin\n+        cr_ohai_network.sort{ |a, b|\n+          aindex = bus_index(a[1][\"path\"])\n+          bindex = bus_index(b[1][\"path\"])\n+          aindex == bindex ? a[0] <=> b[0] : aindex <=> bindex\n+        }.map{ |x| x[0] }\n+      end\n+    end\n+\n+    ## Conduit list for this node.\n+    # This depends on the network mode, number of interfaces, and roles of\n+    # the node\n+    def conduits\n+      @conduits ||= begin\n+        result = nil\n+\n+        if cr_network_config.has_key?(\"conduit_map\")\n+          cr_network_config[\"conduit_map\"].each do |data|\n+            # conduit pattern format:  <mode>/#nics/role-pattern\n+            parts = data[\"pattern\"].split(\"/\")\n+\n+            ### find the right conduit mapping to be used based on the conduit's pattern and node info.\n+            matches = true\n+\n+            # check that the networking config mode (e.g. single/dual/team/etc) matches\n+            matches = false unless cr_network_config[\"mode\"] =~ /#{parts[0]}/\n+\n+            # check that the # of detected NIC's on the node matches.\n+            matches = false unless cr_ohai_network.size.to_s =~ /#{parts[1]}/\n+\n+            # check that the node has one matching role\n+            matches = false if cr_node_roles.none?{|role| role =~ /#{parts[2]}/}","path":"crowbar_framework/lib/crowbar/conduit_resolver.rb","position":76,"original_position":76,"commit_id":"14073034b788cdbe124326dd2e46277368696f99","original_commit_id":"14073034b788cdbe124326dd2e46277368696f99","user":{"login":"houndci-bot","id":6697940,"avatar_url":"https://avatars.githubusercontent.com/u/6697940?v=3","gravatar_id":"","url":"https://api.github.com/users/houndci-bot","html_url":"https://github.com/houndci-bot","followers_url":"https://api.github.com/users/houndci-bot/followers","following_url":"https://api.github.com/users/houndci-bot/following{/other_user}","gists_url":"https://api.github.com/users/houndci-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci-bot/subscriptions","organizations_url":"https://api.github.com/users/houndci-bot/orgs","repos_url":"https://api.github.com/users/houndci-bot/repos","events_url":"https://api.github.com/users/houndci-bot/events{/privacy}","received_events_url":"https://api.github.com/users/houndci-bot/received_events","type":"User","site_admin":false},"body":"Style/SpaceBeforeBlockBraces: Space missing to the left of {.<br>Style/SpaceInsideBlockBraces: Space between { and | missing.<br>Style/SpaceInsideBlockBraces: Space missing inside }.","created_at":"2016-09-26T15:08:15Z","updated_at":"2016-09-26T15:08:15Z","html_url":"https://github.com/crowbar/crowbar-core/pull/681#discussion_r80496973","pull_request_url":"https://api.github.com/repos/crowbar/crowbar-core/pulls/681","_links":{"self":{"href":"https://api.github.com/repos/crowbar/crowbar-core/pulls/comments/80496973"},"html":{"href":"https://github.com/crowbar/crowbar-core/pull/681#discussion_r80496973"},"pull_request":{"href":"https://api.github.com/repos/crowbar/crowbar-core/pulls/681"}}},"pull_request":{"url":"https://api.github.com/repos/crowbar/crowbar-core/pulls/681","id":86760817,"html_url":"https://github.com/crowbar/crowbar-core/pull/681","diff_url":"https://github.com/crowbar/crowbar-core/pull/681.diff","patch_url":"https://github.com/crowbar/crowbar-core/pull/681.patch","issue_url":"https://api.github.com/repos/crowbar/crowbar-core/issues/681","number":681,"state":"open","locked":false,"title":"Move some network code to a libary shared between chef and crowbar","user":{"login":"rhafer","id":373399,"avatar_url":"https://avatars.githubusercontent.com/u/373399?v=3","gravatar_id":"","url":"https://api.github.com/users/rhafer","html_url":"https://github.com/rhafer","followers_url":"https://api.github.com/users/rhafer/followers","following_url":"https://api.github.com/users/rhafer/following{/other_user}","gists_url":"https://api.github.com/users/rhafer/gists{/gist_id}","starred_url":"https://api.github.com/users/rhafer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rhafer/subscriptions","organizations_url":"https://api.github.com/users/rhafer/orgs","repos_url":"https://api.github.com/users/rhafer/repos","events_url":"https://api.github.com/users/rhafer/events{/privacy}","received_events_url":"https://api.github.com/users/rhafer/received_events","type":"User","site_admin":false},"body":"There a still some missing pieces\r\n\r\n- [ ] add network-json-resolv cli tool\r\n- [ ] adjust test-cases chef/cookbooks/barclamp/libraries/test.rb\r\n- [ ] testing with some different networking setups","created_at":"2016-09-26T15:08:00Z","updated_at":"2016-09-26T15:08:16Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0a39c78626f32fe3b5d839c1678bdd41f8f56ec9","assignee":{"login":"vuntz","id":1758783,"avatar_url":"https://avatars.githubusercontent.com/u/1758783?v=3","gravatar_id":"","url":"https://api.github.com/users/vuntz","html_url":"https://github.com/vuntz","followers_url":"https://api.github.com/users/vuntz/followers","following_url":"https://api.github.com/users/vuntz/following{/other_user}","gists_url":"https://api.github.com/users/vuntz/gists{/gist_id}","starred_url":"https://api.github.com/users/vuntz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vuntz/subscriptions","organizations_url":"https://api.github.com/users/vuntz/orgs","repos_url":"https://api.github.com/users/vuntz/repos","events_url":"https://api.github.com/users/vuntz/events{/privacy}","received_events_url":"https://api.github.com/users/vuntz/received_events","type":"User","site_admin":false},"assignees":[{"login":"vuntz","id":1758783,"avatar_url":"https://avatars.githubusercontent.com/u/1758783?v=3","gravatar_id":"","url":"https://api.github.com/users/vuntz","html_url":"https://github.com/vuntz","followers_url":"https://api.github.com/users/vuntz/followers","following_url":"https://api.github.com/users/vuntz/following{/other_user}","gists_url":"https://api.github.com/users/vuntz/gists{/gist_id}","starred_url":"https://api.github.com/users/vuntz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vuntz/subscriptions","organizations_url":"https://api.github.com/users/vuntz/orgs","repos_url":"https://api.github.com/users/vuntz/repos","events_url":"https://api.github.com/users/vuntz/events{/privacy}","received_events_url":"https://api.github.com/users/vuntz/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/crowbar/crowbar-core/pulls/681/commits","review_comments_url":"https://api.github.com/repos/crowbar/crowbar-core/pulls/681/comments","review_comment_url":"https://api.github.com/repos/crowbar/crowbar-core/pulls/comments{/number}","comments_url":"https://api.github.com/repos/crowbar/crowbar-core/issues/681/comments","statuses_url":"https://api.github.com/repos/crowbar/crowbar-core/statuses/14073034b788cdbe124326dd2e46277368696f99","head":{"label":"rhafer:conduitresolver-lib","ref":"conduitresolver-lib","sha":"14073034b788cdbe124326dd2e46277368696f99","user":{"login":"rhafer","id":373399,"avatar_url":"https://avatars.githubusercontent.com/u/373399?v=3","gravatar_id":"","url":"https://api.github.com/users/rhafer","html_url":"https://github.com/rhafer","followers_url":"https://api.github.com/users/rhafer/followers","following_url":"https://api.github.com/users/rhafer/following{/other_user}","gists_url":"https://api.github.com/users/rhafer/gists{/gist_id}","starred_url":"https://api.github.com/users/rhafer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rhafer/subscriptions","organizations_url":"https://api.github.com/users/rhafer/orgs","repos_url":"https://api.github.com/users/rhafer/repos","events_url":"https://api.github.com/users/rhafer/events{/privacy}","received_events_url":"https://api.github.com/users/rhafer/received_events","type":"User","site_admin":false},"repo":{"id":41904098,"name":"crowbar-core","full_name":"rhafer/crowbar-core","owner":{"login":"rhafer","id":373399,"avatar_url":"https://avatars.githubusercontent.com/u/373399?v=3","gravatar_id":"","url":"https://api.github.com/users/rhafer","html_url":"https://github.com/rhafer","followers_url":"https://api.github.com/users/rhafer/followers","following_url":"https://api.github.com/users/rhafer/following{/other_user}","gists_url":"https://api.github.com/users/rhafer/gists{/gist_id}","starred_url":"https://api.github.com/users/rhafer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rhafer/subscriptions","organizations_url":"https://api.github.com/users/rhafer/orgs","repos_url":"https://api.github.com/users/rhafer/repos","events_url":"https://api.github.com/users/rhafer/events{/privacy}","received_events_url":"https://api.github.com/users/rhafer/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/rhafer/crowbar-core","description":"Core deployment for Crowbar","fork":true,"url":"https://api.github.com/repos/rhafer/crowbar-core","forks_url":"https://api.github.com/repos/rhafer/crowbar-core/forks","keys_url":"https://api.github.com/repos/rhafer/crowbar-core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/rhafer/crowbar-core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/rhafer/crowbar-core/teams","hooks_url":"https://api.github.com/repos/rhafer/crowbar-core/hooks","issue_events_url":"https://api.github.com/repos/rhafer/crowbar-core/issues/events{/number}","events_url":"https://api.github.com/repos/rhafer/crowbar-core/events","assignees_url":"https://api.github.com/repos/rhafer/crowbar-core/assignees{/user}","branches_url":"https://api.github.com/repos/rhafer/crowbar-core/branches{/branch}","tags_url":"https://api.github.com/repos/rhafer/crowbar-core/tags","blobs_url":"https://api.github.com/repos/rhafer/crowbar-core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/rhafer/crowbar-core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/rhafer/crowbar-core/git/refs{/sha}","trees_url":"https://api.github.com/repos/rhafer/crowbar-core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/rhafer/crowbar-core/statuses/{sha}","languages_url":"https://api.github.com/repos/rhafer/crowbar-core/languages","stargazers_url":"https://api.github.com/repos/rhafer/crowbar-core/stargazers","contributors_url":"https://api.github.com/repos/rhafer/crowbar-core/contributors","subscribers_url":"https://api.github.com/repos/rhafer/crowbar-core/subscribers","subscription_url":"https://api.github.com/repos/rhafer/crowbar-core/subscription","commits_url":"https://api.github.com/repos/rhafer/crowbar-core/commits{/sha}","git_commits_url":"https://api.github.com/repos/rhafer/crowbar-core/git/commits{/sha}","comments_url":"https://api.github.com/repos/rhafer/crowbar-core/comments{/number}","issue_comment_url":"https://api.github.com/repos/rhafer/crowbar-core/issues/comments{/number}","contents_url":"https://api.github.com/repos/rhafer/crowbar-core/contents/{+path}","compare_url":"https://api.github.com/repos/rhafer/crowbar-core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/rhafer/crowbar-core/merges","archive_url":"https://api.github.com/repos/rhafer/crowbar-core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/rhafer/crowbar-core/downloads","issues_url":"https://api.github.com/repos/rhafer/crowbar-core/issues{/number}","pulls_url":"https://api.github.com/repos/rhafer/crowbar-core/pulls{/number}","milestones_url":"https://api.github.com/repos/rhafer/crowbar-core/milestones{/number}","notifications_url":"https://api.github.com/repos/rhafer/crowbar-core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/rhafer/crowbar-core/labels{/name}","releases_url":"https://api.github.com/repos/rhafer/crowbar-core/releases{/id}","deployments_url":"https://api.github.com/repos/rhafer/crowbar-core/deployments","created_at":"2015-09-04T07:52:16Z","updated_at":"2015-09-04T07:52:18Z","pushed_at":"2016-09-26T15:04:24Z","git_url":"git://github.com/rhafer/crowbar-core.git","ssh_url":"git@github.com:rhafer/crowbar-core.git","clone_url":"https://github.com/rhafer/crowbar-core.git","svn_url":"https://github.com/rhafer/crowbar-core","homepage":null,"size":105962,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"crowbar:master","ref":"master","sha":"ccf3d97a4fb8bdf04b61c4b98b5c1a569b22a547","user":{"login":"crowbar","id":2910205,"avatar_url":"https://avatars.githubusercontent.com/u/2910205?v=3","gravatar_id":"","url":"https://api.github.com/users/crowbar","html_url":"https://github.com/crowbar","followers_url":"https://api.github.com/users/crowbar/followers","following_url":"https://api.github.com/users/crowbar/following{/other_user}","gists_url":"https://api.github.com/users/crowbar/gists{/gist_id}","starred_url":"https://api.github.com/users/crowbar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/crowbar/subscriptions","organizations_url":"https://api.github.com/users/crowbar/orgs","repos_url":"https://api.github.com/users/crowbar/repos","events_url":"https://api.github.com/users/crowbar/events{/privacy}","received_events_url":"https://api.github.com/users/crowbar/received_events","type":"Organization","site_admin":false},"repo":{"id":39003227,"name":"crowbar-core","full_name":"crowbar/crowbar-core","owner":{"login":"crowbar","id":2910205,"avatar_url":"https://avatars.githubusercontent.com/u/2910205?v=3","gravatar_id":"","url":"https://api.github.com/users/crowbar","html_url":"https://github.com/crowbar","followers_url":"https://api.github.com/users/crowbar/followers","following_url":"https://api.github.com/users/crowbar/following{/other_user}","gists_url":"https://api.github.com/users/crowbar/gists{/gist_id}","starred_url":"https://api.github.com/users/crowbar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/crowbar/subscriptions","organizations_url":"https://api.github.com/users/crowbar/orgs","repos_url":"https://api.github.com/users/crowbar/repos","events_url":"https://api.github.com/users/crowbar/events{/privacy}","received_events_url":"https://api.github.com/users/crowbar/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/crowbar/crowbar-core","description":"Core deployment for Crowbar","fork":false,"url":"https://api.github.com/repos/crowbar/crowbar-core","forks_url":"https://api.github.com/repos/crowbar/crowbar-core/forks","keys_url":"https://api.github.com/repos/crowbar/crowbar-core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/crowbar/crowbar-core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/crowbar/crowbar-core/teams","hooks_url":"https://api.github.com/repos/crowbar/crowbar-core/hooks","issue_events_url":"https://api.github.com/repos/crowbar/crowbar-core/issues/events{/number}","events_url":"https://api.github.com/repos/crowbar/crowbar-core/events","assignees_url":"https://api.github.com/repos/crowbar/crowbar-core/assignees{/user}","branches_url":"https://api.github.com/repos/crowbar/crowbar-core/branches{/branch}","tags_url":"https://api.github.com/repos/crowbar/crowbar-core/tags","blobs_url":"https://api.github.com/repos/crowbar/crowbar-core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/crowbar/crowbar-core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/crowbar/crowbar-core/git/refs{/sha}","trees_url":"https://api.github.com/repos/crowbar/crowbar-core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/crowbar/crowbar-core/statuses/{sha}","languages_url":"https://api.github.com/repos/crowbar/crowbar-core/languages","stargazers_url":"https://api.github.com/repos/crowbar/crowbar-core/stargazers","contributors_url":"https://api.github.com/repos/crowbar/crowbar-core/contributors","subscribers_url":"https://api.github.com/repos/crowbar/crowbar-core/subscribers","subscription_url":"https://api.github.com/repos/crowbar/crowbar-core/subscription","commits_url":"https://api.github.com/repos/crowbar/crowbar-core/commits{/sha}","git_commits_url":"https://api.github.com/repos/crowbar/crowbar-core/git/commits{/sha}","comments_url":"https://api.github.com/repos/crowbar/crowbar-core/comments{/number}","issue_comment_url":"https://api.github.com/repos/crowbar/crowbar-core/issues/comments{/number}","contents_url":"https://api.github.com/repos/crowbar/crowbar-core/contents/{+path}","compare_url":"https://api.github.com/repos/crowbar/crowbar-core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/crowbar/crowbar-core/merges","archive_url":"https://api.github.com/repos/crowbar/crowbar-core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/crowbar/crowbar-core/downloads","issues_url":"https://api.github.com/repos/crowbar/crowbar-core/issues{/number}","pulls_url":"https://api.github.com/repos/crowbar/crowbar-core/pulls{/number}","milestones_url":"https://api.github.com/repos/crowbar/crowbar-core/milestones{/number}","notifications_url":"https://api.github.com/repos/crowbar/crowbar-core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/crowbar/crowbar-core/labels{/name}","releases_url":"https://api.github.com/repos/crowbar/crowbar-core/releases{/id}","deployments_url":"https://api.github.com/repos/crowbar/crowbar-core/deployments","created_at":"2015-07-13T09:31:28Z","updated_at":"2016-04-10T12:47:20Z","pushed_at":"2016-09-26T15:08:00Z","git_url":"git://github.com/crowbar/crowbar-core.git","ssh_url":"git@github.com:crowbar/crowbar-core.git","clone_url":"https://github.com/crowbar/crowbar-core.git","svn_url":"https://github.com/crowbar/crowbar-core","homepage":null,"size":121329,"stargazers_count":6,"watchers_count":6,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":34,"mirror_url":null,"open_issues_count":42,"forks":34,"open_issues":42,"watchers":6,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/crowbar/crowbar-core/pulls/681"},"html":{"href":"https://github.com/crowbar/crowbar-core/pull/681"},"issue":{"href":"https://api.github.com/repos/crowbar/crowbar-core/issues/681"},"comments":{"href":"https://api.github.com/repos/crowbar/crowbar-core/issues/681/comments"},"review_comments":{"href":"https://api.github.com/repos/crowbar/crowbar-core/pulls/681/comments"},"review_comment":{"href":"https://api.github.com/repos/crowbar/crowbar-core/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/crowbar/crowbar-core/pulls/681/commits"},"statuses":{"href":"https://api.github.com/repos/crowbar/crowbar-core/statuses/14073034b788cdbe124326dd2e46277368696f99"}}}}
{"actor":{"display_login":"houndci-bot"}}