Cloud foundry BOSH CLI应在路径处找到映射。。。但是发现';[]接口{}';

Cloud foundry BOSH CLI应在路径处找到映射。。。但是发现';[]接口{}';,cloud-foundry,cf-bosh,bosh,Cloud Foundry,Cf Bosh,Bosh,与另一个问题非常相似,但有细微差别。尝试了公认的答案,但仍然没有成功 我在运行命令时遇到此错误: 波什-d普罗米修斯部署-n pfg普罗米修斯波什租赁/manifests/prometheus.yml-o替换变量yml 应在路径“/instance_groups/name=prometheus2/jobs/name=prometheus2/properties/prometheus/scrape_configs/job_name=bosh/static_configs/targets”处找到映射

与另一个问题非常相似,但有细微差别。尝试了公认的答案,但仍然没有成功

我在运行命令时遇到此错误:

波什-d普罗米修斯部署-n pfg普罗米修斯波什租赁/manifests/prometheus.yml-o替换变量yml

应在路径“/instance_groups/name=prometheus2/jobs/name=prometheus2/properties/prometheus/scrape_configs/job_name=bosh/static_configs/targets”处找到映射,但找到“[]接口{}”

更换_vars.yml:

- type: replace
  path: /instance_groups/name=prometheus2/jobs/name=prometheus2/properties/prometheus/scrape_configs/job_name=bosh/static_configs/targets?/-
  value: 192.168.123.26:9190
舱单部分:

- name: prometheus2
    properties:
      prometheus:
        rule_files:
        - ...
        scrape_configs:
        - file_sd_configs:
          - files:
            - /var/vcap/store/bosh_exporter/bosh_target_groups.json
          job_name: prometheus
          relabel_configs:
          - action: keep
            ...
          - regex: (.*)
            ...
        - job_name: bosh
          scrape_interval: 2m
          scrape_timeout: 1m
          static_configs:
          - targets:
            - localhost:9190
正确的路径是什么


编辑:我已经看了一遍,但找不到像我这样的例子。

我也多次遇到这个问题,但从未找到这个用例的解决方案。我通常做的变通方法是替换一个步骤。 例如:

/tmp/replace vars.yml

- type: replace
  path: /instance_groups/name=prometheus2/jobs/name=prometheus2/properties/prometheus/scrape_configs/job_name=bosh/static_configs/0
  value:
    targets:
    - 192.168.123.26:9190
    - localhost:9190
instance_groups:
- name: prometheus2
  jobs:
    - name: prometheus2
      properties:
        prometheus:
          rule_files:
          - abc
          scrape_configs:
          - file_sd_configs:
          - files:
            - /var/vcap/store/bosh_exporter/bosh_target_groups.json
          job_name: prometheus
          relabel_configs:
          - action: keep
          - regex: (.*)
          - job_name: bosh
          scrape_interval: 2m
          scrape_timeout: 1m
          static_configs:
          - targets:
            - localhost:9190
instance_groups:
- jobs:
  - name: prometheus2
      properties:
        prometheus:
          rule_files:
          - abc
          scrape_configs:
          - file_sd_configs:
          - files:
            - /var/vcap/store/bosh_exporter/bosh_target_groups.json
          job_name: prometheus
          relabel_configs:
          - action: keep
          - regex: (.*)
          - job_name: bosh
          scrape_interval: 2m
          scrape_timeout: 1m
          static_configs:
          - targets:
            - 192.168.123.26:9190
            - localhost:9190
  name: prometheus2
/tmp/testmanifest.yml

- type: replace
  path: /instance_groups/name=prometheus2/jobs/name=prometheus2/properties/prometheus/scrape_configs/job_name=bosh/static_configs/0
  value:
    targets:
    - 192.168.123.26:9190
    - localhost:9190
instance_groups:
- name: prometheus2
  jobs:
    - name: prometheus2
      properties:
        prometheus:
          rule_files:
          - abc
          scrape_configs:
          - file_sd_configs:
          - files:
            - /var/vcap/store/bosh_exporter/bosh_target_groups.json
          job_name: prometheus
          relabel_configs:
          - action: keep
          - regex: (.*)
          - job_name: bosh
          scrape_interval: 2m
          scrape_timeout: 1m
          static_configs:
          - targets:
            - localhost:9190
instance_groups:
- jobs:
  - name: prometheus2
      properties:
        prometheus:
          rule_files:
          - abc
          scrape_configs:
          - file_sd_configs:
          - files:
            - /var/vcap/store/bosh_exporter/bosh_target_groups.json
          job_name: prometheus
          relabel_configs:
          - action: keep
          - regex: (.*)
          - job_name: bosh
          scrape_interval: 2m
          scrape_timeout: 1m
          static_configs:
          - targets:
            - 192.168.123.26:9190
            - localhost:9190
  name: prometheus2
bosh int/tmp/test-manifest.yml-o/tmp/replace vars.yml插入:

- type: replace
  path: /instance_groups/name=prometheus2/jobs/name=prometheus2/properties/prometheus/scrape_configs/job_name=bosh/static_configs/0
  value:
    targets:
    - 192.168.123.26:9190
    - localhost:9190
instance_groups:
- name: prometheus2
  jobs:
    - name: prometheus2
      properties:
        prometheus:
          rule_files:
          - abc
          scrape_configs:
          - file_sd_configs:
          - files:
            - /var/vcap/store/bosh_exporter/bosh_target_groups.json
          job_name: prometheus
          relabel_configs:
          - action: keep
          - regex: (.*)
          - job_name: bosh
          scrape_interval: 2m
          scrape_timeout: 1m
          static_configs:
          - targets:
            - localhost:9190
instance_groups:
- jobs:
  - name: prometheus2
      properties:
        prometheus:
          rule_files:
          - abc
          scrape_configs:
          - file_sd_configs:
          - files:
            - /var/vcap/store/bosh_exporter/bosh_target_groups.json
          job_name: prometheus
          relabel_configs:
          - action: keep
          - regex: (.*)
          - job_name: bosh
          scrape_interval: 2m
          scrape_timeout: 1m
          static_configs:
          - targets:
            - 192.168.123.26:9190
            - localhost:9190
  name: prometheus2