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

file linked_to doesn't work properly #4643

Closed
maratsal opened this issue Oct 27, 2019 · 4 comments

Comments

@maratsal
Copy link

@maratsal maratsal commented Oct 27, 2019

Describe the problem

When run kitchen verify it reports that symbolic link is not linked to proper location. However when I check file manually - the link is right:
The check:

  describe file('/etc/systemd/system/ctrl-alt-del.target') do
    it { should be_linked_to '/dev/null' }
  end

Failure:

      ×  File /etc/systemd/system/ctrl-alt-del.target should be linked to "/dev/null"
     expected `File /etc/systemd/system/ctrl-alt-del.target.linked_to?("/dev/null")` to return true, got false

Manual check:

$ ls -la /etc/systemd/system/ctrl-alt-del.target
lrwxrwxrwx. 1 root root 9 Oct 26 20:42 /etc/systemd/system/ctrl-alt-del.target -> /dev/null

chef dk version I use:

$ chef --version
ChefDK version: 4.5.1
Chef Infra Client version: 15.4.45
Chef InSpec version: 4.18.0
Test Kitchen version: 2.3.3
Foodcritic version: 16.1.1
Cookstyle version: 5.9.3

And here is my OS:

$ sw_vers
ProductName:	Mac OS X
ProductVersion:	10.15
BuildVersion:	19A602
@maratsal

This comment has been minimized.

Copy link
Author

@maratsal maratsal commented Oct 27, 2019

please let me know if any other information is needed.

@miah

This comment has been minimized.

Copy link
Contributor

@miah miah commented Oct 28, 2019

I am unable to reproduce this against master:

[miah@awakening inspec]$ ls -l /etc/systemd/system/ctrl-alt-del.target 
lrwxrwxrwx 1 root root 9 Oct 28 10:42 /etc/systemd/system/ctrl-alt-del.target -> /dev/null
[miah@awakening inspec]$ cat ../inspec_repros/4643.rb 
describe file('/etc/systemd/system/ctrl-alt-del.target') do
  it { should be_linked_to '/dev/null' }
end
[miah@awakening inspec]$ bundle exec inspec exec ../inspec_repros/4643.rb 

Profile: tests from ../inspec_repros/4643.rb (tests from ...inspec_repros.4643.rb)
Version: (not specified)
Target:  local://

  File /etc/systemd/system/ctrl-alt-del.target
     ✔  should be linked to "/dev/null"

Test Summary: 1 successful, 0 failures, 0 skipped
[miah@awakening inspec]$ bundle exec inspec version
4.18.15
@maratsal

This comment has been minimized.

Copy link
Author

@maratsal maratsal commented Oct 28, 2019

I have feeling that somehow when inspec is getting output of checkup command over ssh remotely it is adding some additional ssh session output (it can be related our VM OS setup (could be different than one in your test). Is there a way to run that kitchen verify against VM with more verbose output so that I can see what is fetched from VM to compare with specific test?

@kekaichinose

This comment has been minimized.

Copy link
Collaborator

@kekaichinose kekaichinose commented Oct 31, 2019

@marastal we tested this out on our own VMs locally and were not able to repro this issue, which means it could be an issue with your VM configuration specifically.

The nature of this issue is turning into what looks to be support-related. We use GitHub issues to track bugs and feature requests. I've moved your issue over to the Chef Mailing List for further follow-up: https://discourse.chef.io/t/file-linked-to-doesnt-work-properly/16149

Thanks!
Chef InSpec Team

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.