{"action":"created","comment":{"url":"https://api.github.com/repos/sosreport/sos/pulls/comments/66056314","id":66056314,"diff_hunk":"@@ -76,37 +86,40 @@ def export_mongodb(self):\n                 suggest_filename=\"{}.json\".format(collection))\n \n     def setup(self):\n-        self.add_copy_spec([\n-            \"/var/lib/juju\"\n-        ])\n         limit = self.get_option(\"log_size\")\n         self.add_copy_spec_limit(\"/var/log/upstart/juju-db.log\",\n                                  sizelimit=limit)\n         self.add_copy_spec_limit(\"/var/log/upstart/juju-db.log.1\",\n                                  sizelimit=limit)\n         if not self.get_option(\"all_logs\"):\n             # Capture the last bit of all files\n-            for filename in os.listdir(\"/var/log/juju/\"):\n-                if filename.endswith(\".log\"):\n-                    fullname = \"/var/log/juju/\" + filename\n-                    self.add_copy_spec_limit(fullname, sizelimit=limit)\n-            # Do just the all-machines from juju local\n-            self.add_copy_spec_limit(\"/var/log/juju-*/all-machines.log\",\n-                                     sizelimit=limit)\n+            if(os.path.isdir(\"/var/log/juju/\")):\n+                for filename in os.listdir(\"/var/log/juju/\"):\n+                    if filename.endswith(\".log\"):\n+                        fullname = \"/var/log/juju/\" + filename\n+                        self.add_copy_spec_limit(fullname, sizelimit=limit)\n             self.add_cmd_output('ls -alRh /var/log/juju*')\n+            self.add_cmd_output('ls -alRh /var/lib/juju/*')\n+\n         else:\n             self.add_copy_spec([\n                 \"/var/log/juju\",\n-                \"/var/log/juju-*\"\n+                \"/var/log/juju-*\",\n+                \"/var/lib/juju\"\n             ])\n \n-        self.add_cmd_output([\n-            \"juju -v status\",\n-            \"juju -v get-constraints\"\n-        ])\n-\n-        for service in self.get_deployed_services():\n-            self.add_cmd_output(\"juju get {}\".format(service))\n+        if(os.path.exists(\"/usr/bin/juju\")):","path":"sos/plugins/juju.py","position":63,"original_position":63,"commit_id":"fd21da83097b234bfd63bb5df74d2aed20088dce","original_commit_id":"fd21da83097b234bfd63bb5df74d2aed20088dce","user":{"login":"bmr-cymru","id":910549,"avatar_url":"https://avatars.githubusercontent.com/u/910549?v=3","gravatar_id":"","url":"https://api.github.com/users/bmr-cymru","html_url":"https://github.com/bmr-cymru","followers_url":"https://api.github.com/users/bmr-cymru/followers","following_url":"https://api.github.com/users/bmr-cymru/following{/other_user}","gists_url":"https://api.github.com/users/bmr-cymru/gists{/gist_id}","starred_url":"https://api.github.com/users/bmr-cymru/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bmr-cymru/subscriptions","organizations_url":"https://api.github.com/users/bmr-cymru/orgs","repos_url":"https://api.github.com/users/bmr-cymru/repos","events_url":"https://api.github.com/users/bmr-cymru/events{/privacy}","received_events_url":"https://api.github.com/users/bmr-cymru/received_events","type":"User","site_admin":false},"body":"This doesn't need to be in an if block (and generally we do not check for command presence in sos unless it is absolutely necessary). Just attempt the `add_cmd_output()` and if the command doesn't exist it won't be collected. Similarly with the `get_deployed_services()` stuff - just have the function return an empty list if it can't run the command and the loop bodies disappear.","created_at":"2016-06-07T11:54:09Z","updated_at":"2016-06-07T11:54:09Z","html_url":"https://github.com/sosreport/sos/pull/829#discussion_r66056314","pull_request_url":"https://api.github.com/repos/sosreport/sos/pulls/829","_links":{"self":{"href":"https://api.github.com/repos/sosreport/sos/pulls/comments/66056314"},"html":{"href":"https://github.com/sosreport/sos/pull/829#discussion_r66056314"},"pull_request":{"href":"https://api.github.com/repos/sosreport/sos/pulls/829"}}},"pull_request":{"url":"https://api.github.com/repos/sosreport/sos/pulls/829","id":72745517,"html_url":"https://github.com/sosreport/sos/pull/829","diff_url":"https://github.com/sosreport/sos/pull/829.diff","patch_url":"https://github.com/sosreport/sos/pull/829.patch","issue_url":"https://api.github.com/repos/sosreport/sos/issues/829","number":829,"state":"open","locked":false,"title":"[juju] Get Ready for 2.0 and make it less likely to get too much","user":{"login":"BryanQuigley","id":702754,"avatar_url":"https://avatars.githubusercontent.com/u/702754?v=3","gravatar_id":"","url":"https://api.github.com/users/BryanQuigley","html_url":"https://github.com/BryanQuigley","followers_url":"https://api.github.com/users/BryanQuigley/followers","following_url":"https://api.github.com/users/BryanQuigley/following{/other_user}","gists_url":"https://api.github.com/users/BryanQuigley/gists{/gist_id}","starred_url":"https://api.github.com/users/BryanQuigley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BryanQuigley/subscriptions","organizations_url":"https://api.github.com/users/BryanQuigley/orgs","repos_url":"https://api.github.com/users/BryanQuigley/repos","events_url":"https://api.github.com/users/BryanQuigley/events{/privacy}","received_events_url":"https://api.github.com/users/BryanQuigley/received_events","type":"User","site_admin":false},"body":"The package name juju is no longer the only way to install juju,\r\nso replace with checking /usr/bin/juju|juju-run.\r\n\r\nJuju-run is on machines deployed with juju.  Logging still occurs\r\nthere in same pattern - /var/log/juju/machinename.log.\r\n\r\nJuju \"Local\" logs were never seen in the wild and has been removed.\r\n\r\nCheck that /var/log/juju/ exists before trying to access it.\r\nCheck that /usr/bin/juju exists before trying to run it.\r\nCheck that Juju's mongodb exists before trying to parse it.\r\n\r\n/var/lib/juju/ contains a database that can grow to many GB, let's\r\nnot include that by default.\r\n\r\nAlso explicitly specified juju formats tabular and json (in 2.0\r\ntabular is the default and in 1.25 json is).\r\nAnd we also now explicitly capture the version.\r\n\r\nFix up contrainsts and get-config/get so it works for both versions.\r\n\r\nSigned-off-by: Bryan Quigley <bryan.quigley@canonical.com>","created_at":"2016-06-06T17:18:30Z","updated_at":"2016-06-07T11:54:09Z","closed_at":null,"merged_at":null,"merge_commit_sha":"39593b73b6237fa628d7ea778aa9f49ec5d99adb","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/sosreport/sos/pulls/829/commits","review_comments_url":"https://api.github.com/repos/sosreport/sos/pulls/829/comments","review_comment_url":"https://api.github.com/repos/sosreport/sos/pulls/comments{/number}","comments_url":"https://api.github.com/repos/sosreport/sos/issues/829/comments","statuses_url":"https://api.github.com/repos/sosreport/sos/statuses/fd21da83097b234bfd63bb5df74d2aed20088dce","head":{"label":"BryanQuigley:juju-fixes","ref":"juju-fixes","sha":"fd21da83097b234bfd63bb5df74d2aed20088dce","user":{"login":"BryanQuigley","id":702754,"avatar_url":"https://avatars.githubusercontent.com/u/702754?v=3","gravatar_id":"","url":"https://api.github.com/users/BryanQuigley","html_url":"https://github.com/BryanQuigley","followers_url":"https://api.github.com/users/BryanQuigley/followers","following_url":"https://api.github.com/users/BryanQuigley/following{/other_user}","gists_url":"https://api.github.com/users/BryanQuigley/gists{/gist_id}","starred_url":"https://api.github.com/users/BryanQuigley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BryanQuigley/subscriptions","organizations_url":"https://api.github.com/users/BryanQuigley/orgs","repos_url":"https://api.github.com/users/BryanQuigley/repos","events_url":"https://api.github.com/users/BryanQuigley/events{/privacy}","received_events_url":"https://api.github.com/users/BryanQuigley/received_events","type":"User","site_admin":false},"repo":{"id":31320449,"name":"sos","full_name":"BryanQuigley/sos","owner":{"login":"BryanQuigley","id":702754,"avatar_url":"https://avatars.githubusercontent.com/u/702754?v=3","gravatar_id":"","url":"https://api.github.com/users/BryanQuigley","html_url":"https://github.com/BryanQuigley","followers_url":"https://api.github.com/users/BryanQuigley/followers","following_url":"https://api.github.com/users/BryanQuigley/following{/other_user}","gists_url":"https://api.github.com/users/BryanQuigley/gists{/gist_id}","starred_url":"https://api.github.com/users/BryanQuigley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BryanQuigley/subscriptions","organizations_url":"https://api.github.com/users/BryanQuigley/orgs","repos_url":"https://api.github.com/users/BryanQuigley/repos","events_url":"https://api.github.com/users/BryanQuigley/events{/privacy}","received_events_url":"https://api.github.com/users/BryanQuigley/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/BryanQuigley/sos","description":"A unified tool for collecting system logs and other debug information","fork":true,"url":"https://api.github.com/repos/BryanQuigley/sos","forks_url":"https://api.github.com/repos/BryanQuigley/sos/forks","keys_url":"https://api.github.com/repos/BryanQuigley/sos/keys{/key_id}","collaborators_url":"https://api.github.com/repos/BryanQuigley/sos/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/BryanQuigley/sos/teams","hooks_url":"https://api.github.com/repos/BryanQuigley/sos/hooks","issue_events_url":"https://api.github.com/repos/BryanQuigley/sos/issues/events{/number}","events_url":"https://api.github.com/repos/BryanQuigley/sos/events","assignees_url":"https://api.github.com/repos/BryanQuigley/sos/assignees{/user}","branches_url":"https://api.github.com/repos/BryanQuigley/sos/branches{/branch}","tags_url":"https://api.github.com/repos/BryanQuigley/sos/tags","blobs_url":"https://api.github.com/repos/BryanQuigley/sos/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/BryanQuigley/sos/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/BryanQuigley/sos/git/refs{/sha}","trees_url":"https://api.github.com/repos/BryanQuigley/sos/git/trees{/sha}","statuses_url":"https://api.github.com/repos/BryanQuigley/sos/statuses/{sha}","languages_url":"https://api.github.com/repos/BryanQuigley/sos/languages","stargazers_url":"https://api.github.com/repos/BryanQuigley/sos/stargazers","contributors_url":"https://api.github.com/repos/BryanQuigley/sos/contributors","subscribers_url":"https://api.github.com/repos/BryanQuigley/sos/subscribers","subscription_url":"https://api.github.com/repos/BryanQuigley/sos/subscription","commits_url":"https://api.github.com/repos/BryanQuigley/sos/commits{/sha}","git_commits_url":"https://api.github.com/repos/BryanQuigley/sos/git/commits{/sha}","comments_url":"https://api.github.com/repos/BryanQuigley/sos/comments{/number}","issue_comment_url":"https://api.github.com/repos/BryanQuigley/sos/issues/comments{/number}","contents_url":"https://api.github.com/repos/BryanQuigley/sos/contents/{+path}","compare_url":"https://api.github.com/repos/BryanQuigley/sos/compare/{base}...{head}","merges_url":"https://api.github.com/repos/BryanQuigley/sos/merges","archive_url":"https://api.github.com/repos/BryanQuigley/sos/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/BryanQuigley/sos/downloads","issues_url":"https://api.github.com/repos/BryanQuigley/sos/issues{/number}","pulls_url":"https://api.github.com/repos/BryanQuigley/sos/pulls{/number}","milestones_url":"https://api.github.com/repos/BryanQuigley/sos/milestones{/number}","notifications_url":"https://api.github.com/repos/BryanQuigley/sos/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/BryanQuigley/sos/labels{/name}","releases_url":"https://api.github.com/repos/BryanQuigley/sos/releases{/id}","deployments_url":"https://api.github.com/repos/BryanQuigley/sos/deployments","created_at":"2015-02-25T15:34:34Z","updated_at":"2016-02-18T19:41:06Z","pushed_at":"2016-06-06T19:43:34Z","git_url":"git://github.com/BryanQuigley/sos.git","ssh_url":"git@github.com:BryanQuigley/sos.git","clone_url":"https://github.com/BryanQuigley/sos.git","svn_url":"https://github.com/BryanQuigley/sos","homepage":"http://sos.rtfd.org","size":5025,"stargazers_count":0,"watchers_count":0,"language":"Python","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":"master"}},"base":{"label":"sosreport:master","ref":"master","sha":"b523592d69b4eebd23a83a06ff3df7d906ddd95f","user":{"login":"sosreport","id":908256,"avatar_url":"https://avatars.githubusercontent.com/u/908256?v=3","gravatar_id":"","url":"https://api.github.com/users/sosreport","html_url":"https://github.com/sosreport","followers_url":"https://api.github.com/users/sosreport/followers","following_url":"https://api.github.com/users/sosreport/following{/other_user}","gists_url":"https://api.github.com/users/sosreport/gists{/gist_id}","starred_url":"https://api.github.com/users/sosreport/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sosreport/subscriptions","organizations_url":"https://api.github.com/users/sosreport/orgs","repos_url":"https://api.github.com/users/sosreport/repos","events_url":"https://api.github.com/users/sosreport/events{/privacy}","received_events_url":"https://api.github.com/users/sosreport/received_events","type":"Organization","site_admin":false},"repo":{"id":2031428,"name":"sos","full_name":"sosreport/sos","owner":{"login":"sosreport","id":908256,"avatar_url":"https://avatars.githubusercontent.com/u/908256?v=3","gravatar_id":"","url":"https://api.github.com/users/sosreport","html_url":"https://github.com/sosreport","followers_url":"https://api.github.com/users/sosreport/followers","following_url":"https://api.github.com/users/sosreport/following{/other_user}","gists_url":"https://api.github.com/users/sosreport/gists{/gist_id}","starred_url":"https://api.github.com/users/sosreport/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sosreport/subscriptions","organizations_url":"https://api.github.com/users/sosreport/orgs","repos_url":"https://api.github.com/users/sosreport/repos","events_url":"https://api.github.com/users/sosreport/events{/privacy}","received_events_url":"https://api.github.com/users/sosreport/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/sosreport/sos","description":"A unified tool for collecting system logs and other debug information","fork":false,"url":"https://api.github.com/repos/sosreport/sos","forks_url":"https://api.github.com/repos/sosreport/sos/forks","keys_url":"https://api.github.com/repos/sosreport/sos/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sosreport/sos/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sosreport/sos/teams","hooks_url":"https://api.github.com/repos/sosreport/sos/hooks","issue_events_url":"https://api.github.com/repos/sosreport/sos/issues/events{/number}","events_url":"https://api.github.com/repos/sosreport/sos/events","assignees_url":"https://api.github.com/repos/sosreport/sos/assignees{/user}","branches_url":"https://api.github.com/repos/sosreport/sos/branches{/branch}","tags_url":"https://api.github.com/repos/sosreport/sos/tags","blobs_url":"https://api.github.com/repos/sosreport/sos/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sosreport/sos/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sosreport/sos/git/refs{/sha}","trees_url":"https://api.github.com/repos/sosreport/sos/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sosreport/sos/statuses/{sha}","languages_url":"https://api.github.com/repos/sosreport/sos/languages","stargazers_url":"https://api.github.com/repos/sosreport/sos/stargazers","contributors_url":"https://api.github.com/repos/sosreport/sos/contributors","subscribers_url":"https://api.github.com/repos/sosreport/sos/subscribers","subscription_url":"https://api.github.com/repos/sosreport/sos/subscription","commits_url":"https://api.github.com/repos/sosreport/sos/commits{/sha}","git_commits_url":"https://api.github.com/repos/sosreport/sos/git/commits{/sha}","comments_url":"https://api.github.com/repos/sosreport/sos/comments{/number}","issue_comment_url":"https://api.github.com/repos/sosreport/sos/issues/comments{/number}","contents_url":"https://api.github.com/repos/sosreport/sos/contents/{+path}","compare_url":"https://api.github.com/repos/sosreport/sos/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sosreport/sos/merges","archive_url":"https://api.github.com/repos/sosreport/sos/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sosreport/sos/downloads","issues_url":"https://api.github.com/repos/sosreport/sos/issues{/number}","pulls_url":"https://api.github.com/repos/sosreport/sos/pulls{/number}","milestones_url":"https://api.github.com/repos/sosreport/sos/milestones{/number}","notifications_url":"https://api.github.com/repos/sosreport/sos/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sosreport/sos/labels{/name}","releases_url":"https://api.github.com/repos/sosreport/sos/releases{/id}","deployments_url":"https://api.github.com/repos/sosreport/sos/deployments","created_at":"2011-07-11T16:58:15Z","updated_at":"2016-06-06T16:19:21Z","pushed_at":"2016-06-06T19:47:18Z","git_url":"git://github.com/sosreport/sos.git","ssh_url":"git@github.com:sosreport/sos.git","clone_url":"https://github.com/sosreport/sos.git","svn_url":"https://github.com/sosreport/sos","homepage":"http://sos.rtfd.org","size":7474,"stargazers_count":113,"watchers_count":113,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":125,"mirror_url":null,"open_issues_count":138,"forks":125,"open_issues":138,"watchers":113,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/sosreport/sos/pulls/829"},"html":{"href":"https://github.com/sosreport/sos/pull/829"},"issue":{"href":"https://api.github.com/repos/sosreport/sos/issues/829"},"comments":{"href":"https://api.github.com/repos/sosreport/sos/issues/829/comments"},"review_comments":{"href":"https://api.github.com/repos/sosreport/sos/pulls/829/comments"},"review_comment":{"href":"https://api.github.com/repos/sosreport/sos/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/sosreport/sos/pulls/829/commits"},"statuses":{"href":"https://api.github.com/repos/sosreport/sos/statuses/fd21da83097b234bfd63bb5df74d2aed20088dce"}}}}
{"actor":{"display_login":"bmr-cymru"}}