neetob 0.5.82 → 0.5.83

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of neetob might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1996f37f780eb41553d5920740bf180c0269c21b7f6582f78415712864e4e1bc
4
- data.tar.gz: 4284df33c8ae11ddb116f667cc0707abb25116fd6737c206929855a80f623378
3
+ metadata.gz: 580fe72d0904ef8524725b4f9e1bbc41e9347708e7559be5f843bcc848fb7a82
4
+ data.tar.gz: 0edab938a9ea750dd2dd8e57415d05983de862e0d778b0e708fcacb1d756cea7
5
5
  SHA512:
6
- metadata.gz: cdb5e2356151b20bd811d52813ab83a203db5ca512921415aefcf7161140fda6bf22e263b7c598ac4098997023e1cdfe534eafeea2f4342f1ff010661462304d
7
- data.tar.gz: 51252dc49b3580e1e1d682d4edc35a55789fa9162fb8533aad705be5e21de844ce82bf1c14e8742e18dd36601231023ee9445503ddc880a81c0f33420c9c575b
6
+ metadata.gz: d849c140be635bef936f785010a5077cecb1e407eeaa3ed065247a5d15c73cbc7b30d8c576ec0826e4ba0d6dd93f8d33e9689af9a1cf553f09ab7e62d4b27e2a
7
+ data.tar.gz: a07fd1d571e3b671821eaac254406aa56281857ca63b817c1343e1b00505f4c423f39dc1626297d362b14bcffcc99d31c776c416503eae1b33ece975a99dda2a
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- neetob (0.5.82)
4
+ neetob (0.5.83)
5
5
  actionview
6
6
  activesupport
7
7
  brakeman (~> 5.0)
@@ -10,7 +10,7 @@ class GithubIssueCreation < Neetob::CLI::Github::Base
10
10
  @helpers = Neetob::CLI::Github::Issues::Helpers.new
11
11
  end
12
12
 
13
- def create_issue(repo:, title:, description:, labels: "")
13
+ def create_issue(repo:, title:, description:, labels: "", assignee: nil)
14
14
  return if Thread.current[:skip_issue]
15
15
  return if repo.include?("bigbinary-website")
16
16
 
@@ -24,7 +24,7 @@ class GithubIssueCreation < Neetob::CLI::Github::Base
24
24
  # Close any existing issues of the same type
25
25
  close_existing_issues_of_same_type(repo_path, title)
26
26
 
27
- create_new_issue(repo_path, full_title, description, labels)
27
+ create_new_issue(repo_path, full_title, description, labels, assignee)
28
28
  end
29
29
 
30
30
  private
@@ -48,10 +48,10 @@ class GithubIssueCreation < Neetob::CLI::Github::Base
48
48
  end
49
49
  end
50
50
 
51
- def create_new_issue(repo_path, full_title, description, labels)
51
+ def create_new_issue(repo_path, full_title, description, labels, assignee_override = nil)
52
52
  issue_body = build_issue_body(full_title, description)
53
53
  repo_name = repo_path.split("/").last
54
- assignee = Neetob::CLI::Github::Repositories::TeamLeads.team_lead_for(repo_name)
54
+ assignee = assignee_override.presence || Neetob::CLI::Github::Repositories::TeamLeads.team_lead_for(repo_name)
55
55
 
56
56
  issue_options = { labels: }
57
57
  issue_options[:assignee] = assignee if assignee && assignee != "NO TL FOUND"
@@ -4,6 +4,7 @@ require_relative "neeto_deploy_or_heroku/main"
4
4
  require_relative "cloudflare/main"
5
5
  require_relative "cronitor/main"
6
6
  require_relative "honeybadger/main"
7
+ require_relative "neeto_status/main"
7
8
 
8
9
  module Neetob
9
10
  class CLI
@@ -32,6 +33,10 @@ module Neetob
32
33
  ui.success("## 3.3. Checking Honeybadger related configurations")
33
34
  ui.info "\n"
34
35
  Honeybadger::Main.new.run
36
+ ui.info "\n"
37
+ ui.success("## 3.4. Checking NeetoStatus")
38
+ ui.info "\n"
39
+ NeetoStatus::Main.new.run
35
40
  end
36
41
  end
37
42
  end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Neetob
4
+ class CLI
5
+ module MonthlyAudit
6
+ module InstancesAndAddons
7
+ module NeetoStatus
8
+ module Constants
9
+ ISSUE_REPO = "neeto-engineering-web"
10
+ ISSUE_ASSIGNEE = "VarunSriram99"
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "up_and_has_neetocal_text"
4
+
5
+ module Neetob
6
+ class CLI
7
+ module MonthlyAudit
8
+ module InstancesAndAddons
9
+ module NeetoStatus
10
+ class Main < CLI::Base
11
+ def initialize
12
+ super()
13
+ end
14
+
15
+ def run
16
+ UpAndHasNeetocalText.new.run
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,98 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "net/http"
4
+ require "uri"
5
+ require_relative "../../github_issue_creation"
6
+ require_relative "constants"
7
+
8
+ module Neetob
9
+ class CLI
10
+ module MonthlyAudit
11
+ module InstancesAndAddons
12
+ module NeetoStatus
13
+ class UpAndHasNeetocalText < CLI::Base
14
+ NEETOSTATUS_URLS = [
15
+ "https://www.neetostatus.com",
16
+ "https://neetostatus.com"
17
+ ].freeze
18
+
19
+ REQUIRED_TEXT = "NeetoCal"
20
+
21
+ def initialize
22
+ super()
23
+ end
24
+
25
+ def run
26
+ ui.success "### 3.4.1. Checking whether NeetoStatus is up and shows #{REQUIRED_TEXT}"
27
+
28
+ table_data = [["URL", "Status", "Audit Passed"]]
29
+ failures = []
30
+ ui.info("\n", print_to_audit_log: false)
31
+
32
+ NEETOSTATUS_URLS.each do |url|
33
+ ui.info("Checking NeetoStatus for #{url}", print_to_audit_log: false)
34
+ status, audit_passed = check_url(url)
35
+ failures << { url:, status: } if audit_passed == "No"
36
+ table_data << [url, status, audit_passed]
37
+ end
38
+
39
+ if failures.any?
40
+ issue_url = create_failure_issue(failures)
41
+ table_data.each_with_index do |row, idx|
42
+ next if idx == 0
43
+
44
+ table_data[idx][2] = "#{row[2]} #{issue_url}" if row[2] == "No" && issue_url
45
+ end
46
+ end
47
+
48
+ ui.print_table(table_data)
49
+ end
50
+
51
+ private
52
+
53
+ def check_url(url)
54
+ response = fetch_with_redirect(url)
55
+ if response.is_a?(Net::HTTPSuccess)
56
+ if response.body.include?(REQUIRED_TEXT)
57
+ ["OK", "Yes"]
58
+ else
59
+ ["Missing #{REQUIRED_TEXT}", "No"]
60
+ end
61
+ else
62
+ status = response.is_a?(Net::HTTPResponse) ? "HTTP #{response.code}" : "Not up"
63
+ [status, "No"]
64
+ end
65
+ rescue StandardError => e
66
+ ["Error: #{e.message}", "No"]
67
+ end
68
+
69
+ def fetch_with_redirect(url_str, limit = 2)
70
+ raise ArgumentError, "redirect limit exceeded" if limit <= 0
71
+
72
+ uri = URI.parse(url_str)
73
+ response = Net::HTTP.get_response(uri)
74
+ if response.is_a?(Net::HTTPRedirection) && response["location"]
75
+ location = response["location"]
76
+ location = URI.join(uri, location).to_s
77
+ return fetch_with_redirect(location, limit - 1)
78
+ end
79
+ response
80
+ end
81
+
82
+ def create_failure_issue(failures)
83
+ description = failures.map do |f|
84
+ "#{f[:url]}: #{f[:status]}"
85
+ end.join("\n\n")
86
+ GithubIssueCreation.new.create_issue(
87
+ repo: Constants::ISSUE_REPO,
88
+ title: "NeetoStatus is down or does not show #{REQUIRED_TEXT}",
89
+ description:,
90
+ assignee: Constants::ISSUE_ASSIGNEE
91
+ )
92
+ end
93
+ end
94
+ end
95
+ end
96
+ end
97
+ end
98
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Neetob
4
- VERSION = "0.5.82"
4
+ VERSION = "0.5.83"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: neetob
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.82
4
+ version: 0.5.83
5
5
  platform: ruby
6
6
  authors:
7
7
  - Udai Gupta
@@ -312,6 +312,9 @@ files:
312
312
  - lib/neetob/cli/monthly_audit/instances_and_addons/neeto_deploy_or_heroku/main.rb
313
313
  - lib/neetob/cli/monthly_audit/instances_and_addons/neeto_deploy_or_heroku/scheduled_exports_enabled.rb
314
314
  - lib/neetob/cli/monthly_audit/instances_and_addons/neeto_deploy_or_heroku/ssl_certificates_over_thirty_days_from_expiry.rb
315
+ - lib/neetob/cli/monthly_audit/instances_and_addons/neeto_status/constants.rb
316
+ - lib/neetob/cli/monthly_audit/instances_and_addons/neeto_status/main.rb
317
+ - lib/neetob/cli/monthly_audit/instances_and_addons/neeto_status/up_and_has_neetocal_text.rb
315
318
  - lib/neetob/cli/monthly_audit/misc/main.rb
316
319
  - lib/neetob/cli/monthly_audit/misc/redirections_working_correctly.rb
317
320
  - lib/neetob/cli/monthly_audit/misc/sparkpost_sub_account_used_for_all_apps.rb