{"action":"created","comment":{"url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/comments/32885931","id":32885931,"diff_hunk":"@@ -430,6 +335,62 @@ func (v FlattenListVisitor) Visit(fn VisitorFunc) error {\n \t})\n }\n \n+func ignoreFile(path string, extensions []string) bool {\n+\tif len(extensions) == 0 {\n+\t\treturn false\n+\t}\n+\text := filepath.Ext(path)\n+\tfor _, s := range extensions {\n+\t\tif s == ext {\n+\t\t\treturn false\n+\t\t}\n+\t}\n+\treturn true\n+}\n+\n+// ExpandPathsToStreamVisitors will return a slice of Stream Visitors that will read and handle files from the provided path.\n+// The returned visitor will be a StreamVisitor as reading a file can be the same as reading from STDIN. Paths argument also\n+// accepts a single file, and will return a single visitor\n+func ExpandPathsToStreamVisitors(mapper *Mapper, paths string, recursive bool, extensions []string, ignoreErrors bool, schema validation.Schema) ([]Visitor, error) {\n+\tvar visitors []Visitor\n+\n+\terr := filepath.Walk(paths, func(path string, fi os.FileInfo, err error) error {\n+\t\tif err != nil {\n+\t\t\treturn err\n+\t\t}\n+\n+\t\tif fi.IsDir() {\n+\t\t\tif path != paths && !recursive {\n+\t\t\t\treturn filepath.SkipDir\n+\t\t\t}\n+\t\t\treturn nil\n+\t\t}\n+\t\tif ignoreFile(path, extensions) {\n+\t\t\treturn nil\n+\t\t}\n+\n+\t\tf, err := os.Open(path)\n+\t\tif err != nil {\n+\t\t\treturn fmt.Errorf(\"unable to open %q: %v\", path, err)\n+\t\t}\n+","path":"pkg/kubectl/resource/visitor.go","position":144,"original_position":144,"commit_id":"12cbe878806190d434eedc2729fb371ef52c4438","original_commit_id":"12cbe878806190d434eedc2729fb371ef52c4438","user":{"login":"andronat","id":793408,"avatar_url":"https://avatars.githubusercontent.com/u/793408?v=3","gravatar_id":"","url":"https://api.github.com/users/andronat","html_url":"https://github.com/andronat","followers_url":"https://api.github.com/users/andronat/followers","following_url":"https://api.github.com/users/andronat/following{/other_user}","gists_url":"https://api.github.com/users/andronat/gists{/gist_id}","starred_url":"https://api.github.com/users/andronat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andronat/subscriptions","organizations_url":"https://api.github.com/users/andronat/orgs","repos_url":"https://api.github.com/users/andronat/repos","events_url":"https://api.github.com/users/andronat/events{/privacy}","received_events_url":"https://api.github.com/users/andronat/received_events","type":"User","site_admin":false},"body":"Or maybe I can create a new `FileVisitor` that is going to store all the available paths in a slice and then open them and close them as the `Visit` is called. Also will handle STDIN as it a file.\r\n\r\nThis `FileVisitor` can use the `StreamVisitor` internally just like `ContinueOnErrorVisitor` is doing.","created_at":"2015-06-20T16:44:05Z","updated_at":"2015-06-20T16:44:05Z","html_url":"https://github.com/GoogleCloudPlatform/kubernetes/pull/9781#discussion_r32885931","pull_request_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/9781","_links":{"self":{"href":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/comments/32885931"},"html":{"href":"https://github.com/GoogleCloudPlatform/kubernetes/pull/9781#discussion_r32885931"},"pull_request":{"href":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/9781"}}},"pull_request":{"url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/9781","id":37649464,"html_url":"https://github.com/GoogleCloudPlatform/kubernetes/pull/9781","diff_url":"https://github.com/GoogleCloudPlatform/kubernetes/pull/9781.diff","patch_url":"https://github.com/GoogleCloudPlatform/kubernetes/pull/9781.patch","issue_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/issues/9781","number":9781,"state":"open","locked":false,"title":"Fixes ignored objects in one YAML file","user":{"login":"andronat","id":793408,"avatar_url":"https://avatars.githubusercontent.com/u/793408?v=3","gravatar_id":"","url":"https://api.github.com/users/andronat","html_url":"https://github.com/andronat","followers_url":"https://api.github.com/users/andronat/followers","following_url":"https://api.github.com/users/andronat/following{/other_user}","gists_url":"https://api.github.com/users/andronat/gists{/gist_id}","starred_url":"https://api.github.com/users/andronat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andronat/subscriptions","organizations_url":"https://api.github.com/users/andronat/orgs","repos_url":"https://api.github.com/users/andronat/repos","events_url":"https://api.github.com/users/andronat/events{/privacy}","received_events_url":"https://api.github.com/users/andronat/received_events","type":"User","site_admin":false},"body":"Refs #5840\r\n\r\nWhen a user runs `kubectl create/delete -f file-with-multiple-resources.yaml` and this file contains multiple objects separated with `---`, `kubectl` ignores all objects except the first.\r\n\r\nThis PR reworked `PathVisitor` and `DirectoryVisitor` by merging them under the `StreamVisitor`. The idea is that directories, files and STDIN can all be handled as streams. \r\n\r\nThe problem until now was that only `StreamVisitor` was able to understand the `---` and act accordingly, now with this merge we can be sure that in the future one change will reflect in all different was of input.","created_at":"2015-06-14T22:10:51Z","updated_at":"2015-06-20T16:44:05Z","closed_at":null,"merged_at":null,"merge_commit_sha":"26fe1b033181243241a4d6bdaa5f587eeb8f58cb","assignee":{"login":"bgrant0607","id":7725777,"avatar_url":"https://avatars.githubusercontent.com/u/7725777?v=3","gravatar_id":"","url":"https://api.github.com/users/bgrant0607","html_url":"https://github.com/bgrant0607","followers_url":"https://api.github.com/users/bgrant0607/followers","following_url":"https://api.github.com/users/bgrant0607/following{/other_user}","gists_url":"https://api.github.com/users/bgrant0607/gists{/gist_id}","starred_url":"https://api.github.com/users/bgrant0607/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bgrant0607/subscriptions","organizations_url":"https://api.github.com/users/bgrant0607/orgs","repos_url":"https://api.github.com/users/bgrant0607/repos","events_url":"https://api.github.com/users/bgrant0607/events{/privacy}","received_events_url":"https://api.github.com/users/bgrant0607/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/milestones/6","html_url":"https://github.com/GoogleCloudPlatform/kubernetes/milestones/v1.0","labels_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/milestones/6/labels","id":969317,"number":6,"title":"v1.0","description":"Issues that need to be resolved for v1.0 of Kubernetes.","creator":{"login":"goltermann","id":9358478,"avatar_url":"https://avatars.githubusercontent.com/u/9358478?v=3","gravatar_id":"","url":"https://api.github.com/users/goltermann","html_url":"https://github.com/goltermann","followers_url":"https://api.github.com/users/goltermann/followers","following_url":"https://api.github.com/users/goltermann/following{/other_user}","gists_url":"https://api.github.com/users/goltermann/gists{/gist_id}","starred_url":"https://api.github.com/users/goltermann/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/goltermann/subscriptions","organizations_url":"https://api.github.com/users/goltermann/orgs","repos_url":"https://api.github.com/users/goltermann/repos","events_url":"https://api.github.com/users/goltermann/events{/privacy}","received_events_url":"https://api.github.com/users/goltermann/received_events","type":"User","site_admin":false},"open_issues":97,"closed_issues":439,"state":"open","created_at":"2015-02-06T20:27:16Z","updated_at":"2015-06-20T04:50:18Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/9781/commits","review_comments_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/9781/comments","review_comment_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/comments{/number}","comments_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/issues/9781/comments","statuses_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/statuses/12cbe878806190d434eedc2729fb371ef52c4438","head":{"label":"andronat:5840_yaml_2","ref":"5840_yaml_2","sha":"12cbe878806190d434eedc2729fb371ef52c4438","user":{"login":"andronat","id":793408,"avatar_url":"https://avatars.githubusercontent.com/u/793408?v=3","gravatar_id":"","url":"https://api.github.com/users/andronat","html_url":"https://github.com/andronat","followers_url":"https://api.github.com/users/andronat/followers","following_url":"https://api.github.com/users/andronat/following{/other_user}","gists_url":"https://api.github.com/users/andronat/gists{/gist_id}","starred_url":"https://api.github.com/users/andronat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andronat/subscriptions","organizations_url":"https://api.github.com/users/andronat/orgs","repos_url":"https://api.github.com/users/andronat/repos","events_url":"https://api.github.com/users/andronat/events{/privacy}","received_events_url":"https://api.github.com/users/andronat/received_events","type":"User","site_admin":false},"repo":{"id":35010334,"name":"kubernetes","full_name":"andronat/kubernetes","owner":{"login":"andronat","id":793408,"avatar_url":"https://avatars.githubusercontent.com/u/793408?v=3","gravatar_id":"","url":"https://api.github.com/users/andronat","html_url":"https://github.com/andronat","followers_url":"https://api.github.com/users/andronat/followers","following_url":"https://api.github.com/users/andronat/following{/other_user}","gists_url":"https://api.github.com/users/andronat/gists{/gist_id}","starred_url":"https://api.github.com/users/andronat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andronat/subscriptions","organizations_url":"https://api.github.com/users/andronat/orgs","repos_url":"https://api.github.com/users/andronat/repos","events_url":"https://api.github.com/users/andronat/events{/privacy}","received_events_url":"https://api.github.com/users/andronat/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/andronat/kubernetes","description":"Container Cluster Manager from Google","fork":true,"url":"https://api.github.com/repos/andronat/kubernetes","forks_url":"https://api.github.com/repos/andronat/kubernetes/forks","keys_url":"https://api.github.com/repos/andronat/kubernetes/keys{/key_id}","collaborators_url":"https://api.github.com/repos/andronat/kubernetes/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/andronat/kubernetes/teams","hooks_url":"https://api.github.com/repos/andronat/kubernetes/hooks","issue_events_url":"https://api.github.com/repos/andronat/kubernetes/issues/events{/number}","events_url":"https://api.github.com/repos/andronat/kubernetes/events","assignees_url":"https://api.github.com/repos/andronat/kubernetes/assignees{/user}","branches_url":"https://api.github.com/repos/andronat/kubernetes/branches{/branch}","tags_url":"https://api.github.com/repos/andronat/kubernetes/tags","blobs_url":"https://api.github.com/repos/andronat/kubernetes/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/andronat/kubernetes/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/andronat/kubernetes/git/refs{/sha}","trees_url":"https://api.github.com/repos/andronat/kubernetes/git/trees{/sha}","statuses_url":"https://api.github.com/repos/andronat/kubernetes/statuses/{sha}","languages_url":"https://api.github.com/repos/andronat/kubernetes/languages","stargazers_url":"https://api.github.com/repos/andronat/kubernetes/stargazers","contributors_url":"https://api.github.com/repos/andronat/kubernetes/contributors","subscribers_url":"https://api.github.com/repos/andronat/kubernetes/subscribers","subscription_url":"https://api.github.com/repos/andronat/kubernetes/subscription","commits_url":"https://api.github.com/repos/andronat/kubernetes/commits{/sha}","git_commits_url":"https://api.github.com/repos/andronat/kubernetes/git/commits{/sha}","comments_url":"https://api.github.com/repos/andronat/kubernetes/comments{/number}","issue_comment_url":"https://api.github.com/repos/andronat/kubernetes/issues/comments{/number}","contents_url":"https://api.github.com/repos/andronat/kubernetes/contents/{+path}","compare_url":"https://api.github.com/repos/andronat/kubernetes/compare/{base}...{head}","merges_url":"https://api.github.com/repos/andronat/kubernetes/merges","archive_url":"https://api.github.com/repos/andronat/kubernetes/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/andronat/kubernetes/downloads","issues_url":"https://api.github.com/repos/andronat/kubernetes/issues{/number}","pulls_url":"https://api.github.com/repos/andronat/kubernetes/pulls{/number}","milestones_url":"https://api.github.com/repos/andronat/kubernetes/milestones{/number}","notifications_url":"https://api.github.com/repos/andronat/kubernetes/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/andronat/kubernetes/labels{/name}","releases_url":"https://api.github.com/repos/andronat/kubernetes/releases{/id}","created_at":"2015-05-04T02:39:56Z","updated_at":"2015-05-04T02:45:04Z","pushed_at":"2015-06-20T12:40:34Z","git_url":"git://github.com/andronat/kubernetes.git","ssh_url":"git@github.com:andronat/kubernetes.git","clone_url":"https://github.com/andronat/kubernetes.git","svn_url":"https://github.com/andronat/kubernetes","homepage":"http://kubernetes.io","size":76576,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"GoogleCloudPlatform:master","ref":"master","sha":"dae03043d4a41fc6c117d6fdac2a48cc0a6db1fd","user":{"login":"GoogleCloudPlatform","id":2810941,"avatar_url":"https://avatars.githubusercontent.com/u/2810941?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleCloudPlatform","html_url":"https://github.com/GoogleCloudPlatform","followers_url":"https://api.github.com/users/GoogleCloudPlatform/followers","following_url":"https://api.github.com/users/GoogleCloudPlatform/following{/other_user}","gists_url":"https://api.github.com/users/GoogleCloudPlatform/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleCloudPlatform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleCloudPlatform/subscriptions","organizations_url":"https://api.github.com/users/GoogleCloudPlatform/orgs","repos_url":"https://api.github.com/users/GoogleCloudPlatform/repos","events_url":"https://api.github.com/users/GoogleCloudPlatform/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleCloudPlatform/received_events","type":"Organization","site_admin":false},"repo":{"id":20580498,"name":"kubernetes","full_name":"GoogleCloudPlatform/kubernetes","owner":{"login":"GoogleCloudPlatform","id":2810941,"avatar_url":"https://avatars.githubusercontent.com/u/2810941?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleCloudPlatform","html_url":"https://github.com/GoogleCloudPlatform","followers_url":"https://api.github.com/users/GoogleCloudPlatform/followers","following_url":"https://api.github.com/users/GoogleCloudPlatform/following{/other_user}","gists_url":"https://api.github.com/users/GoogleCloudPlatform/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleCloudPlatform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleCloudPlatform/subscriptions","organizations_url":"https://api.github.com/users/GoogleCloudPlatform/orgs","repos_url":"https://api.github.com/users/GoogleCloudPlatform/repos","events_url":"https://api.github.com/users/GoogleCloudPlatform/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleCloudPlatform/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/GoogleCloudPlatform/kubernetes","description":"Container Cluster Manager from Google","fork":false,"url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes","forks_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/forks","keys_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/keys{/key_id}","collaborators_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/teams","hooks_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/hooks","issue_events_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/issues/events{/number}","events_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/events","assignees_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/assignees{/user}","branches_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/branches{/branch}","tags_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/tags","blobs_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/git/refs{/sha}","trees_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/git/trees{/sha}","statuses_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/statuses/{sha}","languages_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/languages","stargazers_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/stargazers","contributors_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/contributors","subscribers_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/subscribers","subscription_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/subscription","commits_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/commits{/sha}","git_commits_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/git/commits{/sha}","comments_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/comments{/number}","issue_comment_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/issues/comments{/number}","contents_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/contents/{+path}","compare_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/compare/{base}...{head}","merges_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/merges","archive_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/downloads","issues_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/issues{/number}","pulls_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls{/number}","milestones_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/milestones{/number}","notifications_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/labels{/name}","releases_url":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/releases{/id}","created_at":"2014-06-06T22:56:04Z","updated_at":"2015-06-20T16:16:23Z","pushed_at":"2015-06-20T15:52:45Z","git_url":"git://github.com/GoogleCloudPlatform/kubernetes.git","ssh_url":"git@github.com:GoogleCloudPlatform/kubernetes.git","clone_url":"https://github.com/GoogleCloudPlatform/kubernetes.git","svn_url":"https://github.com/GoogleCloudPlatform/kubernetes","homepage":"http://kubernetes.io","size":295746,"stargazers_count":8525,"watchers_count":8525,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1831,"mirror_url":null,"open_issues_count":1414,"forks":1831,"open_issues":1414,"watchers":8525,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/9781"},"html":{"href":"https://github.com/GoogleCloudPlatform/kubernetes/pull/9781"},"issue":{"href":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/issues/9781"},"comments":{"href":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/issues/9781/comments"},"review_comments":{"href":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/9781/comments"},"review_comment":{"href":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/pulls/9781/commits"},"statuses":{"href":"https://api.github.com/repos/GoogleCloudPlatform/kubernetes/statuses/12cbe878806190d434eedc2729fb371ef52c4438"}}}}