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

not_if is confusing when cwd is specified with a directory that does not exist #293

Open
pocke opened this issue Jun 3, 2019 · 0 comments

Comments

@pocke
Copy link
Contributor

pocke commented Jun 3, 2019

Problem

not_if is confusing when cwd is specified with a directory that does not exist.

Minimal reproduce code

execute 'echo hello' do
  cwd '/path/to/unknwon/dir'
  not_if 'true'
end
$ itamae local test.rb --dry-run
 INFO : Starting Itamae... (dry-run)
 INFO : Recipe: /tmp/tmp.VzWjtHqt73/test.rb
 INFO :   execute[echo hello] executed will change from 'false' to 'true'

It should not be executed always because true command returns 0.
But cd /path/to/unknwon/dir returns non-zero value, so Itamae guesses it should be executed.

note

In this case, it will fail without --dry-run. Actually the directory will be create with another command.

How should it behave

I'm not sure.

I guess warning is a solution. Because I was confused by the behaviour, but I would not like to make it error. But I'm not sure what the error message, and the condition of the warning message.

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

1 participant