Skip to content
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

Switch to tofs and full test suites #2

Merged
merged 17 commits into from
Apr 24, 2019
Merged

Switch to tofs and full test suites #2

merged 17 commits into from
Apr 24, 2019

Conversation

n-rodriguez
Copy link
Member

No description provided.

@myii
Copy link
Member

myii commented Apr 23, 2019

@n-rodriguez We're just in the process of moving to pre-salted images for testing: saltstack-formulas/template-formula#92. When this is finalised, this would be the recommended solution. Better performance and reliability.

@myii
Copy link
Member

myii commented Apr 23, 2019

@n-rodriguez Two patches for you to consider, which apply one after the other.

Use context instead of map.jinja in file.managed templates

These templates don't have access to tpldir, so when they invoke the new map.jinja, it doesn't work. The solution here is to supply the context as part of the file.managed states:

diff --git a/rkhunter/config/file.sls b/rkhunter/config/file.sls
index 7b60172..749c2f1 100644
--- a/rkhunter/config/file.sls
+++ b/rkhunter/config/file.sls
@@ -20,6 +20,8 @@ rkhunter-default-file-file-managed:
                               lookup='rkhunter-default-file-file-managed'
                  )
               }}
+    - context:
+        rkhunter: {{ rkhunter|json }}
     - require:
       - sls: {{ sls_package_install }}
 
@@ -33,5 +35,7 @@ rkhunter-config-file-file-managed:
                               lookup='rkhunter-config-file-file-managed'
                  )
               }}
+    - context:
+        rkhunter: {{ rkhunter|json }}
     - require:
       - sls: {{ sls_package_install }}
diff --git a/rkhunter/files/default/rkhunter.conf.tmpl.jinja b/rkhunter/files/default/rkhunter.conf.tmpl.jinja
index c56f483..c01abca 100644
--- a/rkhunter/files/default/rkhunter.conf.tmpl.jinja
+++ b/rkhunter/files/default/rkhunter.conf.tmpl.jinja
@@ -4,5 +4,4 @@
 ########################################################################
 
 {%- from "rkhunter/macro.jinja" import print_config -%}
-{%- from "rkhunter/map.jinja" import rkhunter with context -%}
 {{ print_config(rkhunter.config) }}
diff --git a/rkhunter/files/default/rkhunter.default.tmpl.jinja b/rkhunter/files/default/rkhunter.default.tmpl.jinja
index a39055a..ed6b5dd 100644
--- a/rkhunter/files/default/rkhunter.default.tmpl.jinja
+++ b/rkhunter/files/default/rkhunter.default.tmpl.jinja
@@ -4,5 +4,4 @@
 ########################################################################
 
 {%- from "rkhunter/macro.jinja" import print_config -%}
-{%- from "rkhunter/map.jinja" import rkhunter with context -%}
 {{ print_config(rkhunter.default) }}

Improve use of context by not passing the whole of the dict

Rather than sending through the whole of the rkhunter dict, only pass the part that's required:

diff --git a/rkhunter/config/file.sls b/rkhunter/config/file.sls
index 749c2f1..ae2e473 100644
--- a/rkhunter/config/file.sls
+++ b/rkhunter/config/file.sls
@@ -21,7 +21,7 @@ rkhunter-default-file-file-managed:
                  )
               }}
     - context:
-        rkhunter: {{ rkhunter|json }}
+        default: {{ rkhunter.default|json }}
     - require:
       - sls: {{ sls_package_install }}
 
@@ -36,6 +36,6 @@ rkhunter-config-file-file-managed:
                  )
               }}
     - context:
-        rkhunter: {{ rkhunter|json }}
+        config: {{ rkhunter.config|json }}
     - require:
       - sls: {{ sls_package_install }}
diff --git a/rkhunter/files/default/rkhunter.conf.tmpl.jinja b/rkhunter/files/default/rkhunter.conf.tmpl.jinja
index c01abca..fb83b46 100644
--- a/rkhunter/files/default/rkhunter.conf.tmpl.jinja
+++ b/rkhunter/files/default/rkhunter.conf.tmpl.jinja
@@ -4,4 +4,4 @@
 ########################################################################
 
 {%- from "rkhunter/macro.jinja" import print_config -%}
-{{ print_config(rkhunter.config) }}
+{{ print_config(config) }}
diff --git a/rkhunter/files/default/rkhunter.default.tmpl.jinja b/rkhunter/files/default/rkhunter.default.tmpl.jinja
index ed6b5dd..0bcafdc 100644
--- a/rkhunter/files/default/rkhunter.default.tmpl.jinja
+++ b/rkhunter/files/default/rkhunter.default.tmpl.jinja
@@ -4,4 +4,4 @@
 ########################################################################
 
 {%- from "rkhunter/macro.jinja" import print_config -%}
-{{ print_config(rkhunter.default) }}
+{{ print_config(default) }}

gem 'kitchen-docker'
gem 'kitchen-salt'
gem 'kitchen-inspec'
gem 'rake'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you supply the version numbers as well? We've had some trouble with this otherwise:

source "https://rubygems.org"

gem 'kitchen-docker', '>= 2.9'
gem 'kitchen-salt', '>= 0.6.0'
gem 'kitchen-inspec', '>= 1.1'

Copy link
Member

@myii myii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fantastic work, thanks for this!

@n-rodriguez n-rodriguez changed the title [WIP] switch to tofs and full test suites Switch to tofs and full test suites Apr 24, 2019
@n-rodriguez n-rodriguez requested a review from daks April 24, 2019 01:19
@n-rodriguez n-rodriguez self-assigned this Apr 24, 2019
@daks
Copy link
Member

daks commented Apr 24, 2019

OK for me.

@myii myii merged commit 1363cc7 into saltstack-formulas:master Apr 24, 2019
@myii
Copy link
Member

myii commented Apr 24, 2019

Thanks for the review @daks. Merged @n-rodriguez.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants