小编qui*_*ver的帖子

行太长:Ansible lint

这是我的 Ansible 任务

- name: no need to import it.
  ansible.builtin.uri:
    url: >
      https://{{ vertex_region }}-aiplatform.googleapis.com/v1/projects/{{ project }}/locations/{{ vertex_region }}/datasets/{{ dataset_id }}/dataItems
    method: GET
    headers:
      Content-Type: "application/json"
      Authorization: Bearer "{{ gcloud_auth }}"
  register: images
Run Code Online (Sandbox Code Playgroud)

在检查 Ansible lint 时,它会溢出:

行太长(151 > 120 个字符)(行长度)

该错误是针对url任务的参数的。我已经习惯>了分解url,不知道如何进一步减少它以适应 Ansible lint 给出的行约束?

static-analysis ansible ansible-lint

9
推荐指数
2
解决办法
1万
查看次数

Kubernetes pod 命令和参数

如果可以使用 kubernetes 清单文件中的命令指定所有参数,那么 args 的用途是什么?例如,我可以使用下面的语法,它完全否定了参数的使用。

command: [ "bin/bash", "-c", "mycommand" ]
Run Code Online (Sandbox Code Playgroud)

或者也

command:
  - "bin/bash"
  - "-c"
  - "mycommand"
Run Code Online (Sandbox Code Playgroud)

kubernetes

4
推荐指数
1
解决办法
2203
查看次数

jinja2.exceptions.TemplateRuntimeError:没有名为“split”的过滤器

我的 ansible 脚本看起来像,

- name: get dataset id
  set_fact : 
    dataset_ID: "{{ABC.json.datasets | json_query(query) | map('split', '/') | map(attribute=5) | list | first}}"
  vars:
    query: "[?displayName == 'My_dataset'].name"
  
Run Code Online (Sandbox Code Playgroud)

它给了我这个错误

An exception occurred during task execution. To see the full traceback, use -vvv. The error was: jinja2.exceptions.TemplateRuntimeError: no filter named 'split'
fatal: [localhost]: FAILED! => changed=false
Run Code Online (Sandbox Code Playgroud)

不确定这里发生了什么。我的意思是该脚本之前工作正常,当我在新虚拟机中运行它时,它会抛出此错误。有什么想法重新评价这个吗?

json split ansible

3
推荐指数
1
解决办法
7987
查看次数