{"action":"created","comment":{"url":"https://api.github.com/repos/npwalker/pe_metric_curl_cron_jobs/pulls/comments/121794575","pull_request_review_id":43852386,"id":121794575,"diff_hunk":"@@ -7,44 +7,71 @@ require 'time'\n require 'optparse'\n require 'yaml'\n \n-options = {}\n+#===========================================================================#\n+# BUILD CONFIGURATION OPTIONS                                               #\n+#===========================================================================#\n+\n+# Define the list of mandatory options that must be specified on the CLI\n+REQUIRED_FLAGS = {\n+  :\"metrics-type\" => { type: :string },\n+}\n+\n+# Define the list of options that will be read from the config file, and which\n+# may optionally be specified on the CLI.\n+SETTINGS = {\n+  :\"output-dir\"   => { type: :string, default: false }, # false = disabled\n+  :hosts          => { type: :list },\n+  :metrics        => { type: :list },\n+  :\"metrics-port\" => { type: :string },\n+  :clientcert     => { type: :string },\n+  :\"pe-version\"   => { type: :string },\n+  :print          => { type: :boolean, default: true },\n+  :ssl            => { type: :boolean, default: true },\n+}\n+\n+config = { }\n+\n OptionParser.new do |opts|\n   opts.banner = \"Usage: tk_metrics [options]\"\n \n-  opts.on('-p', '--[no-]print', 'Print to stdout') { |p| options[:print] = p }\n-  opts.on('-m [TYPE]', '--metrics_type [TYPE]', 'Type of metric to collect') { |v| options[:metrics_type] = v }\n-  opts.on('-o [DIR]', '--output-dir [DIR]', 'Directory to save output to') { |o| options[:output_dir] = o }\n-  opts.on('--metrics_port [PORT]', 'The port the metrics service runs on') { |port| options[:metrics_port] = port }\n-  opts.on('--[no-]ssl', 'Whether or not to use SSL when gather metrics') { |ssl| options[:ssl] = ssl }\n+  # Gather options\n+  REQUIRED_FLAGS.merge(SETTINGS).each do |opt,attrs|\n+    case attrs[:type]\n+    when :string, nil\n+      opts.on(\"--#{opt} ARG\", '(no description)')  { |arg| config[opt] = arg }","path":"files/tk_metrics","position":41,"original_position":41,"commit_id":"e14ff0bfc6893820bd75a4f1afe23725568b4762","original_commit_id":"e14ff0bfc6893820bd75a4f1afe23725568b4762","user":{"login":"npwalker","id":513998,"avatar_url":"https://avatars2.githubusercontent.com/u/513998?v=3","gravatar_id":"","url":"https://api.github.com/users/npwalker","html_url":"https://github.com/npwalker","followers_url":"https://api.github.com/users/npwalker/followers","following_url":"https://api.github.com/users/npwalker/following{/other_user}","gists_url":"https://api.github.com/users/npwalker/gists{/gist_id}","starred_url":"https://api.github.com/users/npwalker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/npwalker/subscriptions","organizations_url":"https://api.github.com/users/npwalker/orgs","repos_url":"https://api.github.com/users/npwalker/repos","events_url":"https://api.github.com/users/npwalker/events{/privacy}","received_events_url":"https://api.github.com/users/npwalker/received_events","type":"User","site_admin":false},"body":"Are descriptions not useful in the --help output?  ","created_at":"2017-06-13T20:56:10Z","updated_at":"2017-06-13T20:56:10Z","html_url":"https://github.com/npwalker/pe_metric_curl_cron_jobs/pull/38#discussion_r121794575","pull_request_url":"https://api.github.com/repos/npwalker/pe_metric_curl_cron_jobs/pulls/38","_links":{"self":{"href":"https://api.github.com/repos/npwalker/pe_metric_curl_cron_jobs/pulls/comments/121794575"},"html":{"href":"https://github.com/npwalker/pe_metric_curl_cron_jobs/pull/38#discussion_r121794575"},"pull_request":{"href":"https://api.github.com/repos/npwalker/pe_metric_curl_cron_jobs/pulls/38"}}},"pull_request":{"url":"https://api.github.com/repos/npwalker/pe_metric_curl_cron_jobs/pulls/38","id":125428004,"html_url":"https://github.com/npwalker/pe_metric_curl_cron_jobs/pull/38","diff_url":"https://github.com/npwalker/pe_metric_curl_cron_jobs/pull/38.diff","patch_url":"https://github.com/npwalker/pe_metric_curl_cron_jobs/pull/38.patch","issue_url":"https://api.github.com/repos/npwalker/pe_metric_curl_cron_jobs/issues/38","number":38,"state":"open","locked":false,"title":"Unify config","user":{"login":"reidmv","id":100142,"avatar_url":"https://avatars0.githubusercontent.com/u/100142?v=3","gravatar_id":"","url":"https://api.github.com/users/reidmv","html_url":"https://github.com/reidmv","followers_url":"https://api.github.com/users/reidmv/followers","following_url":"https://api.github.com/users/reidmv/following{/other_user}","gists_url":"https://api.github.com/users/reidmv/gists{/gist_id}","starred_url":"https://api.github.com/users/reidmv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reidmv/subscriptions","organizations_url":"https://api.github.com/users/reidmv/orgs","repos_url":"https://api.github.com/users/reidmv/repos","events_url":"https://api.github.com/users/reidmv/events{/privacy}","received_events_url":"https://api.github.com/users/reidmv/received_events","type":"User","site_admin":false},"body":"Builds on #37.\r\n\r\nThis is effectively a cleanup of the way config options work. Any config option can now be read from a file, OR passed on the CLI. Valid config options must be specified as part of the SETTINGS array.","created_at":"2017-06-13T18:14:33Z","updated_at":"2017-06-13T20:56:10Z","closed_at":null,"merged_at":null,"merge_commit_sha":"bf2607b77fc44692d17f39d694e3ffe9dc8e37be","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/npwalker/pe_metric_curl_cron_jobs/pulls/38/commits","review_comments_url":"https://api.github.com/repos/npwalker/pe_metric_curl_cron_jobs/pulls/38/comments","review_comment_url":"https://api.github.com/repos/npwalker/pe_metric_curl_cron_jobs/pulls/comments{/number}","comments_url":"https://api.github.com/repos/npwalker/pe_metric_curl_cron_jobs/issues/38/comments","statuses_url":"https://api.github.com/repos/npwalker/pe_metric_curl_cron_jobs/statuses/e14ff0bfc6893820bd75a4f1afe23725568b4762","head":{"label":"reidmv:unify_config","ref":"unify_config","sha":"e14ff0bfc6893820bd75a4f1afe23725568b4762","user":{"login":"reidmv","id":100142,"avatar_url":"https://avatars0.githubusercontent.com/u/100142?v=3","gravatar_id":"","url":"https://api.github.com/users/reidmv","html_url":"https://github.com/reidmv","followers_url":"https://api.github.com/users/reidmv/followers","following_url":"https://api.github.com/users/reidmv/following{/other_user}","gists_url":"https://api.github.com/users/reidmv/gists{/gist_id}","starred_url":"https://api.github.com/users/reidmv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reidmv/subscriptions","organizations_url":"https://api.github.com/users/reidmv/orgs","repos_url":"https://api.github.com/users/reidmv/repos","events_url":"https://api.github.com/users/reidmv/events{/privacy}","received_events_url":"https://api.github.com/users/reidmv/received_events","type":"User","site_admin":false},"repo":{"id":79605832,"name":"pe_metric_curl_cron_jobs","full_name":"reidmv/pe_metric_curl_cron_jobs","owner":{"login":"reidmv","id":100142,"avatar_url":"https://avatars0.githubusercontent.com/u/100142?v=3","gravatar_id":"","url":"https://api.github.com/users/reidmv","html_url":"https://github.com/reidmv","followers_url":"https://api.github.com/users/reidmv/followers","following_url":"https://api.github.com/users/reidmv/following{/other_user}","gists_url":"https://api.github.com/users/reidmv/gists{/gist_id}","starred_url":"https://api.github.com/users/reidmv/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reidmv/subscriptions","organizations_url":"https://api.github.com/users/reidmv/orgs","repos_url":"https://api.github.com/users/reidmv/repos","events_url":"https://api.github.com/users/reidmv/events{/privacy}","received_events_url":"https://api.github.com/users/reidmv/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/reidmv/pe_metric_curl_cron_jobs","description":"A Module for setting up cron jobs to curl metrics from Puppet Enterprise components","fork":true,"url":"https://api.github.com/repos/reidmv/pe_metric_curl_cron_jobs","forks_url":"https://api.github.com/repos/reidmv/pe_metric_curl_cron_jobs/forks","keys_url":"https://api.github.com/repos/reidmv/pe_metric_curl_cron_jobs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/reidmv/pe_metric_curl_cron_jobs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/reidmv/pe_metric_curl_cron_jobs/teams","hooks_url":"https://api.github.com/repos/reidmv/pe_metric_curl_cron_jobs/hooks","issue_events_url":"https://api.github.com/repos/reidmv/pe_metric_curl_cron_jobs/issues/events{/number}","events_url":"https://api.github.com/repos/reidmv/pe_metric_curl_cron_jobs/events","assignees_url":"https://api.github.com/repos/reidmv/pe_metric_curl_cron_jobs/assignees{/user}","branches_url":"https://api.github.com/repos/reidmv/pe_metric_curl_cron_jobs/branches{/branch}","tags_url":"https://api.github.com/repos/reidmv/pe_metric_curl_cron_jobs/tags","blobs_url":"https://api.github.com/repos/reidmv/pe_metric_curl_cron_jobs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/reidmv/pe_metric_curl_cron_jobs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/reidmv/pe_metric_curl_cron_jobs/git/refs{/sha}","trees_url":"https://api.github.com/repos/reidmv/pe_metric_curl_cron_jobs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/reidmv/pe_metric_curl_cron_jobs/statuses/{sha}","languages_url":"https://api.github.com/repos/reidmv/pe_metric_curl_cron_jobs/languages","stargazers_url":"https://api.github.com/repos/reidmv/pe_metric_curl_cron_jobs/stargazers","contributors_url":"https://api.github.com/repos/reidmv/pe_metric_curl_cron_jobs/contributors","subscribers_url":"https://api.github.com/repos/reidmv/pe_metric_curl_cron_jobs/subscribers","subscription_url":"https://api.github.com/repos/reidmv/pe_metric_curl_cron_jobs/subscription","commits_url":"https://api.github.com/repos/reidmv/pe_metric_curl_cron_jobs/commits{/sha}","git_commits_url":"https://api.github.com/repos/reidmv/pe_metric_curl_cron_jobs/git/commits{/sha}","comments_url":"https://api.github.com/repos/reidmv/pe_metric_curl_cron_jobs/comments{/number}","issue_comment_url":"https://api.github.com/repos/reidmv/pe_metric_curl_cron_jobs/issues/comments{/number}","contents_url":"https://api.github.com/repos/reidmv/pe_metric_curl_cron_jobs/contents/{+path}","compare_url":"https://api.github.com/repos/reidmv/pe_metric_curl_cron_jobs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/reidmv/pe_metric_curl_cron_jobs/merges","archive_url":"https://api.github.com/repos/reidmv/pe_metric_curl_cron_jobs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/reidmv/pe_metric_curl_cron_jobs/downloads","issues_url":"https://api.github.com/repos/reidmv/pe_metric_curl_cron_jobs/issues{/number}","pulls_url":"https://api.github.com/repos/reidmv/pe_metric_curl_cron_jobs/pulls{/number}","milestones_url":"https://api.github.com/repos/reidmv/pe_metric_curl_cron_jobs/milestones{/number}","notifications_url":"https://api.github.com/repos/reidmv/pe_metric_curl_cron_jobs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/reidmv/pe_metric_curl_cron_jobs/labels{/name}","releases_url":"https://api.github.com/repos/reidmv/pe_metric_curl_cron_jobs/releases{/id}","deployments_url":"https://api.github.com/repos/reidmv/pe_metric_curl_cron_jobs/deployments","created_at":"2017-01-20T22:24:30Z","updated_at":"2017-01-20T22:24:33Z","pushed_at":"2017-06-13T20:51:24Z","git_url":"git://github.com/reidmv/pe_metric_curl_cron_jobs.git","ssh_url":"git@github.com:reidmv/pe_metric_curl_cron_jobs.git","clone_url":"https://github.com/reidmv/pe_metric_curl_cron_jobs.git","svn_url":"https://github.com/reidmv/pe_metric_curl_cron_jobs","homepage":"","size":111,"stargazers_count":0,"watchers_count":0,"language":"Puppet","has_issues":false,"has_projects":true,"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":"npwalker:master","ref":"master","sha":"0bd5d17eec64ec4c00b76d97212c7fd2b8edfbdd","user":{"login":"npwalker","id":513998,"avatar_url":"https://avatars2.githubusercontent.com/u/513998?v=3","gravatar_id":"","url":"https://api.github.com/users/npwalker","html_url":"https://github.com/npwalker","followers_url":"https://api.github.com/users/npwalker/followers","following_url":"https://api.github.com/users/npwalker/following{/other_user}","gists_url":"https://api.github.com/users/npwalker/gists{/gist_id}","starred_url":"https://api.github.com/users/npwalker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/npwalker/subscriptions","organizations_url":"https://api.github.com/users/npwalker/orgs","repos_url":"https://api.github.com/users/npwalker/repos","events_url":"https://api.github.com/users/npwalker/events{/privacy}","received_events_url":"https://api.github.com/users/npwalker/received_events","type":"User","site_admin":false},"repo":{"id":64967505,"name":"pe_metric_curl_cron_jobs","full_name":"npwalker/pe_metric_curl_cron_jobs","owner":{"login":"npwalker","id":513998,"avatar_url":"https://avatars2.githubusercontent.com/u/513998?v=3","gravatar_id":"","url":"https://api.github.com/users/npwalker","html_url":"https://github.com/npwalker","followers_url":"https://api.github.com/users/npwalker/followers","following_url":"https://api.github.com/users/npwalker/following{/other_user}","gists_url":"https://api.github.com/users/npwalker/gists{/gist_id}","starred_url":"https://api.github.com/users/npwalker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/npwalker/subscriptions","organizations_url":"https://api.github.com/users/npwalker/orgs","repos_url":"https://api.github.com/users/npwalker/repos","events_url":"https://api.github.com/users/npwalker/events{/privacy}","received_events_url":"https://api.github.com/users/npwalker/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/npwalker/pe_metric_curl_cron_jobs","description":"A Puppet module for gathering metrics from Puppet Enterprise components","fork":false,"url":"https://api.github.com/repos/npwalker/pe_metric_curl_cron_jobs","forks_url":"https://api.github.com/repos/npwalker/pe_metric_curl_cron_jobs/forks","keys_url":"https://api.github.com/repos/npwalker/pe_metric_curl_cron_jobs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/npwalker/pe_metric_curl_cron_jobs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/npwalker/pe_metric_curl_cron_jobs/teams","hooks_url":"https://api.github.com/repos/npwalker/pe_metric_curl_cron_jobs/hooks","issue_events_url":"https://api.github.com/repos/npwalker/pe_metric_curl_cron_jobs/issues/events{/number}","events_url":"https://api.github.com/repos/npwalker/pe_metric_curl_cron_jobs/events","assignees_url":"https://api.github.com/repos/npwalker/pe_metric_curl_cron_jobs/assignees{/user}","branches_url":"https://api.github.com/repos/npwalker/pe_metric_curl_cron_jobs/branches{/branch}","tags_url":"https://api.github.com/repos/npwalker/pe_metric_curl_cron_jobs/tags","blobs_url":"https://api.github.com/repos/npwalker/pe_metric_curl_cron_jobs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/npwalker/pe_metric_curl_cron_jobs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/npwalker/pe_metric_curl_cron_jobs/git/refs{/sha}","trees_url":"https://api.github.com/repos/npwalker/pe_metric_curl_cron_jobs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/npwalker/pe_metric_curl_cron_jobs/statuses/{sha}","languages_url":"https://api.github.com/repos/npwalker/pe_metric_curl_cron_jobs/languages","stargazers_url":"https://api.github.com/repos/npwalker/pe_metric_curl_cron_jobs/stargazers","contributors_url":"https://api.github.com/repos/npwalker/pe_metric_curl_cron_jobs/contributors","subscribers_url":"https://api.github.com/repos/npwalker/pe_metric_curl_cron_jobs/subscribers","subscription_url":"https://api.github.com/repos/npwalker/pe_metric_curl_cron_jobs/subscription","commits_url":"https://api.github.com/repos/npwalker/pe_metric_curl_cron_jobs/commits{/sha}","git_commits_url":"https://api.github.com/repos/npwalker/pe_metric_curl_cron_jobs/git/commits{/sha}","comments_url":"https://api.github.com/repos/npwalker/pe_metric_curl_cron_jobs/comments{/number}","issue_comment_url":"https://api.github.com/repos/npwalker/pe_metric_curl_cron_jobs/issues/comments{/number}","contents_url":"https://api.github.com/repos/npwalker/pe_metric_curl_cron_jobs/contents/{+path}","compare_url":"https://api.github.com/repos/npwalker/pe_metric_curl_cron_jobs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/npwalker/pe_metric_curl_cron_jobs/merges","archive_url":"https://api.github.com/repos/npwalker/pe_metric_curl_cron_jobs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/npwalker/pe_metric_curl_cron_jobs/downloads","issues_url":"https://api.github.com/repos/npwalker/pe_metric_curl_cron_jobs/issues{/number}","pulls_url":"https://api.github.com/repos/npwalker/pe_metric_curl_cron_jobs/pulls{/number}","milestones_url":"https://api.github.com/repos/npwalker/pe_metric_curl_cron_jobs/milestones{/number}","notifications_url":"https://api.github.com/repos/npwalker/pe_metric_curl_cron_jobs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/npwalker/pe_metric_curl_cron_jobs/labels{/name}","releases_url":"https://api.github.com/repos/npwalker/pe_metric_curl_cron_jobs/releases{/id}","deployments_url":"https://api.github.com/repos/npwalker/pe_metric_curl_cron_jobs/deployments","created_at":"2016-08-04T21:08:20Z","updated_at":"2017-04-17T00:56:10Z","pushed_at":"2017-06-13T20:51:26Z","git_url":"git://github.com/npwalker/pe_metric_curl_cron_jobs.git","ssh_url":"git@github.com:npwalker/pe_metric_curl_cron_jobs.git","clone_url":"https://github.com/npwalker/pe_metric_curl_cron_jobs.git","svn_url":"https://github.com/npwalker/pe_metric_curl_cron_jobs","homepage":"","size":116,"stargazers_count":5,"watchers_count":5,"language":"Puppet","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":6,"mirror_url":null,"open_issues_count":4,"forks":6,"open_issues":4,"watchers":5,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/npwalker/pe_metric_curl_cron_jobs/pulls/38"},"html":{"href":"https://github.com/npwalker/pe_metric_curl_cron_jobs/pull/38"},"issue":{"href":"https://api.github.com/repos/npwalker/pe_metric_curl_cron_jobs/issues/38"},"comments":{"href":"https://api.github.com/repos/npwalker/pe_metric_curl_cron_jobs/issues/38/comments"},"review_comments":{"href":"https://api.github.com/repos/npwalker/pe_metric_curl_cron_jobs/pulls/38/comments"},"review_comment":{"href":"https://api.github.com/repos/npwalker/pe_metric_curl_cron_jobs/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/npwalker/pe_metric_curl_cron_jobs/pulls/38/commits"},"statuses":{"href":"https://api.github.com/repos/npwalker/pe_metric_curl_cron_jobs/statuses/e14ff0bfc6893820bd75a4f1afe23725568b4762"}}}}
{"actor":{"display_login":"npwalker"}}