Makefile中的刀(厨师)

问题描述 投票:1回答:1

我有一个厨师工作站设置和正常工作。我想用Makefile来包装一些刀命令。比如我做了:

# Simple Makefile
.PHONY: upload_roles nodes
upload_roles:
    knife upload /roles

nodes:
    knife list nodes

然后我得到这些错误:

$ make upload_roles
knife upload /roles
WARNING: No knife configuration file found

$ make nodes
knife list nodes
WARNING: No knife configuration file found
ERROR: Attempt to use relative path 'nodes' when current directory is outside the repository path.
ERROR: Current working directory is '/home/x/work/chef'.
Makefile:23: recipe for target 'nodes' failed
make: *** [nodes] Error 1

但是,如果我只是运行命令,我会得到正确的结果:

$ knife upload /roles
Updated roles/dev_samba.json

我错过了什么?我怎样才能弄清楚我遗失的东西或其他东西?

makefile chef gnu-make
1个回答
1
投票

正如vroomfondel所建议的那样,你在命令行上使用的shell和make用来执行配方的shell可能是不同的。而这种差异可能解释了不同的行为。如果您的命令行shell是bash,请尝试添加:

SHELL := bash

作为Makefile的第一行,看看它是否解决了问题。然后,如果您真的想在makefile中使用默认shell,请找出它所需的配置,以便无错误地运行命令。

© www.soinside.com 2019 - 2024. All rights reserved.