{"action":"created","comment":{"url":"https://api.github.com/repos/projectatomic/atomic/pulls/comments/63409855","id":63409855,"diff_hunk":"@@ -34,32 +36,62 @@ def get_scan_info(scanner, scan_type):\n                     for x in i['scans']:\n                         if x['name'] == scan_type:\n                             return i['image_name'], x['args'], i.get('custom_args')\n+\n+        def set_default_scanner():\n+            self.default_scanner = self.atomic_config['default_scanner']\n+\n         if self.args.debug:\n             self.debug = True\n \n         # Set debug bool\n         self.set_debug()\n \n+        set_default_scanner()\n+\n+        # If no scanners are defined\n+        if len(self.scanners) < 1:\n+            count = 1\n+            raise ValueError(\"No scanners are configured for your system.\")\n+        # If a scanner is defined in parseargs\n+        elif self.args.scanner is not None:\n+            count = 3\n+            self.scanner = self.args.scanner\n+        # If only one scanner is defined and no default is defined\n+        elif len(self.scanners) == 1 and self.default_scanner is None and self.args.scanner is None:\n+            count = 4\n+            self.scanner = self.scanners[0]['scanner_name']\n+        # If more than one scanner is defined but no default\n+        elif len(self.scanners) > 1 and self.default_scanner is None:\n+            count = 5\n+            raise ValueError(\"Because you have multiple scanners configured for your system, you must have a default \"\n+                             \"scanner defined in /etc/atomic.conf. Use --list to see what scanners are \"\n+                             \"available for your system.\")\n+        # If no scanner is defined by parseargs, but there is a default scanner\n+        elif self.args.scanner is None and self.default_scanner is not None:\n+            count = 6\n+            self.scanner = self.default_scanner\n+","path":"Atomic/scan.py","position":47,"original_position":47,"commit_id":"06b7a26482441ccb4bfcd8284b0dbef0bd009e53","original_commit_id":"06b7a26482441ccb4bfcd8284b0dbef0bd009e53","user":{"login":"baude","id":8824535,"avatar_url":"https://avatars.githubusercontent.com/u/8824535?v=3","gravatar_id":"","url":"https://api.github.com/users/baude","html_url":"https://github.com/baude","followers_url":"https://api.github.com/users/baude/followers","following_url":"https://api.github.com/users/baude/following{/other_user}","gists_url":"https://api.github.com/users/baude/gists{/gist_id}","starred_url":"https://api.github.com/users/baude/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/baude/subscriptions","organizations_url":"https://api.github.com/users/baude/orgs","repos_url":"https://api.github.com/users/baude/repos","events_url":"https://api.github.com/users/baude/events{/privacy}","received_events_url":"https://api.github.com/users/baude/received_events","type":"User","site_admin":false},"body":"Well it is possible that if not default is defined, self.default_scanner can == None.","created_at":"2016-05-16T19:25:34Z","updated_at":"2016-05-16T19:25:34Z","html_url":"https://github.com/projectatomic/atomic/pull/383#discussion_r63409855","pull_request_url":"https://api.github.com/repos/projectatomic/atomic/pulls/383","_links":{"self":{"href":"https://api.github.com/repos/projectatomic/atomic/pulls/comments/63409855"},"html":{"href":"https://github.com/projectatomic/atomic/pull/383#discussion_r63409855"},"pull_request":{"href":"https://api.github.com/repos/projectatomic/atomic/pulls/383"}}},"pull_request":{"url":"https://api.github.com/repos/projectatomic/atomic/pulls/383","id":69901324,"html_url":"https://github.com/projectatomic/atomic/pull/383","diff_url":"https://github.com/projectatomic/atomic/pull/383.diff","patch_url":"https://github.com/projectatomic/atomic/pull/383.patch","issue_url":"https://api.github.com/repos/projectatomic/atomic/issues/383","number":383,"state":"open","locked":false,"title":"Change rules around declaring a default scanner.","user":{"login":"baude","id":8824535,"avatar_url":"https://avatars.githubusercontent.com/u/8824535?v=3","gravatar_id":"","url":"https://api.github.com/users/baude","html_url":"https://github.com/baude","followers_url":"https://api.github.com/users/baude/followers","following_url":"https://api.github.com/users/baude/following{/other_user}","gists_url":"https://api.github.com/users/baude/gists{/gist_id}","starred_url":"https://api.github.com/users/baude/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/baude/subscriptions","organizations_url":"https://api.github.com/users/baude/orgs","repos_url":"https://api.github.com/users/baude/repos","events_url":"https://api.github.com/users/baude/events{/privacy}","received_events_url":"https://api.github.com/users/baude/received_events","type":"User","site_admin":false},"body":"Previously, with the understanding we would be shipping a single\r\ngeneric scanner configuration file, would 1) install the config\r\nfile and we had preset a default scanner in atomic.conf.\r\n\r\nWith the realization that the scanner could be variable based\r\non the distribution, the generic file is not longer installed\r\nby default. Therefore, we should probably not set a default.\r\n\r\nThe prior code failed if a default was not defined in\r\n/etc/atomic.conf.  That code check has been altered and we now\r\nadhere to the following rules:\r\n\r\n* If no default is defined AND there is only one configured\r\n scanner, we assume the single scanner IS the default.\r\n\r\n* If no default is defined AND there are multiple scanners, we\r\n error out and ask the user to define one.\r\n\r\n* If there is a default defined, good to go!","created_at":"2016-05-12T20:28:14Z","updated_at":"2016-05-16T19:25:34Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a05d4c1eca04ed7dc67c1e5e2b1c24479be0c6ba","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/projectatomic/atomic/pulls/383/commits","review_comments_url":"https://api.github.com/repos/projectatomic/atomic/pulls/383/comments","review_comment_url":"https://api.github.com/repos/projectatomic/atomic/pulls/comments{/number}","comments_url":"https://api.github.com/repos/projectatomic/atomic/issues/383/comments","statuses_url":"https://api.github.com/repos/projectatomic/atomic/statuses/06b7a26482441ccb4bfcd8284b0dbef0bd009e53","head":{"label":"baude:atomic_scan_default","ref":"atomic_scan_default","sha":"06b7a26482441ccb4bfcd8284b0dbef0bd009e53","user":{"login":"baude","id":8824535,"avatar_url":"https://avatars.githubusercontent.com/u/8824535?v=3","gravatar_id":"","url":"https://api.github.com/users/baude","html_url":"https://github.com/baude","followers_url":"https://api.github.com/users/baude/followers","following_url":"https://api.github.com/users/baude/following{/other_user}","gists_url":"https://api.github.com/users/baude/gists{/gist_id}","starred_url":"https://api.github.com/users/baude/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/baude/subscriptions","organizations_url":"https://api.github.com/users/baude/orgs","repos_url":"https://api.github.com/users/baude/repos","events_url":"https://api.github.com/users/baude/events{/privacy}","received_events_url":"https://api.github.com/users/baude/received_events","type":"User","site_admin":false},"repo":{"id":40921469,"name":"atomic","full_name":"baude/atomic","owner":{"login":"baude","id":8824535,"avatar_url":"https://avatars.githubusercontent.com/u/8824535?v=3","gravatar_id":"","url":"https://api.github.com/users/baude","html_url":"https://github.com/baude","followers_url":"https://api.github.com/users/baude/followers","following_url":"https://api.github.com/users/baude/following{/other_user}","gists_url":"https://api.github.com/users/baude/gists{/gist_id}","starred_url":"https://api.github.com/users/baude/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/baude/subscriptions","organizations_url":"https://api.github.com/users/baude/orgs","repos_url":"https://api.github.com/users/baude/repos","events_url":"https://api.github.com/users/baude/events{/privacy}","received_events_url":"https://api.github.com/users/baude/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/baude/atomic","description":"Atomic Run Tool for installing/running/managing container images.","fork":true,"url":"https://api.github.com/repos/baude/atomic","forks_url":"https://api.github.com/repos/baude/atomic/forks","keys_url":"https://api.github.com/repos/baude/atomic/keys{/key_id}","collaborators_url":"https://api.github.com/repos/baude/atomic/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/baude/atomic/teams","hooks_url":"https://api.github.com/repos/baude/atomic/hooks","issue_events_url":"https://api.github.com/repos/baude/atomic/issues/events{/number}","events_url":"https://api.github.com/repos/baude/atomic/events","assignees_url":"https://api.github.com/repos/baude/atomic/assignees{/user}","branches_url":"https://api.github.com/repos/baude/atomic/branches{/branch}","tags_url":"https://api.github.com/repos/baude/atomic/tags","blobs_url":"https://api.github.com/repos/baude/atomic/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/baude/atomic/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/baude/atomic/git/refs{/sha}","trees_url":"https://api.github.com/repos/baude/atomic/git/trees{/sha}","statuses_url":"https://api.github.com/repos/baude/atomic/statuses/{sha}","languages_url":"https://api.github.com/repos/baude/atomic/languages","stargazers_url":"https://api.github.com/repos/baude/atomic/stargazers","contributors_url":"https://api.github.com/repos/baude/atomic/contributors","subscribers_url":"https://api.github.com/repos/baude/atomic/subscribers","subscription_url":"https://api.github.com/repos/baude/atomic/subscription","commits_url":"https://api.github.com/repos/baude/atomic/commits{/sha}","git_commits_url":"https://api.github.com/repos/baude/atomic/git/commits{/sha}","comments_url":"https://api.github.com/repos/baude/atomic/comments{/number}","issue_comment_url":"https://api.github.com/repos/baude/atomic/issues/comments{/number}","contents_url":"https://api.github.com/repos/baude/atomic/contents/{+path}","compare_url":"https://api.github.com/repos/baude/atomic/compare/{base}...{head}","merges_url":"https://api.github.com/repos/baude/atomic/merges","archive_url":"https://api.github.com/repos/baude/atomic/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/baude/atomic/downloads","issues_url":"https://api.github.com/repos/baude/atomic/issues{/number}","pulls_url":"https://api.github.com/repos/baude/atomic/pulls{/number}","milestones_url":"https://api.github.com/repos/baude/atomic/milestones{/number}","notifications_url":"https://api.github.com/repos/baude/atomic/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/baude/atomic/labels{/name}","releases_url":"https://api.github.com/repos/baude/atomic/releases{/id}","deployments_url":"https://api.github.com/repos/baude/atomic/deployments","created_at":"2015-08-17T19:12:19Z","updated_at":"2015-08-17T19:12:19Z","pushed_at":"2016-05-16T18:10:38Z","git_url":"git://github.com/baude/atomic.git","ssh_url":"git@github.com:baude/atomic.git","clone_url":"https://github.com/baude/atomic.git","svn_url":"https://github.com/baude/atomic","homepage":null,"size":1522,"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":"api_mount"}},"base":{"label":"projectatomic:master","ref":"master","sha":"f0d2de591a4af0af567ddd446c906535a3f0aeb9","user":{"login":"projectatomic","id":6852258,"avatar_url":"https://avatars.githubusercontent.com/u/6852258?v=3","gravatar_id":"","url":"https://api.github.com/users/projectatomic","html_url":"https://github.com/projectatomic","followers_url":"https://api.github.com/users/projectatomic/followers","following_url":"https://api.github.com/users/projectatomic/following{/other_user}","gists_url":"https://api.github.com/users/projectatomic/gists{/gist_id}","starred_url":"https://api.github.com/users/projectatomic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/projectatomic/subscriptions","organizations_url":"https://api.github.com/users/projectatomic/orgs","repos_url":"https://api.github.com/users/projectatomic/repos","events_url":"https://api.github.com/users/projectatomic/events{/privacy}","received_events_url":"https://api.github.com/users/projectatomic/received_events","type":"Organization","site_admin":false},"repo":{"id":29267754,"name":"atomic","full_name":"projectatomic/atomic","owner":{"login":"projectatomic","id":6852258,"avatar_url":"https://avatars.githubusercontent.com/u/6852258?v=3","gravatar_id":"","url":"https://api.github.com/users/projectatomic","html_url":"https://github.com/projectatomic","followers_url":"https://api.github.com/users/projectatomic/followers","following_url":"https://api.github.com/users/projectatomic/following{/other_user}","gists_url":"https://api.github.com/users/projectatomic/gists{/gist_id}","starred_url":"https://api.github.com/users/projectatomic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/projectatomic/subscriptions","organizations_url":"https://api.github.com/users/projectatomic/orgs","repos_url":"https://api.github.com/users/projectatomic/repos","events_url":"https://api.github.com/users/projectatomic/events{/privacy}","received_events_url":"https://api.github.com/users/projectatomic/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/projectatomic/atomic","description":"Atomic Run Tool for installing/running/managing container images.","fork":false,"url":"https://api.github.com/repos/projectatomic/atomic","forks_url":"https://api.github.com/repos/projectatomic/atomic/forks","keys_url":"https://api.github.com/repos/projectatomic/atomic/keys{/key_id}","collaborators_url":"https://api.github.com/repos/projectatomic/atomic/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/projectatomic/atomic/teams","hooks_url":"https://api.github.com/repos/projectatomic/atomic/hooks","issue_events_url":"https://api.github.com/repos/projectatomic/atomic/issues/events{/number}","events_url":"https://api.github.com/repos/projectatomic/atomic/events","assignees_url":"https://api.github.com/repos/projectatomic/atomic/assignees{/user}","branches_url":"https://api.github.com/repos/projectatomic/atomic/branches{/branch}","tags_url":"https://api.github.com/repos/projectatomic/atomic/tags","blobs_url":"https://api.github.com/repos/projectatomic/atomic/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/projectatomic/atomic/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/projectatomic/atomic/git/refs{/sha}","trees_url":"https://api.github.com/repos/projectatomic/atomic/git/trees{/sha}","statuses_url":"https://api.github.com/repos/projectatomic/atomic/statuses/{sha}","languages_url":"https://api.github.com/repos/projectatomic/atomic/languages","stargazers_url":"https://api.github.com/repos/projectatomic/atomic/stargazers","contributors_url":"https://api.github.com/repos/projectatomic/atomic/contributors","subscribers_url":"https://api.github.com/repos/projectatomic/atomic/subscribers","subscription_url":"https://api.github.com/repos/projectatomic/atomic/subscription","commits_url":"https://api.github.com/repos/projectatomic/atomic/commits{/sha}","git_commits_url":"https://api.github.com/repos/projectatomic/atomic/git/commits{/sha}","comments_url":"https://api.github.com/repos/projectatomic/atomic/comments{/number}","issue_comment_url":"https://api.github.com/repos/projectatomic/atomic/issues/comments{/number}","contents_url":"https://api.github.com/repos/projectatomic/atomic/contents/{+path}","compare_url":"https://api.github.com/repos/projectatomic/atomic/compare/{base}...{head}","merges_url":"https://api.github.com/repos/projectatomic/atomic/merges","archive_url":"https://api.github.com/repos/projectatomic/atomic/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/projectatomic/atomic/downloads","issues_url":"https://api.github.com/repos/projectatomic/atomic/issues{/number}","pulls_url":"https://api.github.com/repos/projectatomic/atomic/pulls{/number}","milestones_url":"https://api.github.com/repos/projectatomic/atomic/milestones{/number}","notifications_url":"https://api.github.com/repos/projectatomic/atomic/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/projectatomic/atomic/labels{/name}","releases_url":"https://api.github.com/repos/projectatomic/atomic/releases{/id}","deployments_url":"https://api.github.com/repos/projectatomic/atomic/deployments","created_at":"2015-01-14T21:54:06Z","updated_at":"2016-05-13T03:05:52Z","pushed_at":"2016-05-16T18:10:38Z","git_url":"git://github.com/projectatomic/atomic.git","ssh_url":"git@github.com:projectatomic/atomic.git","clone_url":"https://github.com/projectatomic/atomic.git","svn_url":"https://github.com/projectatomic/atomic","homepage":null,"size":1647,"stargazers_count":169,"watchers_count":169,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":82,"mirror_url":null,"open_issues_count":25,"forks":82,"open_issues":25,"watchers":169,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/projectatomic/atomic/pulls/383"},"html":{"href":"https://github.com/projectatomic/atomic/pull/383"},"issue":{"href":"https://api.github.com/repos/projectatomic/atomic/issues/383"},"comments":{"href":"https://api.github.com/repos/projectatomic/atomic/issues/383/comments"},"review_comments":{"href":"https://api.github.com/repos/projectatomic/atomic/pulls/383/comments"},"review_comment":{"href":"https://api.github.com/repos/projectatomic/atomic/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/projectatomic/atomic/pulls/383/commits"},"statuses":{"href":"https://api.github.com/repos/projectatomic/atomic/statuses/06b7a26482441ccb4bfcd8284b0dbef0bd009e53"}}}}