我一直在使用nipyapi客户端来管理新的Apache NiFi部署,并且运行良好,但是在尝试启用Controller Services时遇到问题。
我的设置:
我在docker中运行NiFi,每次容器启动时都会执行一系列步骤,例如:
import nipyapi
nipyapi.config.nifi_config.host = 'http://localhost:9999/nifi-api'
nipyapi.canvas.get_controller('MariaDB', identifier_type='name', bool_response=False)
#Enable Controler
headers = {'Content-Type': 'application/json'}
url = 'http://localhost:9999/nifi-api/flow/process-groups/'+nipyapi.canvas.get_root_pg_id()+'/controller-services'
r = requests.get(url)
reponse = json.loads(r.text)
controllerId = reponse['controllerServices'][0]['id']
nipyapi.canvas.schedule_controller(controllerId, 'True', refresh=False)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.5/dist-packages/nipyapi/canvas.py", line 1222, in schedule_controller
assert isinstance(controller, nipyapi.nifi.ControllerServiceEntity)
AssertionError
不确定我缺少什么!
PS -我一直在尝试nifi-toolkit,但是效果不佳
./cli.sh nifi pg-enable-services --processGroupId 2b8b54ca-016b-1000-0655-c3ec484fd81d -u http://localhost:9999 --verbose
有时它有时不起作用!
我想坚持使用一种工具,例如:工具箱或nipyapi(更快)
任何帮助都会很棒!
答案 0 :(得分:2)
对于每个错误,NiPyAPI希望传递给Controller对象,而不仅仅是ID。