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

Error with apache_conf on CentOS #37

Closed
mattstratton opened this issue Jan 26, 2016 · 12 comments
Closed

Error with apache_conf on CentOS #37

mattstratton opened this issue Jan 26, 2016 · 12 comments

Comments

@mattstratton
Copy link

I have attempted this with both Cent 6 and 7, using Apache 2.2 and 2.4.

describe apache_conf do
  its('ServerTokens') { should eq 'Prod' }
end

The error I get when running this in test kitchen is

>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: Failed to complete #verify action: [undefined method `run_command' for #<#<Class:0x4489548>:0x3ff0c48>] >>>>>> ----------------------
>>>>>> Please see .kitchen/logs/kitchen.log for more details
>>>>>> Also try running `kitchen diagnose --all` for configuration

I'm not sure if this is an issue with inspec or kitchen-inspec...if this should be reported to inspec, please let me know.

@srenatus
Copy link
Contributor

Hey Matt,

thanks for reporting this. Is this the latest releases of inspec and train? (.kitchen/logs/kitchen.log should have the backtraces and version info, I guess, maybe you could just share that?)

@mattstratton
Copy link
Author

This is with the following gem versions:

kitchen-inspec (0.9.0)
inspec (0.9.2)

The kitchen.log is viewable here - https://gist.github.com/mattstratton/889f949129beba7b1525

Edited to add - upgrading to kitchen-inspec (0.10.1) does not fix the issue.

@srenatus
Copy link
Contributor

Hey Matt,

thanks a lot for the information. This version of inspec is quite ancient, could you try again after updating it? I strongly suspect that this is your issue, it was fixed in inspec 0.9.6.

@mattstratton
Copy link
Author

I updated inspec to 0.9.10 and now I get the following error:

>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: Failed to complete #verify action: [undefined local variable or method `find' for Apache Config /etc/httpd/conf/httpd.conf:#<Class:0x4604988>]
>>>>>> ----------------------
>>>>>> Please see .kitchen/logs/kitchen.log for more details
>>>>>> Also try running `kitchen diagnose --all` for configuration

@srenatus
Copy link
Contributor

Hey Matt,

sorry for the ping-pong, but I'm a little lost on your error message. Could you include the kitchen.log, and, if possible, your inspec checks? Cannot really find that find atm...

@stuartpreston
Copy link

I'm also getting the similar results. Using Windows 10, kitchen-inspec 0.10.1, inspec 0.9.11, :

C:\Users\StuartPreston\kitchen-azurerm-demo\azure-linux [master +1 ~2 -1 !]> kitchen verify -l debug
-----> Starting Kitchen (v1.4.2)
-----> Verifying <cfgmgmtcamp-ubuntu-1404-LTS>...
>>>>>> ------Exception-------
>>>>>> Class: Kitchen::ActionFailed
>>>>>> Message: Failed to complete #verify action: [undefined local variable or method `find' for Apache Config /etc/apache2/apache2.conf:#<Class:0x4b2e2f0>]
>>>>>> ----------------------
>>>>>> Please see .kitchen/logs/kitchen.log for more details
>>>>>> Also try running `kitchen diagnose --all` for configuration

D      ------Exception-------
D      Class: Kitchen::ActionFailed
D      Message: Failed to complete #verify action: [undefined local variable or method `find' for Apache Config /etc/apache2/apache2.conf:#<Class:0x4b2e2f0>]
D      ---Nested Exception---
D      Class: NameError
D      Message: undefined local variable or method `find' for Apache Config /etc/apache2/apache2.conf:#<Class:0x4b2e2f0>
D      ------Backtrace-------
D      C:/Users/StuartPreston/AppData/Local/chefdk/gem/ruby/2.1.0/gems/inspec-0.9.11/lib/utils/find_files.rb:36:in `find_files_or_error'
D      C:/Users/StuartPreston/AppData/Local/chefdk/gem/ruby/2.1.0/gems/inspec-0.9.11/lib/utils/find_files.rb:21:in `find_files'
D      C:/Users/StuartPreston/AppData/Local/chefdk/gem/ruby/2.1.0/gems/inspec-0.9.11/lib/resources/apache_conf.rb:100:in `block in include_files'
D      C:/Users/StuartPreston/AppData/Local/chefdk/gem/ruby/2.1.0/gems/inspec-0.9.11/lib/resources/apache_conf.rb:98:in `each'
D      C:/Users/StuartPreston/AppData/Local/chefdk/gem/ruby/2.1.0/gems/inspec-0.9.11/lib/resources/apache_conf.rb:98:in `include_files'
D      C:/Users/StuartPreston/AppData/Local/chefdk/gem/ruby/2.1.0/gems/inspec-0.9.11/lib/resources/apache_conf.rb:82:in `read_content'
D      C:/Users/StuartPreston/AppData/Local/chefdk/gem/ruby/2.1.0/gems/inspec-0.9.11/lib/resources/apache_conf.rb:27:in `initialize'
D      C:/Users/StuartPreston/AppData/Local/chefdk/gem/ruby/2.1.0/gems/inspec-0.9.11/lib/inspec/plugins/resource.rb:34:in `initialize'
D      C:/Users/StuartPreston/AppData/Local/chefdk/gem/ruby/2.1.0/gems/inspec-0.9.11/lib/inspec/resource.rb:27:in `new'
D      C:/Users/StuartPreston/AppData/Local/chefdk/gem/ruby/2.1.0/gems/inspec-0.9.11/lib/inspec/resource.rb:27:in `block (3 levels) in create_dsl'
D      C:/Users/StuartPreston/kitchen-azurerm-demo/azure-linux/test/integration/cfgmgmtcamp/default_spec.rb:9:in `load'
D      C:/Users/StuartPreston/AppData/Local/chefdk/gem/ruby/2.1.0/gems/inspec-0.9.11/lib/inspec/profile_context.rb:34:in `instance_eval'
D      C:/Users/StuartPreston/AppData/Local/chefdk/gem/ruby/2.1.0/gems/inspec-0.9.11/lib/inspec/profile_context.rb:34:in `load'
D      C:/Users/StuartPreston/AppData/Local/chefdk/gem/ruby/2.1.0/gems/inspec-0.9.11/lib/inspec/runner.rb:101:in `add_content'
D      C:/Users/StuartPreston/AppData/Local/chefdk/gem/ruby/2.1.0/gems/inspec-0.9.11/lib/inspec/runner.rb:81:in `block in add_tests'
D      C:/Users/StuartPreston/AppData/Local/chefdk/gem/ruby/2.1.0/gems/inspec-0.9.11/lib/inspec/runner.rb:80:in `each'
D      C:/Users/StuartPreston/AppData/Local/chefdk/gem/ruby/2.1.0/gems/inspec-0.9.11/lib/inspec/runner.rb:80:in `add_tests'
D      C:/Users/StuartPreston/AppData/Local/chefdk/gem/ruby/2.1.0/gems/kitchen-inspec-0.10.1/lib/kitchen/verifier/inspec.rb:41:in `call'
D      C:/Users/StuartPreston/AppData/Local/chefdk/gem/ruby/2.1.0/gems/test-kitchen-1.4.2/lib/kitchen/instance.rb:398:in `block in verify_action'
D      C:/Users/StuartPreston/AppData/Local/chefdk/gem/ruby/2.1.0/gems/test-kitchen-1.4.2/lib/kitchen/instance.rb:488:in `call'
D      C:/Users/StuartPreston/AppData/Local/chefdk/gem/ruby/2.1.0/gems/test-kitchen-1.4.2/lib/kitchen/instance.rb:488:in `synchronize_or_call'
D      C:/Users/StuartPreston/AppData/Local/chefdk/gem/ruby/2.1.0/gems/test-kitchen-1.4.2/lib/kitchen/instance.rb:453:in `block in action'
D      C:/opscode/chefdk/embedded/lib/ruby/2.1.0/benchmark.rb:279:in `measure'
D      C:/Users/StuartPreston/AppData/Local/chefdk/gem/ruby/2.1.0/gems/test-kitchen-1.4.2/lib/kitchen/instance.rb:452:in `action'
D      C:/Users/StuartPreston/AppData/Local/chefdk/gem/ruby/2.1.0/gems/test-kitchen-1.4.2/lib/kitchen/instance.rb:394:in `verify_action'
D      C:/Users/StuartPreston/AppData/Local/chefdk/gem/ruby/2.1.0/gems/test-kitchen-1.4.2/lib/kitchen/instance.rb:341:in `block in transition_to'
D      C:/Users/StuartPreston/AppData/Local/chefdk/gem/ruby/2.1.0/gems/test-kitchen-1.4.2/lib/kitchen/instance.rb:340:in `each'
D      C:/Users/StuartPreston/AppData/Local/chefdk/gem/ruby/2.1.0/gems/test-kitchen-1.4.2/lib/kitchen/instance.rb:340:in `transition_to'
D      C:/Users/StuartPreston/AppData/Local/chefdk/gem/ruby/2.1.0/gems/test-kitchen-1.4.2/lib/kitchen/instance.rb:160:in `verify'
D      C:/Users/StuartPreston/AppData/Local/chefdk/gem/ruby/2.1.0/gems/test-kitchen-1.4.2/lib/kitchen/command.rb:176:in `public_send'
D      C:/Users/StuartPreston/AppData/Local/chefdk/gem/ruby/2.1.0/gems/test-kitchen-1.4.2/lib/kitchen/command.rb:176:in `block (2 levels) in run_action'
D      ----------------------
zlib(finalizer): the stream was freed prematurely.

@srenatus
Copy link
Contributor

srenatus commented Feb 1, 2016

Hey Stuart, hey Matt,

thanks for the input. Seems like you've both hit a "bad find" here... It's hard to guess what went wrong there, though.

Could you try that branch of inspec, please? (Should be in master very soon, too.)

@stuartpreston
Copy link

That gets me further but the default example doesn't work:

  1) Apache Config /etc/apache2/apache2.conf Timeout
     Failure/Error: its('Timeout') { should eq '300' }
     NoMethodError:
       undefined method `Timeout' for Apache Config /etc/apache2/apache2.conf:#<Class:0x4b05fb8>
     # ./test/integration/cfgmgmtcamp/default_spec.rb:2:in `block (2 levels) in load'
     # C:/Users/StuartPreston/AppData/Local/chefdk/gem/ruby/2.1.0/gems/inspec-0.9.11/lib/inspec/runner_rspec.rb:55:in `run'
     # C:/Users/StuartPreston/AppData/Local/chefdk/gem/ruby/2.1.0/gems/inspec-0.9.11/lib/inspec/runner.rb:110:in `run'
     # C:/Users/StuartPreston/AppData/Local/chefdk/gem/ruby/2.1.0/gems/kitchen-inspec-0.10.1/lib/kitchen/verifier/inspec.rb:43:in `call'
     # C:/Users/StuartPreston/AppData/Local/chefdk/gem/ruby/2.1.0/gems/test-kitchen-1.4.2/lib/kitchen/instance.rb:398:in `block in verify_action'
     # C:/Users/StuartPreston/AppData/Local/chefdk/gem/ruby/2.1.0/gems/test-kitchen-1.4.2/lib/kitchen/instance.rb:488:in `call'
     # C:/Users/StuartPreston/AppData/Local/chefdk/gem/ruby/2.1.0/gems/test-kitchen-1.4.2/lib/kitchen/instance.rb:488:in `synchronize_or_call'
     # C:/Users/StuartPreston/AppData/Local/chefdk/gem/ruby/2.1.0/gems/test-kitchen-1.4.2/lib/kitchen/instance.rb:453:in `block in action'
     # C:/Users/StuartPreston/AppData/Local/chefdk/gem/ruby/2.1.0/gems/test-kitchen-1.4.2/lib/kitchen/instance.rb:452:in `action'
     # C:/Users/StuartPreston/AppData/Local/chefdk/gem/ruby/2.1.0/gems/test-kitchen-1.4.2/lib/kitchen/instance.rb:394:in `verify_action'
     # C:/Users/StuartPreston/AppData/Local/chefdk/gem/ruby/2.1.0/gems/test-kitchen-1.4.2/lib/kitchen/instance.rb:341:in `block in transition_to'
     # C:/Users/StuartPreston/AppData/Local/chefdk/gem/ruby/2.1.0/gems/test-kitchen-1.4.2/lib/kitchen/instance.rb:340:in `each'
     # C:/Users/StuartPreston/AppData/Local/chefdk/gem/ruby/2.1.0/gems/test-kitchen-1.4.2/lib/kitchen/instance.rb:340:in `transition_to'
     # C:/Users/StuartPreston/AppData/Local/chefdk/gem/ruby/2.1.0/gems/test-kitchen-1.4.2/lib/kitchen/instance.rb:160:in `verify'
     # C:/Users/StuartPreston/AppData/Local/chefdk/gem/ruby/2.1.0/gems/test-kitchen-1.4.2/lib/kitchen/command.rb:176:in `public_send'
     # C:/Users/StuartPreston/AppData/Local/chefdk/gem/ruby/2.1.0/gems/test-kitchen-1.4.2/lib/kitchen/command.rb:176:in `block (2 levels) in run_action'

Finished in 0.0156 seconds (files took 7.66 seconds to load)
1 example, 1 failure

Failed examples:

rspec  # Apache Config /etc/apache2/apache2.conf Timeout

@mattstratton
Copy link
Author

I've updated to inspec 0.9.11 and I still get the same error on CentOS.

On Ubuntu I get the same error as @stuartpreston

@chris-rock
Copy link
Collaborator

@stuartpreston @mattstratton Could you share your apache test and the cookbook that you used to roll out apache?

@adamleff
Copy link
Contributor

There hasn't been any movement on this issue in quite some time, so I'm going to close this for now absent of any repro steps. Happy to reopen and troubleshoot, but this is likely a core InSpec problem, not a kitchen-inspec problem. Thanks!

@monoranjang
Copy link

Is this issue resolved?

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

No branches or pull requests

6 participants