-
Notifications
You must be signed in to change notification settings - Fork 680
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
inspec outputs full hash when testing ini style file option with [header] #1541
Comments
adamleff
added a commit
that referenced
this issue
Mar 6, 2017
When SimpleConfig parses a config file that has sections, such as a mysqld config file, the values within that section are returned via a Hash. However, we do not provide an easy way to write tests for those deep hash values: ``` describe mysql_conf('/tmp/my.cnf') do its('mysqld.expire_logs_days') { should cmp 10 } end MySQL Configuration ∅ undefined method `expire_logs_days' for #<Hash:0x007fe463795a00> ``` This change provides a method-based accessor for Hashes that are built via SimpleConfig. ``` describe mysql_conf('/tmp/my.cnf') do its('mysqld.expire_logs_days') { should cmp 10 } end MySQL Configuration ✔ mysqld.expire_logs_days should cmp == 10 ``` Fixes #1541 by changing the way the attributes are fetched. Signed-off-by: Adam Leff <adam@leff.co>
@shoekstra when #1544 is merged and released, to correct this issue, you'll want to access the data as such:
We'll look at #1543 separately. |
adamleff
added a commit
that referenced
this issue
Mar 8, 2017
When SimpleConfig parses a config file that has sections, such as a mysqld config file, the values within that section are returned via a Hash. However, we do not provide an easy way to write tests for those deep hash values: ``` describe mysql_conf('/tmp/my.cnf') do its('mysqld.expire_logs_days') { should cmp 10 } end MySQL Configuration ∅ undefined method `expire_logs_days' for #<Hash:0x007fe463795a00> ``` This change provides a method-based accessor for Hashes that are built via SimpleConfig. ``` describe mysql_conf('/tmp/my.cnf') do its('mysqld.expire_logs_days') { should cmp 10 } end MySQL Configuration ✔ mysqld.expire_logs_days should cmp == 10 ``` Fixes #1541 by changing the way the attributes are fetched. Signed-off-by: Adam Leff <adam@leff.co>
adamleff
added a commit
that referenced
this issue
Mar 15, 2017
When SimpleConfig parses a config file that has sections, such as a mysqld config file, the values within that section are returned via a Hash. However, we do not provide an easy way to write tests for those deep hash values: ``` describe mysql_conf('/tmp/my.cnf') do its('mysqld.expire_logs_days') { should cmp 10 } end MySQL Configuration ∅ undefined method `expire_logs_days' for #<Hash:0x007fe463795a00> ``` This change provides a method-based accessor for Hashes that are built via SimpleConfig. ``` describe mysql_conf('/tmp/my.cnf') do its('mysqld.expire_logs_days') { should cmp 10 } end MySQL Configuration ✔ mysqld.expire_logs_days should cmp == 10 ``` Fixes #1541 by changing the way the attributes are fetched. Signed-off-by: Adam Leff <adam@leff.co>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
When testing config in a mysql conf file with a
[mysqld]
header using themysql_conf
resource, the entire hash is returned in the test result instead of just the config option being tested. This could affect other INI style files too.Instead of seeing:
I would expect to see this (as you would without the ini style section header):
InSpec and Platform Version
inspec 1.16.1 on CentOS Linux release 7.3.1611 (Core)
Replication Case
Create a test file (I used
/tmp/my.cnf
):Using InSpec shell:
The text was updated successfully, but these errors were encountered: