0

我使用 bootstrap 命令出错,并且知道我调用了节点-i,我想删除该节点:

knife node list
-i

但是当我尝试从刀运行删除命令时,结果如下:

knife node delete -i

Error: invalid option: -i
USAGE: knife node delete [NODE[,NODE]] (options)
    -s, --server-url URL             Chef Server URL
        --chef-zero-host HOST        Host to start chef-zero on
        --chef-zero-port PORT        Port (or port range) to start chef-zero on.  Port ranges like 1000,1010 or 8889-9999 will try all given ports until one works.
    -k, --key KEY                    API Client Key
        --[no-]color                 Use colored output, defaults to enabled
    -c, --config CONFIG              The configuration file to use
        --config-option OPTION=VALUE Override a single configuration option
        --defaults                   Accept default values for all questions
    -d, --disable-editing            Do not open EDITOR, just accept the data as is
    -e, --editor EDITOR              Set the editor to use for interactive commands
    -E, --environment ENVIRONMENT    Set the Chef environment (except for in searches, where this will be flagrantly ignored)
        --[no-]fips                  Enable fips mode
    -F, --format FORMAT              Which format to use for output
        --[no-]listen                Whether a local mode (-z) server binds to a port
    -z, --local-mode                 Point knife commands at local repository instead of server
    -u, --user USER                  API Client Username
        --print-after                Show the data after a destructive operation
    -V, --verbose                    More verbose output. Use twice for max verbosity
    -v, --version                    Show chef version
    -y, --yes                        Say yes to all prompts for confirmation
    -h, --help                       Show this message

所以我无法删除这个节点。

有什么建议吗?

4

3 回答 3

3

使用某种黑魔法和刀 exec,您可以像这样从命令行中删除:

knife exec -E "nodes.search('name:*i') { |n| n.destroy if n.name == '-i' }"

这将遍历名称以 i 结尾的所有节点,因此如果您有一堆节点可能需要一些时间,然后如果节点的名称恰好是-i.

如果它是引导程序的结果,您可能也有一个客户端,使用clients而不是nodes应该这样做。

于 2017-01-26T17:12:07.537 回答
0

您将能够使用 Web 界面将其删除。我从命令行尝试了同样的方法,没有用。

于 2017-01-26T16:31:18.587 回答
0

您可以使用批量删除选项将其删除。像这样的东西会起作用

刀节点批量删除“^-[az]*”

于 2018-12-06T14:51:25.660 回答