首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >刀删除命令无法删除奇怪的节点

刀删除命令无法删除奇怪的节点
EN

Stack Overflow用户
提问于 2017-01-26 14:47:15
回答 3查看 658关注 0票数 0

我在引导命令中出错,并且知道我有一个名为-i的节点,我想删除该节点:

代码语言:javascript
复制
knife node list
-i

但是,当我试图从刀中运行删除命令时,结果是:

代码语言:javascript
复制
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

因此,我无法删除此节点。

有什么建议吗?

EN

回答 3

Stack Overflow用户

回答已采纳

发布于 2017-01-26 17:12:07

使用某种黑魔法和刀子执行程序,您可以从命令行中删除如下所示:

代码语言:javascript
复制
knife exec -E "nodes.search('name:*i') { |n| n.destroy if n.name == '-i' }"

这将在所有节点上循环,名称以i结尾,因此,如果有一堆节点,可能需要一些时间,如果节点的名称完全是-i,它将销毁该节点。

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

票数 3
EN

Stack Overflow用户

发布于 2017-01-26 16:31:18

您将能够删除它使用网页界面。我试过从命令行同样的,没有工作。

票数 0
EN

Stack Overflow用户

发布于 2018-12-06 14:51:25

您可以使用大容量删除选项删除它。像这样的东西会有用的

刀节点大容量删除“^-a*”

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/41876089

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档