Skip to content
This repository has been archived by the owner on Mar 26, 2024. It is now read-only.

Commit

Permalink
Merge pull request #354 from ZeroPointEnergy/new_report_format_support
Browse files Browse the repository at this point in the history
New report format support
  • Loading branch information
bwitt authored Aug 25, 2018
2 parents 314bdb9 + df73f06 commit 290b670
Show file tree
Hide file tree
Showing 25 changed files with 3,057 additions and 299 deletions.
16 changes: 10 additions & 6 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ nodes, and view inventory data and backed-up file contents.
Dependencies
------------

* Ruby 1.8.7, 1.9.3, 2.0.0 or 2.1.x
* Bundler >= 1.1
* Ruby 2.2, 2.3, 2.4, 2.5
* MySQL >= 5.1 or PostgreSQL >= 9.0

Fast Install
Expand Down Expand Up @@ -41,11 +40,16 @@ cp config/settings.yml.example config/settings.yml && \
cp config/database.yml.example config/database.yml && \
vim config/database.yml
````
* Install Puppet Dashboard
* Install Puppet Dashboard Dependencies
````
gem install bundler && \
bundle install --deployment && \
echo "secret_token: '$(bundle exec rake secret)'" >> config/settings.yml && \
bundle install --deployment
````
* You need to create a secret for production and either set it via environment variable:
`export SECRET_KEY_BASE=$(bundle exec rails secret)`
or follow the instructions in config/secrets.yml to setup an encrypted secret.
* Setup database and pre-compile assets
````
RAILS_ENV=production bundle exec rake db:setup && \
RAILS_ENV=production bundle exec rake assets:precompile
````
Expand All @@ -64,7 +68,7 @@ Dashboard is currently configured to serve static assets when `RAILS_ENV=product
environments, you may wish to farm this out to Apache or nginx. Additionally, you must explicitly
precompile assets for production using:

* `RAILS_ENV=production bundle exec rake assets:precompile`
* `SECRET_KEY_BASE=none RAILS_ENV=production bundle exec rails assets:precompile`

Contributing
------------
Expand Down
7 changes: 0 additions & 7 deletions app/models/report.rb
Original file line number Diff line number Diff line change
Expand Up @@ -186,18 +186,11 @@ def munge
add_status_to_resource_status
add_missing_metrics
recalculate_report_status
fix_kind_for_puppet5
self
end

private

# Report format 7 from Puppet 5 is missing "kind" leading to
# "Validation failed: Kind can't be blank"
def fix_kind_for_puppet5
self.kind = 'apply' if self.kind.blank?
end

# Report format 2 knows nothing about pending status
def recalculate_report_status
self.status = 'pending' if resource_statuses.any? {|rs| rs.status == 'pending' } &&
Expand Down
1 change: 1 addition & 0 deletions app/models/resource_status.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ class ResourceStatus < ApplicationRecord
accepts_nested_attributes_for :events

serialize :tags, Array
serialize :containment_path, Array

scope :inspections, -> { joins(:report).where("reports.kind = 'inspect'") }

Expand Down
2 changes: 1 addition & 1 deletion config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@

# Use the lowest log level to ensure availability of diagnostic information
# when problems arise.
config.log_level = :debug
config.log_level = :warn

# Prepend all log lines with the following tags.
config.log_tags = [ :request_id ]
Expand Down
5 changes: 5 additions & 0 deletions db/migrate/20150405234511_add_environment_to_reports.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddEnvironmentToReports < ActiveRecord::Migration[4.2]
def change
add_column :reports, :environment, :string
end
end
5 changes: 5 additions & 0 deletions db/migrate/20150406035502_add_transaction_uuid_to_reports.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddTransactionUuidToReports < ActiveRecord::Migration[4.2]
def change
add_column :reports, :transaction_uuid, :string
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddContainmentPathToResourceStatuses < ActiveRecord::Migration[4.2]
def change
add_column :resource_statuses, :containment_path, :text
end
end
5 changes: 5 additions & 0 deletions db/migrate/20180612210108_add_catalog_uuid_to_reports.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddCatalogUuidToReports < ActiveRecord::Migration[5.2]
def change
add_column :reports, :catalog_uuid, :string
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddCachedCatalogStatusToReports < ActiveRecord::Migration[5.2]
def change
add_column :reports, :cached_catalog_status, :string
end
end
13 changes: 13 additions & 0 deletions db/migrate/20180613224704_add_report_format6.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
class AddReportFormat6 < ActiveRecord::Migration[5.2]
def change
add_column :reports, :noop, :boolean
add_column :reports, :noop_pending, :boolean
add_column :reports, :corrective_change, :boolean
add_column :reports, :master_used, :string

add_column :resource_statuses, :corrective_change, :boolean

add_column :resource_events, :corrective_change, :boolean
add_column :resource_events, :redacted, :boolean
end
end
5 changes: 5 additions & 0 deletions db/migrate/20180614161626_add_report_format8.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddReportFormat8 < ActiveRecord::Migration[5.2]
def change
add_column :reports, :transaction_completed, :boolean
end
end
5 changes: 5 additions & 0 deletions db/migrate/20180614210435_add_report_format9.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddReportFormat9 < ActiveRecord::Migration[5.2]
def change
add_column :resource_statuses, :provider_used, :string
end
end
Loading

0 comments on commit 290b670

Please sign in to comment.