Skip to content

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

Description

@pocke

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.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions