gpt4 book ai didi

python - runner 中的 salt 键命令

转载 作者:行者123 更新时间:2023-11-28 22:40:02 24 4
gpt4 key购买 nike

我正在编写一个自定义的 Salt Stack runner 来包装接受和拒绝 minions。我如何从我的 python 运行器中调用 salt-key,这相当于从命令行调用 salt-key

salt-key -a {minion_name}

最佳答案

我不能给你一个明确的答案,但这是我的两分钱:

salt-key脚本的源代码是this one .按照调用链,我到达了this module其中包含几个用于进行 key 处理的类。

该模块的文档如下:

The Salt Key backend API and interface used by the CLI. The Key class can be used to manage salt keys directly without interfacing with the CLI.

这是 mentioned class .

基于 this code ,我认为它的用法如下:

import salt.client
import salt.key

client = salt.client.LocalClient()
key_manager = salt.key.Key(client.opts)
key_manager.accept('web*')

关于python - runner 中的 salt 键命令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34147754/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com