{"action":"created","comment":{"url":"https://api.github.com/repos/pulp/pulp_puppet/pulls/comments/29048651","id":29048651,"diff_hunk":"@@ -169,20 +156,18 @@ def _extract_non_standard_json(filename, temp_dir):\n         tgz = tarfile.open(name=filename)\n         tgz.extractall(path=extraction_dir)\n         tgz.close()\n-    except Exception, e:\n+    except Exception:\n         raise InvalidTarball(filename), None, sys.exc_info()[2]\n \n     try:\n-        # Recursively look for the metadata file\n-        metadata_file_dir = _find_file_in_dir(extraction_dir, constants.MODULE_METADATA_FILENAME)\n-\n-        if metadata_file_dir is None:\n+        # Attempt to find the metadata in the first folder of the tar.gz\n+        module_dir = os.listdir(extraction_dir)[0]\n+        metadata_filename = constants.MODULE_METADATA_FILENAME\n+        metadata_full_path = os.sep.join([extraction_dir, module_dir, metadata_filename])","path":"pulp_puppet_plugins/pulp_puppet/plugins/importers/metadata.py","position":59,"original_position":59,"commit_id":"2c3775a0ab93ea3c15a88b21bca73450a20cff21","original_commit_id":"2c3775a0ab93ea3c15a88b21bca73450a20cff21","user":{"login":"mhrivnak","id":53091,"avatar_url":"https://avatars.githubusercontent.com/u/53091?v=3","gravatar_id":"","url":"https://api.github.com/users/mhrivnak","html_url":"https://github.com/mhrivnak","followers_url":"https://api.github.com/users/mhrivnak/followers","following_url":"https://api.github.com/users/mhrivnak/following{/other_user}","gists_url":"https://api.github.com/users/mhrivnak/gists{/gist_id}","starred_url":"https://api.github.com/users/mhrivnak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mhrivnak/subscriptions","organizations_url":"https://api.github.com/users/mhrivnak/orgs","repos_url":"https://api.github.com/users/mhrivnak/repos","events_url":"https://api.github.com/users/mhrivnak/events{/privacy}","received_events_url":"https://api.github.com/users/mhrivnak/received_events","type":"User","site_admin":false},"body":"How about ``os.path.join`` instead? I've never used ``os.sep`` directly, but I see that its documentation recommends using ``os.path.join``.","created_at":"2015-04-24T13:39:03Z","updated_at":"2015-04-24T13:39:03Z","html_url":"https://github.com/pulp/pulp_puppet/pull/177#discussion_r29048651","pull_request_url":"https://api.github.com/repos/pulp/pulp_puppet/pulls/177","_links":{"self":{"href":"https://api.github.com/repos/pulp/pulp_puppet/pulls/comments/29048651"},"html":{"href":"https://github.com/pulp/pulp_puppet/pull/177#discussion_r29048651"},"pull_request":{"href":"https://api.github.com/repos/pulp/pulp_puppet/pulls/177"}}},"pull_request":{"url":"https://api.github.com/repos/pulp/pulp_puppet/pulls/177","id":33981310,"html_url":"https://github.com/pulp/pulp_puppet/pull/177","diff_url":"https://github.com/pulp/pulp_puppet/pull/177.diff","patch_url":"https://github.com/pulp/pulp_puppet/pull/177.patch","issue_url":"https://api.github.com/repos/pulp/pulp_puppet/issues/177","number":177,"state":"open","locked":false,"title":"Updates metadata.json search to look in first top-level folder","user":{"login":"bmbouter","id":180319,"avatar_url":"https://avatars.githubusercontent.com/u/180319?v=3","gravatar_id":"","url":"https://api.github.com/users/bmbouter","html_url":"https://github.com/bmbouter","followers_url":"https://api.github.com/users/bmbouter/followers","following_url":"https://api.github.com/users/bmbouter/following{/other_user}","gists_url":"https://api.github.com/users/bmbouter/gists{/gist_id}","starred_url":"https://api.github.com/users/bmbouter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bmbouter/subscriptions","organizations_url":"https://api.github.com/users/bmbouter/orgs","repos_url":"https://api.github.com/users/bmbouter/repos","events_url":"https://api.github.com/users/bmbouter/events{/privacy}","received_events_url":"https://api.github.com/users/bmbouter/received_events","type":"User","site_admin":false},"body":"The implementation was using a depth-first-search which did not\r\ntraverse in the same order on all platforms. Some Puppet modules\r\ncontain other modules as dependencies, and the DFS implementation\r\ncould incorrectly find the wrong one. This uses a very dumb\r\napproach which looks for metadata.json in the top level folder\r\nof the the tar.gz uploaded Puppet module. This is based on the\r\nPuppet packaging guidelines [0].\r\n\r\n[0]:  https://docs.puppetlabs.com/puppet/latest/reference/modules_fundamentals.html#module-fundamentals\r\n\r\nhttps://pulp.plan.io/issues/890\r\ncloses #890","created_at":"2015-04-23T18:09:30Z","updated_at":"2015-04-24T13:39:03Z","closed_at":null,"merged_at":null,"merge_commit_sha":"655fa097d13f3a6572d2b8088a7f7c87f1293765","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/pulp/pulp_puppet/pulls/177/commits","review_comments_url":"https://api.github.com/repos/pulp/pulp_puppet/pulls/177/comments","review_comment_url":"https://api.github.com/repos/pulp/pulp_puppet/pulls/comments{/number}","comments_url":"https://api.github.com/repos/pulp/pulp_puppet/issues/177/comments","statuses_url":"https://api.github.com/repos/pulp/pulp_puppet/statuses/2c3775a0ab93ea3c15a88b21bca73450a20cff21","head":{"label":"bmbouter:890-pumpkin","ref":"890-pumpkin","sha":"2c3775a0ab93ea3c15a88b21bca73450a20cff21","user":{"login":"bmbouter","id":180319,"avatar_url":"https://avatars.githubusercontent.com/u/180319?v=3","gravatar_id":"","url":"https://api.github.com/users/bmbouter","html_url":"https://github.com/bmbouter","followers_url":"https://api.github.com/users/bmbouter/followers","following_url":"https://api.github.com/users/bmbouter/following{/other_user}","gists_url":"https://api.github.com/users/bmbouter/gists{/gist_id}","starred_url":"https://api.github.com/users/bmbouter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bmbouter/subscriptions","organizations_url":"https://api.github.com/users/bmbouter/orgs","repos_url":"https://api.github.com/users/bmbouter/repos","events_url":"https://api.github.com/users/bmbouter/events{/privacy}","received_events_url":"https://api.github.com/users/bmbouter/received_events","type":"User","site_admin":false},"repo":{"id":24892337,"name":"pulp_puppet","full_name":"bmbouter/pulp_puppet","owner":{"login":"bmbouter","id":180319,"avatar_url":"https://avatars.githubusercontent.com/u/180319?v=3","gravatar_id":"","url":"https://api.github.com/users/bmbouter","html_url":"https://github.com/bmbouter","followers_url":"https://api.github.com/users/bmbouter/followers","following_url":"https://api.github.com/users/bmbouter/following{/other_user}","gists_url":"https://api.github.com/users/bmbouter/gists{/gist_id}","starred_url":"https://api.github.com/users/bmbouter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bmbouter/subscriptions","organizations_url":"https://api.github.com/users/bmbouter/orgs","repos_url":"https://api.github.com/users/bmbouter/repos","events_url":"https://api.github.com/users/bmbouter/events{/privacy}","received_events_url":"https://api.github.com/users/bmbouter/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bmbouter/pulp_puppet","description":"Puppet support for the Pulp Platform","fork":true,"url":"https://api.github.com/repos/bmbouter/pulp_puppet","forks_url":"https://api.github.com/repos/bmbouter/pulp_puppet/forks","keys_url":"https://api.github.com/repos/bmbouter/pulp_puppet/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bmbouter/pulp_puppet/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bmbouter/pulp_puppet/teams","hooks_url":"https://api.github.com/repos/bmbouter/pulp_puppet/hooks","issue_events_url":"https://api.github.com/repos/bmbouter/pulp_puppet/issues/events{/number}","events_url":"https://api.github.com/repos/bmbouter/pulp_puppet/events","assignees_url":"https://api.github.com/repos/bmbouter/pulp_puppet/assignees{/user}","branches_url":"https://api.github.com/repos/bmbouter/pulp_puppet/branches{/branch}","tags_url":"https://api.github.com/repos/bmbouter/pulp_puppet/tags","blobs_url":"https://api.github.com/repos/bmbouter/pulp_puppet/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bmbouter/pulp_puppet/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bmbouter/pulp_puppet/git/refs{/sha}","trees_url":"https://api.github.com/repos/bmbouter/pulp_puppet/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bmbouter/pulp_puppet/statuses/{sha}","languages_url":"https://api.github.com/repos/bmbouter/pulp_puppet/languages","stargazers_url":"https://api.github.com/repos/bmbouter/pulp_puppet/stargazers","contributors_url":"https://api.github.com/repos/bmbouter/pulp_puppet/contributors","subscribers_url":"https://api.github.com/repos/bmbouter/pulp_puppet/subscribers","subscription_url":"https://api.github.com/repos/bmbouter/pulp_puppet/subscription","commits_url":"https://api.github.com/repos/bmbouter/pulp_puppet/commits{/sha}","git_commits_url":"https://api.github.com/repos/bmbouter/pulp_puppet/git/commits{/sha}","comments_url":"https://api.github.com/repos/bmbouter/pulp_puppet/comments{/number}","issue_comment_url":"https://api.github.com/repos/bmbouter/pulp_puppet/issues/comments{/number}","contents_url":"https://api.github.com/repos/bmbouter/pulp_puppet/contents/{+path}","compare_url":"https://api.github.com/repos/bmbouter/pulp_puppet/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bmbouter/pulp_puppet/merges","archive_url":"https://api.github.com/repos/bmbouter/pulp_puppet/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bmbouter/pulp_puppet/downloads","issues_url":"https://api.github.com/repos/bmbouter/pulp_puppet/issues{/number}","pulls_url":"https://api.github.com/repos/bmbouter/pulp_puppet/pulls{/number}","milestones_url":"https://api.github.com/repos/bmbouter/pulp_puppet/milestones{/number}","notifications_url":"https://api.github.com/repos/bmbouter/pulp_puppet/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bmbouter/pulp_puppet/labels{/name}","releases_url":"https://api.github.com/repos/bmbouter/pulp_puppet/releases{/id}","created_at":"2014-10-07T13:49:28Z","updated_at":"2015-03-30T21:02:50Z","pushed_at":"2015-04-23T18:06:32Z","git_url":"git://github.com/bmbouter/pulp_puppet.git","ssh_url":"git@github.com:bmbouter/pulp_puppet.git","clone_url":"https://github.com/bmbouter/pulp_puppet.git","svn_url":"https://github.com/bmbouter/pulp_puppet","homepage":null,"size":1496,"stargazers_count":0,"watchers_count":0,"language":"Python","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":"pulp:2.6-dev","ref":"2.6-dev","sha":"144713a627a2afed92c026c3643b8e2d6ba98f1f","user":{"login":"pulp","id":2103606,"avatar_url":"https://avatars.githubusercontent.com/u/2103606?v=3","gravatar_id":"","url":"https://api.github.com/users/pulp","html_url":"https://github.com/pulp","followers_url":"https://api.github.com/users/pulp/followers","following_url":"https://api.github.com/users/pulp/following{/other_user}","gists_url":"https://api.github.com/users/pulp/gists{/gist_id}","starred_url":"https://api.github.com/users/pulp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pulp/subscriptions","organizations_url":"https://api.github.com/users/pulp/orgs","repos_url":"https://api.github.com/users/pulp/repos","events_url":"https://api.github.com/users/pulp/events{/privacy}","received_events_url":"https://api.github.com/users/pulp/received_events","type":"Organization","site_admin":false},"repo":{"id":6106067,"name":"pulp_puppet","full_name":"pulp/pulp_puppet","owner":{"login":"pulp","id":2103606,"avatar_url":"https://avatars.githubusercontent.com/u/2103606?v=3","gravatar_id":"","url":"https://api.github.com/users/pulp","html_url":"https://github.com/pulp","followers_url":"https://api.github.com/users/pulp/followers","following_url":"https://api.github.com/users/pulp/following{/other_user}","gists_url":"https://api.github.com/users/pulp/gists{/gist_id}","starred_url":"https://api.github.com/users/pulp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pulp/subscriptions","organizations_url":"https://api.github.com/users/pulp/orgs","repos_url":"https://api.github.com/users/pulp/repos","events_url":"https://api.github.com/users/pulp/events{/privacy}","received_events_url":"https://api.github.com/users/pulp/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/pulp/pulp_puppet","description":"Puppet support for the Pulp Platform","fork":false,"url":"https://api.github.com/repos/pulp/pulp_puppet","forks_url":"https://api.github.com/repos/pulp/pulp_puppet/forks","keys_url":"https://api.github.com/repos/pulp/pulp_puppet/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pulp/pulp_puppet/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pulp/pulp_puppet/teams","hooks_url":"https://api.github.com/repos/pulp/pulp_puppet/hooks","issue_events_url":"https://api.github.com/repos/pulp/pulp_puppet/issues/events{/number}","events_url":"https://api.github.com/repos/pulp/pulp_puppet/events","assignees_url":"https://api.github.com/repos/pulp/pulp_puppet/assignees{/user}","branches_url":"https://api.github.com/repos/pulp/pulp_puppet/branches{/branch}","tags_url":"https://api.github.com/repos/pulp/pulp_puppet/tags","blobs_url":"https://api.github.com/repos/pulp/pulp_puppet/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pulp/pulp_puppet/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pulp/pulp_puppet/git/refs{/sha}","trees_url":"https://api.github.com/repos/pulp/pulp_puppet/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pulp/pulp_puppet/statuses/{sha}","languages_url":"https://api.github.com/repos/pulp/pulp_puppet/languages","stargazers_url":"https://api.github.com/repos/pulp/pulp_puppet/stargazers","contributors_url":"https://api.github.com/repos/pulp/pulp_puppet/contributors","subscribers_url":"https://api.github.com/repos/pulp/pulp_puppet/subscribers","subscription_url":"https://api.github.com/repos/pulp/pulp_puppet/subscription","commits_url":"https://api.github.com/repos/pulp/pulp_puppet/commits{/sha}","git_commits_url":"https://api.github.com/repos/pulp/pulp_puppet/git/commits{/sha}","comments_url":"https://api.github.com/repos/pulp/pulp_puppet/comments{/number}","issue_comment_url":"https://api.github.com/repos/pulp/pulp_puppet/issues/comments{/number}","contents_url":"https://api.github.com/repos/pulp/pulp_puppet/contents/{+path}","compare_url":"https://api.github.com/repos/pulp/pulp_puppet/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pulp/pulp_puppet/merges","archive_url":"https://api.github.com/repos/pulp/pulp_puppet/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pulp/pulp_puppet/downloads","issues_url":"https://api.github.com/repos/pulp/pulp_puppet/issues{/number}","pulls_url":"https://api.github.com/repos/pulp/pulp_puppet/pulls{/number}","milestones_url":"https://api.github.com/repos/pulp/pulp_puppet/milestones{/number}","notifications_url":"https://api.github.com/repos/pulp/pulp_puppet/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pulp/pulp_puppet/labels{/name}","releases_url":"https://api.github.com/repos/pulp/pulp_puppet/releases{/id}","created_at":"2012-10-06T19:35:41Z","updated_at":"2015-04-20T18:22:20Z","pushed_at":"2015-04-24T13:05:51Z","git_url":"git://github.com/pulp/pulp_puppet.git","ssh_url":"git@github.com:pulp/pulp_puppet.git","clone_url":"https://github.com/pulp/pulp_puppet.git","svn_url":"https://github.com/pulp/pulp_puppet","homepage":null,"size":4912,"stargazers_count":8,"watchers_count":8,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":25,"mirror_url":null,"open_issues_count":2,"forks":25,"open_issues":2,"watchers":8,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/pulp/pulp_puppet/pulls/177"},"html":{"href":"https://github.com/pulp/pulp_puppet/pull/177"},"issue":{"href":"https://api.github.com/repos/pulp/pulp_puppet/issues/177"},"comments":{"href":"https://api.github.com/repos/pulp/pulp_puppet/issues/177/comments"},"review_comments":{"href":"https://api.github.com/repos/pulp/pulp_puppet/pulls/177/comments"},"review_comment":{"href":"https://api.github.com/repos/pulp/pulp_puppet/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/pulp/pulp_puppet/pulls/177/commits"},"statuses":{"href":"https://api.github.com/repos/pulp/pulp_puppet/statuses/2c3775a0ab93ea3c15a88b21bca73450a20cff21"}}}}