{"action":"created","comment":{"url":"https://api.github.com/repos/cisco/cisco-network-node-utils/pulls/comments/56067341","id":56067341,"diff_hunk":"@@ -66,27 +80,77 @@ def self.detect_vrf\n     end\n \n     def self.install(pkg, vrf=nil)\n-      vrf = vrf.nil? ? detect_vrf : \"vrf #{vrf}\"\n-      config_set('yum', 'install', pkg, vrf)\n+      if platform == :nexus\n+        vrf = vrf.nil? ? detect_vrf : \"vrf #{vrf}\"\n+        config_set('yum', 'install', pkg, vrf)\n \n-      # HACK: The current nxos host installer is a multi-part command\n-      # which may fail at a later stage yet return a false positive;\n-      # therefore a post-validation check is needed here to verify the\n-      # actual outcome.\n+      elsif platform == :ios_xr\n+        filename = pkg.strip.tr(':', '/').split('/').last\n+        pkg_info = Yum.decompose_name(filename)\n+        if pkg_info\n+          pkg_name = \"#{pkg_info[1]}-#{pkg_info[2]}-#{pkg_info[3]}\"\n+          debug \"Installing package #{pkg_name}\"\n+          rc = `#{EXEC_IN_DEFAULT_NS} sdr_instcmd install activate pkg 0x0 \\\n+          #{pkg_name}`\n+          debug \"install activate #{pkg_name} : #{rc}\"\n+          rc = `#{EXEC_IN_DEFAULT_NS} sdr_instcmd install commit sdr`\n+          debug \"install commit sdr : #{rc}\"\n+        end\n+      end\n+      # post-validation check to verify the outcome.\n       validate(pkg)\n     end\n \n     # returns version of package, or false if package doesn't exist\n-    def self.query(pkg)\n-      fail TypeError unless pkg.is_a? String\n-      fail ArgumentError if pkg.empty?\n-      b = config_get('yum', 'query', pkg)\n-      fail \"Multiple matching packages found for #{pkg}\" if b && b.size > 1\n+    def self.query(pkg, src)\n+      if platform == :nexus\n+        fail TypeError unless pkg.is_a? String\n+        fail ArgumentError if pkg.empty?","path":"lib/cisco_node_utils/yum.rb","position":86,"original_position":86,"commit_id":"66762946306cd10d3add62c6e8b2592fc7addd3e","original_commit_id":"66762946306cd10d3add62c6e8b2592fc7addd3e","user":{"login":"glennmatthews","id":5603551,"avatar_url":"https://avatars.githubusercontent.com/u/5603551?v=3","gravatar_id":"","url":"https://api.github.com/users/glennmatthews","html_url":"https://github.com/glennmatthews","followers_url":"https://api.github.com/users/glennmatthews/followers","following_url":"https://api.github.com/users/glennmatthews/following{/other_user}","gists_url":"https://api.github.com/users/glennmatthews/gists{/gist_id}","starred_url":"https://api.github.com/users/glennmatthews/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/glennmatthews/subscriptions","organizations_url":"https://api.github.com/users/glennmatthews/orgs","repos_url":"https://api.github.com/users/glennmatthews/repos","events_url":"https://api.github.com/users/glennmatthews/events{/privacy}","received_events_url":"https://api.github.com/users/glennmatthews/received_events","type":"User","site_admin":false},"body":"Don't these two input validation checks also apply to XR?","created_at":"2016-03-14T20:11:42Z","updated_at":"2016-03-14T20:11:42Z","html_url":"https://github.com/cisco/cisco-network-node-utils/pull/276#discussion_r56067341","pull_request_url":"https://api.github.com/repos/cisco/cisco-network-node-utils/pulls/276","_links":{"self":{"href":"https://api.github.com/repos/cisco/cisco-network-node-utils/pulls/comments/56067341"},"html":{"href":"https://github.com/cisco/cisco-network-node-utils/pull/276#discussion_r56067341"},"pull_request":{"href":"https://api.github.com/repos/cisco/cisco-network-node-utils/pulls/276"}}},"pull_request":{"url":"https://api.github.com/repos/cisco/cisco-network-node-utils/pulls/276","id":61967850,"html_url":"https://github.com/cisco/cisco-network-node-utils/pull/276","diff_url":"https://github.com/cisco/cisco-network-node-utils/pull/276.diff","patch_url":"https://github.com/cisco/cisco-network-node-utils/pull/276.patch","issue_url":"https://api.github.com/repos/cisco/cisco-network-node-utils/issues/276","number":276,"state":"open","locked":false,"title":"Cisco package APIs for XR","user":{"login":"sushirol","id":16801087,"avatar_url":"https://avatars.githubusercontent.com/u/16801087?v=3","gravatar_id":"","url":"https://api.github.com/users/sushirol","html_url":"https://github.com/sushirol","followers_url":"https://api.github.com/users/sushirol/followers","following_url":"https://api.github.com/users/sushirol/following{/other_user}","gists_url":"https://api.github.com/users/sushirol/gists{/gist_id}","starred_url":"https://api.github.com/users/sushirol/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sushirol/subscriptions","organizations_url":"https://api.github.com/users/sushirol/orgs","repos_url":"https://api.github.com/users/sushirol/repos","events_url":"https://api.github.com/users/sushirol/events{/privacy}","received_events_url":"https://api.github.com/users/sushirol/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-03-07T19:34:57Z","updated_at":"2016-03-14T20:11:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"51f52bfb58139f0e331ee8f312789e07f1da22f9","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/cisco/cisco-network-node-utils/pulls/276/commits","review_comments_url":"https://api.github.com/repos/cisco/cisco-network-node-utils/pulls/276/comments","review_comment_url":"https://api.github.com/repos/cisco/cisco-network-node-utils/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cisco/cisco-network-node-utils/issues/276/comments","statuses_url":"https://api.github.com/repos/cisco/cisco-network-node-utils/statuses/66762946306cd10d3add62c6e8b2592fc7addd3e","head":{"label":"sushirol:develop","ref":"develop","sha":"66762946306cd10d3add62c6e8b2592fc7addd3e","user":{"login":"sushirol","id":16801087,"avatar_url":"https://avatars.githubusercontent.com/u/16801087?v=3","gravatar_id":"","url":"https://api.github.com/users/sushirol","html_url":"https://github.com/sushirol","followers_url":"https://api.github.com/users/sushirol/followers","following_url":"https://api.github.com/users/sushirol/following{/other_user}","gists_url":"https://api.github.com/users/sushirol/gists{/gist_id}","starred_url":"https://api.github.com/users/sushirol/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sushirol/subscriptions","organizations_url":"https://api.github.com/users/sushirol/orgs","repos_url":"https://api.github.com/users/sushirol/repos","events_url":"https://api.github.com/users/sushirol/events{/privacy}","received_events_url":"https://api.github.com/users/sushirol/received_events","type":"User","site_admin":false},"repo":{"id":50039618,"name":"cisco-network-node-utils","full_name":"sushirol/cisco-network-node-utils","owner":{"login":"sushirol","id":16801087,"avatar_url":"https://avatars.githubusercontent.com/u/16801087?v=3","gravatar_id":"","url":"https://api.github.com/users/sushirol","html_url":"https://github.com/sushirol","followers_url":"https://api.github.com/users/sushirol/followers","following_url":"https://api.github.com/users/sushirol/following{/other_user}","gists_url":"https://api.github.com/users/sushirol/gists{/gist_id}","starred_url":"https://api.github.com/users/sushirol/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sushirol/subscriptions","organizations_url":"https://api.github.com/users/sushirol/orgs","repos_url":"https://api.github.com/users/sushirol/repos","events_url":"https://api.github.com/users/sushirol/events{/privacy}","received_events_url":"https://api.github.com/users/sushirol/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sushirol/cisco-network-node-utils","description":"","fork":true,"url":"https://api.github.com/repos/sushirol/cisco-network-node-utils","forks_url":"https://api.github.com/repos/sushirol/cisco-network-node-utils/forks","keys_url":"https://api.github.com/repos/sushirol/cisco-network-node-utils/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sushirol/cisco-network-node-utils/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sushirol/cisco-network-node-utils/teams","hooks_url":"https://api.github.com/repos/sushirol/cisco-network-node-utils/hooks","issue_events_url":"https://api.github.com/repos/sushirol/cisco-network-node-utils/issues/events{/number}","events_url":"https://api.github.com/repos/sushirol/cisco-network-node-utils/events","assignees_url":"https://api.github.com/repos/sushirol/cisco-network-node-utils/assignees{/user}","branches_url":"https://api.github.com/repos/sushirol/cisco-network-node-utils/branches{/branch}","tags_url":"https://api.github.com/repos/sushirol/cisco-network-node-utils/tags","blobs_url":"https://api.github.com/repos/sushirol/cisco-network-node-utils/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sushirol/cisco-network-node-utils/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sushirol/cisco-network-node-utils/git/refs{/sha}","trees_url":"https://api.github.com/repos/sushirol/cisco-network-node-utils/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sushirol/cisco-network-node-utils/statuses/{sha}","languages_url":"https://api.github.com/repos/sushirol/cisco-network-node-utils/languages","stargazers_url":"https://api.github.com/repos/sushirol/cisco-network-node-utils/stargazers","contributors_url":"https://api.github.com/repos/sushirol/cisco-network-node-utils/contributors","subscribers_url":"https://api.github.com/repos/sushirol/cisco-network-node-utils/subscribers","subscription_url":"https://api.github.com/repos/sushirol/cisco-network-node-utils/subscription","commits_url":"https://api.github.com/repos/sushirol/cisco-network-node-utils/commits{/sha}","git_commits_url":"https://api.github.com/repos/sushirol/cisco-network-node-utils/git/commits{/sha}","comments_url":"https://api.github.com/repos/sushirol/cisco-network-node-utils/comments{/number}","issue_comment_url":"https://api.github.com/repos/sushirol/cisco-network-node-utils/issues/comments{/number}","contents_url":"https://api.github.com/repos/sushirol/cisco-network-node-utils/contents/{+path}","compare_url":"https://api.github.com/repos/sushirol/cisco-network-node-utils/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sushirol/cisco-network-node-utils/merges","archive_url":"https://api.github.com/repos/sushirol/cisco-network-node-utils/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sushirol/cisco-network-node-utils/downloads","issues_url":"https://api.github.com/repos/sushirol/cisco-network-node-utils/issues{/number}","pulls_url":"https://api.github.com/repos/sushirol/cisco-network-node-utils/pulls{/number}","milestones_url":"https://api.github.com/repos/sushirol/cisco-network-node-utils/milestones{/number}","notifications_url":"https://api.github.com/repos/sushirol/cisco-network-node-utils/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sushirol/cisco-network-node-utils/labels{/name}","releases_url":"https://api.github.com/repos/sushirol/cisco-network-node-utils/releases{/id}","deployments_url":"https://api.github.com/repos/sushirol/cisco-network-node-utils/deployments","created_at":"2016-01-20T15:35:28Z","updated_at":"2016-01-20T15:35:29Z","pushed_at":"2016-03-11T21:25:52Z","git_url":"git://github.com/sushirol/cisco-network-node-utils.git","ssh_url":"git@github.com:sushirol/cisco-network-node-utils.git","clone_url":"https://github.com/sushirol/cisco-network-node-utils.git","svn_url":"https://github.com/sushirol/cisco-network-node-utils","homepage":null,"size":2968,"stargazers_count":0,"watchers_count":0,"language":"Ruby","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":"develop"}},"base":{"label":"cisco:develop","ref":"develop","sha":"61e33239c5502050ded66676a4e504d23c3e189a","user":{"login":"cisco","id":1376999,"avatar_url":"https://avatars.githubusercontent.com/u/1376999?v=3","gravatar_id":"","url":"https://api.github.com/users/cisco","html_url":"https://github.com/cisco","followers_url":"https://api.github.com/users/cisco/followers","following_url":"https://api.github.com/users/cisco/following{/other_user}","gists_url":"https://api.github.com/users/cisco/gists{/gist_id}","starred_url":"https://api.github.com/users/cisco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cisco/subscriptions","organizations_url":"https://api.github.com/users/cisco/orgs","repos_url":"https://api.github.com/users/cisco/repos","events_url":"https://api.github.com/users/cisco/events{/privacy}","received_events_url":"https://api.github.com/users/cisco/received_events","type":"Organization","site_admin":false},"repo":{"id":39565196,"name":"cisco-network-node-utils","full_name":"cisco/cisco-network-node-utils","owner":{"login":"cisco","id":1376999,"avatar_url":"https://avatars.githubusercontent.com/u/1376999?v=3","gravatar_id":"","url":"https://api.github.com/users/cisco","html_url":"https://github.com/cisco","followers_url":"https://api.github.com/users/cisco/followers","following_url":"https://api.github.com/users/cisco/following{/other_user}","gists_url":"https://api.github.com/users/cisco/gists{/gist_id}","starred_url":"https://api.github.com/users/cisco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cisco/subscriptions","organizations_url":"https://api.github.com/users/cisco/orgs","repos_url":"https://api.github.com/users/cisco/repos","events_url":"https://api.github.com/users/cisco/events{/privacy}","received_events_url":"https://api.github.com/users/cisco/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cisco/cisco-network-node-utils","description":"","fork":false,"url":"https://api.github.com/repos/cisco/cisco-network-node-utils","forks_url":"https://api.github.com/repos/cisco/cisco-network-node-utils/forks","keys_url":"https://api.github.com/repos/cisco/cisco-network-node-utils/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cisco/cisco-network-node-utils/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cisco/cisco-network-node-utils/teams","hooks_url":"https://api.github.com/repos/cisco/cisco-network-node-utils/hooks","issue_events_url":"https://api.github.com/repos/cisco/cisco-network-node-utils/issues/events{/number}","events_url":"https://api.github.com/repos/cisco/cisco-network-node-utils/events","assignees_url":"https://api.github.com/repos/cisco/cisco-network-node-utils/assignees{/user}","branches_url":"https://api.github.com/repos/cisco/cisco-network-node-utils/branches{/branch}","tags_url":"https://api.github.com/repos/cisco/cisco-network-node-utils/tags","blobs_url":"https://api.github.com/repos/cisco/cisco-network-node-utils/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cisco/cisco-network-node-utils/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cisco/cisco-network-node-utils/git/refs{/sha}","trees_url":"https://api.github.com/repos/cisco/cisco-network-node-utils/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cisco/cisco-network-node-utils/statuses/{sha}","languages_url":"https://api.github.com/repos/cisco/cisco-network-node-utils/languages","stargazers_url":"https://api.github.com/repos/cisco/cisco-network-node-utils/stargazers","contributors_url":"https://api.github.com/repos/cisco/cisco-network-node-utils/contributors","subscribers_url":"https://api.github.com/repos/cisco/cisco-network-node-utils/subscribers","subscription_url":"https://api.github.com/repos/cisco/cisco-network-node-utils/subscription","commits_url":"https://api.github.com/repos/cisco/cisco-network-node-utils/commits{/sha}","git_commits_url":"https://api.github.com/repos/cisco/cisco-network-node-utils/git/commits{/sha}","comments_url":"https://api.github.com/repos/cisco/cisco-network-node-utils/comments{/number}","issue_comment_url":"https://api.github.com/repos/cisco/cisco-network-node-utils/issues/comments{/number}","contents_url":"https://api.github.com/repos/cisco/cisco-network-node-utils/contents/{+path}","compare_url":"https://api.github.com/repos/cisco/cisco-network-node-utils/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cisco/cisco-network-node-utils/merges","archive_url":"https://api.github.com/repos/cisco/cisco-network-node-utils/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cisco/cisco-network-node-utils/downloads","issues_url":"https://api.github.com/repos/cisco/cisco-network-node-utils/issues{/number}","pulls_url":"https://api.github.com/repos/cisco/cisco-network-node-utils/pulls{/number}","milestones_url":"https://api.github.com/repos/cisco/cisco-network-node-utils/milestones{/number}","notifications_url":"https://api.github.com/repos/cisco/cisco-network-node-utils/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cisco/cisco-network-node-utils/labels{/name}","releases_url":"https://api.github.com/repos/cisco/cisco-network-node-utils/releases{/id}","deployments_url":"https://api.github.com/repos/cisco/cisco-network-node-utils/deployments","created_at":"2015-07-23T12:07:39Z","updated_at":"2016-02-01T19:00:12Z","pushed_at":"2016-03-14T20:05:57Z","git_url":"git://github.com/cisco/cisco-network-node-utils.git","ssh_url":"git@github.com:cisco/cisco-network-node-utils.git","clone_url":"https://github.com/cisco/cisco-network-node-utils.git","svn_url":"https://github.com/cisco/cisco-network-node-utils","homepage":null,"size":4323,"stargazers_count":9,"watchers_count":9,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":34,"mirror_url":null,"open_issues_count":6,"forks":34,"open_issues":6,"watchers":9,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/cisco/cisco-network-node-utils/pulls/276"},"html":{"href":"https://github.com/cisco/cisco-network-node-utils/pull/276"},"issue":{"href":"https://api.github.com/repos/cisco/cisco-network-node-utils/issues/276"},"comments":{"href":"https://api.github.com/repos/cisco/cisco-network-node-utils/issues/276/comments"},"review_comments":{"href":"https://api.github.com/repos/cisco/cisco-network-node-utils/pulls/276/comments"},"review_comment":{"href":"https://api.github.com/repos/cisco/cisco-network-node-utils/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cisco/cisco-network-node-utils/pulls/276/commits"},"statuses":{"href":"https://api.github.com/repos/cisco/cisco-network-node-utils/statuses/66762946306cd10d3add62c6e8b2592fc7addd3e"}}}}