{"action":"created","comment":{"url":"https://api.github.com/repos/cisco/cisco-network-puppet-module/pulls/comments/66611541","id":66611541,"diff_hunk":"@@ -85,4 +85,35 @@ def command=(cmds)\n     info \"Successfully updated:\\n#{e.previous.join(\"\\n\")}\" unless e.previous.empty?\n     raise\n   end # command=\n+\n+  def test_get\n+    # This method is for beaker use only. It allows beaker to retrieve any\n+    # configuration it needs from the device using puppet resource. Callers\n+    # must pass a filter string to test_get.\n+    # Example usage:\n+    #  puppet resource cisco_command_config 'cc' test_get='incl feature'\n+    cmd = 'show running-config all'\n+    cmd << \" | #{@resource[:test_get]}\" if @resource[:test_get]\n+\n+    result = @node.get(command: cmd)\n+    \"\\n\" + result unless result.nil?\n+  end\n+\n+  def test_get=(noop)\n+    # This is a dummy setter to keep Puppet from raising an error.\n+  end\n+\n+  def test_set\n+    # This is a dummy getter to keep Puppet from raising an error.\n+  end\n+\n+  def test_set=(cmds)\n+    # This method is for beaker use only. It allows beaker to set simple raw\n+    # configuration using puppet resource.\n+    # Example usage:\n+    #  puppet resource cisco_command_config 'cc' test_set='no feature foo'\n+    return if cmds.empty?\n+    output = @node.set(values: cmds)\n+    debug \"Output from node:\\n#{output}\" unless output.nil?","path":"lib/puppet/provider/cisco_command_config/cisco.rb","position":33,"original_position":33,"commit_id":"046a14209f92a4e23cad9825982a8625043ff1aa","original_commit_id":"046a14209f92a4e23cad9825982a8625043ff1aa","user":{"login":"mikewiebe","id":12445795,"avatar_url":"https://avatars.githubusercontent.com/u/12445795?v=3","gravatar_id":"","url":"https://api.github.com/users/mikewiebe","html_url":"https://github.com/mikewiebe","followers_url":"https://api.github.com/users/mikewiebe/followers","following_url":"https://api.github.com/users/mikewiebe/following{/other_user}","gists_url":"https://api.github.com/users/mikewiebe/gists{/gist_id}","starred_url":"https://api.github.com/users/mikewiebe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikewiebe/subscriptions","organizations_url":"https://api.github.com/users/mikewiebe/orgs","repos_url":"https://api.github.com/users/mikewiebe/repos","events_url":"https://api.github.com/users/mikewiebe/events{/privacy}","received_events_url":"https://api.github.com/users/mikewiebe/received_events","type":"User","site_admin":false},"body":"**Nit** `debug \"Output from @node.set command:\\n#{output}\" unless output.nil?`","created_at":"2016-06-10T13:22:32Z","updated_at":"2016-06-10T13:22:32Z","html_url":"https://github.com/cisco/cisco-network-puppet-module/pull/348#discussion_r66611541","pull_request_url":"https://api.github.com/repos/cisco/cisco-network-puppet-module/pulls/348","_links":{"self":{"href":"https://api.github.com/repos/cisco/cisco-network-puppet-module/pulls/comments/66611541"},"html":{"href":"https://github.com/cisco/cisco-network-puppet-module/pull/348#discussion_r66611541"},"pull_request":{"href":"https://api.github.com/repos/cisco/cisco-network-puppet-module/pulls/348"}}},"pull_request":{"url":"https://api.github.com/repos/cisco/cisco-network-puppet-module/pulls/348","id":73259736,"html_url":"https://github.com/cisco/cisco-network-puppet-module/pull/348","diff_url":"https://github.com/cisco/cisco-network-puppet-module/pull/348.diff","patch_url":"https://github.com/cisco/cisco-network-puppet-module/pull/348.patch","issue_url":"https://api.github.com/repos/cisco/cisco-network-puppet-module/issues/348","number":348,"state":"open","locked":false,"title":"Add test_get / test_set to command_config","user":{"login":"chrisvanheuveln","id":12087548,"avatar_url":"https://avatars.githubusercontent.com/u/12087548?v=3","gravatar_id":"","url":"https://api.github.com/users/chrisvanheuveln","html_url":"https://github.com/chrisvanheuveln","followers_url":"https://api.github.com/users/chrisvanheuveln/followers","following_url":"https://api.github.com/users/chrisvanheuveln/following{/other_user}","gists_url":"https://api.github.com/users/chrisvanheuveln/gists{/gist_id}","starred_url":"https://api.github.com/users/chrisvanheuveln/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrisvanheuveln/subscriptions","organizations_url":"https://api.github.com/users/chrisvanheuveln/orgs","repos_url":"https://api.github.com/users/chrisvanheuveln/repos","events_url":"https://api.github.com/users/chrisvanheuveln/events{/privacy}","received_events_url":"https://api.github.com/users/chrisvanheuveln/received_events","type":"User","site_admin":false},"body":" * Needed a way for beaker to query / set config that didn't have explicit resource support (e.g. disabling a feature)\r\n    \r\n * test_get is a simple get-only property that does a show running; callers set a filter to parse what they need:\r\n        puppet resource cisco_command_config 'cc' test_get='incl feature'\r\n    \r\n * test_set is a simple set-only property:\r\n        puppet resource cisco_command_config 'cc' test_set='no feature foo'\r\n    \r\n * Tested on n3,n5,n7,n9\r\n\r\n* edit: Updated this PR to include some fixes I did for the fabricpath tests:\r\n  * Added new utility: config_find_remove() uses test_get to search for existing configs, then test_set to remove it.\r\n  * Fixed the fabricpath tests which ran into an issue on n5k when cleaning up 'feature nv overlay' with command_config: Puppet resource removes the config but then immediately does a 'show runn' which gets a SAP timeout on the device itself and the test errors. Using the test_set setter instead of regular command_config gets around this problem because it's a \"set-only\" with a dummy test_set getter.\r\n * Latest code tested on n5,n7,n9\r\n","created_at":"2016-06-09T18:09:02Z","updated_at":"2016-06-10T13:22:32Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1dd8a558d5c38263288d51092850fe9f3d9c3aa5","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/cisco/cisco-network-puppet-module/pulls/348/commits","review_comments_url":"https://api.github.com/repos/cisco/cisco-network-puppet-module/pulls/348/comments","review_comment_url":"https://api.github.com/repos/cisco/cisco-network-puppet-module/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cisco/cisco-network-puppet-module/issues/348/comments","statuses_url":"https://api.github.com/repos/cisco/cisco-network-puppet-module/statuses/046a14209f92a4e23cad9825982a8625043ff1aa","head":{"label":"chrisvanheuveln:test_get_set_2","ref":"test_get_set_2","sha":"046a14209f92a4e23cad9825982a8625043ff1aa","user":{"login":"chrisvanheuveln","id":12087548,"avatar_url":"https://avatars.githubusercontent.com/u/12087548?v=3","gravatar_id":"","url":"https://api.github.com/users/chrisvanheuveln","html_url":"https://github.com/chrisvanheuveln","followers_url":"https://api.github.com/users/chrisvanheuveln/followers","following_url":"https://api.github.com/users/chrisvanheuveln/following{/other_user}","gists_url":"https://api.github.com/users/chrisvanheuveln/gists{/gist_id}","starred_url":"https://api.github.com/users/chrisvanheuveln/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrisvanheuveln/subscriptions","organizations_url":"https://api.github.com/users/chrisvanheuveln/orgs","repos_url":"https://api.github.com/users/chrisvanheuveln/repos","events_url":"https://api.github.com/users/chrisvanheuveln/events{/privacy}","received_events_url":"https://api.github.com/users/chrisvanheuveln/received_events","type":"User","site_admin":false},"repo":{"id":59668001,"name":"cisco-network-puppet-module","full_name":"chrisvanheuveln/cisco-network-puppet-module","owner":{"login":"chrisvanheuveln","id":12087548,"avatar_url":"https://avatars.githubusercontent.com/u/12087548?v=3","gravatar_id":"","url":"https://api.github.com/users/chrisvanheuveln","html_url":"https://github.com/chrisvanheuveln","followers_url":"https://api.github.com/users/chrisvanheuveln/followers","following_url":"https://api.github.com/users/chrisvanheuveln/following{/other_user}","gists_url":"https://api.github.com/users/chrisvanheuveln/gists{/gist_id}","starred_url":"https://api.github.com/users/chrisvanheuveln/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrisvanheuveln/subscriptions","organizations_url":"https://api.github.com/users/chrisvanheuveln/orgs","repos_url":"https://api.github.com/users/chrisvanheuveln/repos","events_url":"https://api.github.com/users/chrisvanheuveln/events{/privacy}","received_events_url":"https://api.github.com/users/chrisvanheuveln/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/chrisvanheuveln/cisco-network-puppet-module","description":"","fork":true,"url":"https://api.github.com/repos/chrisvanheuveln/cisco-network-puppet-module","forks_url":"https://api.github.com/repos/chrisvanheuveln/cisco-network-puppet-module/forks","keys_url":"https://api.github.com/repos/chrisvanheuveln/cisco-network-puppet-module/keys{/key_id}","collaborators_url":"https://api.github.com/repos/chrisvanheuveln/cisco-network-puppet-module/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/chrisvanheuveln/cisco-network-puppet-module/teams","hooks_url":"https://api.github.com/repos/chrisvanheuveln/cisco-network-puppet-module/hooks","issue_events_url":"https://api.github.com/repos/chrisvanheuveln/cisco-network-puppet-module/issues/events{/number}","events_url":"https://api.github.com/repos/chrisvanheuveln/cisco-network-puppet-module/events","assignees_url":"https://api.github.com/repos/chrisvanheuveln/cisco-network-puppet-module/assignees{/user}","branches_url":"https://api.github.com/repos/chrisvanheuveln/cisco-network-puppet-module/branches{/branch}","tags_url":"https://api.github.com/repos/chrisvanheuveln/cisco-network-puppet-module/tags","blobs_url":"https://api.github.com/repos/chrisvanheuveln/cisco-network-puppet-module/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/chrisvanheuveln/cisco-network-puppet-module/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/chrisvanheuveln/cisco-network-puppet-module/git/refs{/sha}","trees_url":"https://api.github.com/repos/chrisvanheuveln/cisco-network-puppet-module/git/trees{/sha}","statuses_url":"https://api.github.com/repos/chrisvanheuveln/cisco-network-puppet-module/statuses/{sha}","languages_url":"https://api.github.com/repos/chrisvanheuveln/cisco-network-puppet-module/languages","stargazers_url":"https://api.github.com/repos/chrisvanheuveln/cisco-network-puppet-module/stargazers","contributors_url":"https://api.github.com/repos/chrisvanheuveln/cisco-network-puppet-module/contributors","subscribers_url":"https://api.github.com/repos/chrisvanheuveln/cisco-network-puppet-module/subscribers","subscription_url":"https://api.github.com/repos/chrisvanheuveln/cisco-network-puppet-module/subscription","commits_url":"https://api.github.com/repos/chrisvanheuveln/cisco-network-puppet-module/commits{/sha}","git_commits_url":"https://api.github.com/repos/chrisvanheuveln/cisco-network-puppet-module/git/commits{/sha}","comments_url":"https://api.github.com/repos/chrisvanheuveln/cisco-network-puppet-module/comments{/number}","issue_comment_url":"https://api.github.com/repos/chrisvanheuveln/cisco-network-puppet-module/issues/comments{/number}","contents_url":"https://api.github.com/repos/chrisvanheuveln/cisco-network-puppet-module/contents/{+path}","compare_url":"https://api.github.com/repos/chrisvanheuveln/cisco-network-puppet-module/compare/{base}...{head}","merges_url":"https://api.github.com/repos/chrisvanheuveln/cisco-network-puppet-module/merges","archive_url":"https://api.github.com/repos/chrisvanheuveln/cisco-network-puppet-module/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/chrisvanheuveln/cisco-network-puppet-module/downloads","issues_url":"https://api.github.com/repos/chrisvanheuveln/cisco-network-puppet-module/issues{/number}","pulls_url":"https://api.github.com/repos/chrisvanheuveln/cisco-network-puppet-module/pulls{/number}","milestones_url":"https://api.github.com/repos/chrisvanheuveln/cisco-network-puppet-module/milestones{/number}","notifications_url":"https://api.github.com/repos/chrisvanheuveln/cisco-network-puppet-module/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/chrisvanheuveln/cisco-network-puppet-module/labels{/name}","releases_url":"https://api.github.com/repos/chrisvanheuveln/cisco-network-puppet-module/releases{/id}","deployments_url":"https://api.github.com/repos/chrisvanheuveln/cisco-network-puppet-module/deployments","created_at":"2016-05-25T14:01:51Z","updated_at":"2016-05-25T14:01:53Z","pushed_at":"2016-06-09T21:49:13Z","git_url":"git://github.com/chrisvanheuveln/cisco-network-puppet-module.git","ssh_url":"git@github.com:chrisvanheuveln/cisco-network-puppet-module.git","clone_url":"https://github.com/chrisvanheuveln/cisco-network-puppet-module.git","svn_url":"https://github.com/chrisvanheuveln/cisco-network-puppet-module","homepage":null,"size":4160,"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":"ecbe285d1adec5ad0e114be43eff57f090f97c34","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":39565139,"name":"cisco-network-puppet-module","full_name":"cisco/cisco-network-puppet-module","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-puppet-module","description":"","fork":false,"url":"https://api.github.com/repos/cisco/cisco-network-puppet-module","forks_url":"https://api.github.com/repos/cisco/cisco-network-puppet-module/forks","keys_url":"https://api.github.com/repos/cisco/cisco-network-puppet-module/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cisco/cisco-network-puppet-module/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cisco/cisco-network-puppet-module/teams","hooks_url":"https://api.github.com/repos/cisco/cisco-network-puppet-module/hooks","issue_events_url":"https://api.github.com/repos/cisco/cisco-network-puppet-module/issues/events{/number}","events_url":"https://api.github.com/repos/cisco/cisco-network-puppet-module/events","assignees_url":"https://api.github.com/repos/cisco/cisco-network-puppet-module/assignees{/user}","branches_url":"https://api.github.com/repos/cisco/cisco-network-puppet-module/branches{/branch}","tags_url":"https://api.github.com/repos/cisco/cisco-network-puppet-module/tags","blobs_url":"https://api.github.com/repos/cisco/cisco-network-puppet-module/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cisco/cisco-network-puppet-module/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cisco/cisco-network-puppet-module/git/refs{/sha}","trees_url":"https://api.github.com/repos/cisco/cisco-network-puppet-module/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cisco/cisco-network-puppet-module/statuses/{sha}","languages_url":"https://api.github.com/repos/cisco/cisco-network-puppet-module/languages","stargazers_url":"https://api.github.com/repos/cisco/cisco-network-puppet-module/stargazers","contributors_url":"https://api.github.com/repos/cisco/cisco-network-puppet-module/contributors","subscribers_url":"https://api.github.com/repos/cisco/cisco-network-puppet-module/subscribers","subscription_url":"https://api.github.com/repos/cisco/cisco-network-puppet-module/subscription","commits_url":"https://api.github.com/repos/cisco/cisco-network-puppet-module/commits{/sha}","git_commits_url":"https://api.github.com/repos/cisco/cisco-network-puppet-module/git/commits{/sha}","comments_url":"https://api.github.com/repos/cisco/cisco-network-puppet-module/comments{/number}","issue_comment_url":"https://api.github.com/repos/cisco/cisco-network-puppet-module/issues/comments{/number}","contents_url":"https://api.github.com/repos/cisco/cisco-network-puppet-module/contents/{+path}","compare_url":"https://api.github.com/repos/cisco/cisco-network-puppet-module/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cisco/cisco-network-puppet-module/merges","archive_url":"https://api.github.com/repos/cisco/cisco-network-puppet-module/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cisco/cisco-network-puppet-module/downloads","issues_url":"https://api.github.com/repos/cisco/cisco-network-puppet-module/issues{/number}","pulls_url":"https://api.github.com/repos/cisco/cisco-network-puppet-module/pulls{/number}","milestones_url":"https://api.github.com/repos/cisco/cisco-network-puppet-module/milestones{/number}","notifications_url":"https://api.github.com/repos/cisco/cisco-network-puppet-module/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cisco/cisco-network-puppet-module/labels{/name}","releases_url":"https://api.github.com/repos/cisco/cisco-network-puppet-module/releases{/id}","deployments_url":"https://api.github.com/repos/cisco/cisco-network-puppet-module/deployments","created_at":"2015-07-23T12:06:48Z","updated_at":"2016-05-23T07:33:08Z","pushed_at":"2016-06-09T21:50:36Z","git_url":"git://github.com/cisco/cisco-network-puppet-module.git","ssh_url":"git@github.com:cisco/cisco-network-puppet-module.git","clone_url":"https://github.com/cisco/cisco-network-puppet-module.git","svn_url":"https://github.com/cisco/cisco-network-puppet-module","homepage":null,"size":4742,"stargazers_count":16,"watchers_count":16,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":37,"mirror_url":null,"open_issues_count":7,"forks":37,"open_issues":7,"watchers":16,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/cisco/cisco-network-puppet-module/pulls/348"},"html":{"href":"https://github.com/cisco/cisco-network-puppet-module/pull/348"},"issue":{"href":"https://api.github.com/repos/cisco/cisco-network-puppet-module/issues/348"},"comments":{"href":"https://api.github.com/repos/cisco/cisco-network-puppet-module/issues/348/comments"},"review_comments":{"href":"https://api.github.com/repos/cisco/cisco-network-puppet-module/pulls/348/comments"},"review_comment":{"href":"https://api.github.com/repos/cisco/cisco-network-puppet-module/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cisco/cisco-network-puppet-module/pulls/348/commits"},"statuses":{"href":"https://api.github.com/repos/cisco/cisco-network-puppet-module/statuses/046a14209f92a4e23cad9825982a8625043ff1aa"}}}}
{"actor":{"display_login":"mikewiebe"}}