New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes #14158 - Add support for tailoring files #225
Conversation
FactoryGirl.create(:openscap_proxy) | ||
ForemanOpenscap::TailoringFile.any_instance.stubs(:fetch_profiles).returns({ 'test_profile_key' => 'test_profile_title' }) | ||
end | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Final newline missing.
|
||
test 'index' do | ||
get :index, set_session_user | ||
binding.pry |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove debugger entry point binding.pry.
private | ||
|
||
def redigest | ||
self[:digest] = Digest::SHA256.hexdigest "#{scap_file}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer to_s over string interpolation.
end | ||
|
||
def digest | ||
self[:digest] ||= Digest::SHA256.hexdigest "#{scap_file}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer to_s over string interpolation.
|
||
def index | ||
@tailoring_files = resource_base.search_for(params[:search], :order => params[:order]) | ||
.paginate(:page => params[:page], :per_page => params[:per_page]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Place the . on the previous line, together with the method call receiver.
Align .paginate with .search_for on line 13.
end | ||
|
||
def index | ||
@tailoring_files = resource_base.search_for(params[:search], :order => params[:order]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use 2 (not 0) spaces for indentation.
@@ -13,7 +14,7 @@ def index | |||
@policies = resource_base | |||
.search_for(params[:search], :order => params[:order]) | |||
.paginate(:page => params[:page], :per_page => params[:per_page]) | |||
.includes(:scap_content, :scap_content_profile) | |||
.includes(:scap_content, :scap_content_profile, :tailoring_file) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Place the . on the previous line, together with the method call receiver.
Align .includes with resource_base on line 14.
trying to update name of tailoring file results in 500
|
One more issue found during testing, when I change tailoring file for a policy, the tailoring file is already cached on smart proxy at Except for this issue it works pretty well 👍 |
@xprazak2, this pull request is currently not mergeable. Please rebase against the master branch and push again. If you have a remote called 'upstream' that points to this repository, you can do this by running:
This message was auto-generated by Foreman's prprocessor |
.includes(:scap_content, :scap_content_profile) | ||
@policies = resource_base.search_for(params[:search], :order => params[:order]) | ||
.paginate(:page => params[:page], :per_page => params[:per_page]) | ||
.includes(:scap_content, :scap_content_profile, :tailoring_file) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Place the . on the previous line, together with the method call receiver.
.paginate(:page => params[:page], :per_page => params[:per_page]) | ||
.includes(:scap_content, :scap_content_profile) | ||
@policies = resource_base.search_for(params[:search], :order => params[:order]) | ||
.paginate(:page => params[:page], :per_page => params[:per_page]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Place the . on the previous line, together with the method call receiver.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
I added more tests, fixed style most of style issues, disabled a couple of obnoxious cops, fixed the 500. Not sure if we have the problems when changing scap contents for policy, I will have to verify. |
ProxyAPI::Openscap.any_instance.stubs(:fetch_policies_for_scap_content). | ||
returns({'xccdf_org.ssgproject.content_profile_common' => 'Common Profile for General-Purpose Fedora Systems'}) | ||
ProxyAPI::Openscap.any_instance.stubs(:fetch_profiles_for_tailoring_file). | ||
returns({'xccdf_org.ssgproject.test_profile_common' => 'Stubbed test profile'}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use 2 (not 19) spaces for indenting an expression spanning multiple lines.
ProxyAPI::Version.any_instance.stubs(:proxy_versions).returns(versions) | ||
ProxyAPI::Openscap.any_instance.stubs(:validate_scap_file).returns({'errors' => []}) | ||
ProxyAPI::Openscap.any_instance.stubs(:fetch_policies_for_scap_content). | ||
returns({'xccdf_org.ssgproject.content_profile_common' => 'Common Profile for General-Purpose Fedora Systems'}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use 2 (not 19) spaces for indenting an expression spanning multiple lines.
Changes:
|
7284d2d
to
5099c84
Compare
end | ||
end | ||
|
||
def edit; end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Put the end of empty method definitions on the next line.
|
||
api :GET, '/compliance/tailoring_files/:id', N_('Show a Tailoring file') | ||
param :id, :identifier, :required => true | ||
def show; end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Put the end of empty method definitions on the next line.
a8a8b15
to
1651821
Compare
|
||
def index | ||
@tailoring_files = resource_base.search_for(params[:search], :order => params[:order]). | ||
paginate(:page => params[:page], :per_page => params[:per_page]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Align paginate with resource_base.search_for(params[:search], :order => params[:order]). on line 13.
Adjusted column width on tailoring_files/index page. |
Cool, you even added Created column 👍 I think it's ready for merge now pending jenkins. Once we get smart proxy PR also confirmed by Jenkins I'll merge the whole train of PRs |
👍 @xprazak2 I think you have a good material for next community demo :-) |
TODO: