首页 > 解决方案 > Salt file.recurse 过滤器 include_pat:不工作

问题描述

我正在尝试复制扩展名使用的几个文件,file.recurse但是当我放置时include_pat: *.sh,它会抛出错误:

    Data failed to compile:
----------
    Rendering SLS 'base:test_copy_sqlautomation' failed: did not find expected alphabetic or numeric character
ERROR: Minions returned with non-zero exit code

标签: salt-stack

解决方案


这似乎是 YAML 无法识别*为 glob 字符的简单问题。Salt 期望匹配一个字母或数字字符include_pat。如果你用引号括起来它应该可以工作。

例子:

copy_shell_scripts:
  file.recurse:
    - name: /tmp/scripts
    - source: salt://scripts
    - include_pat: "*.sh"

推荐阅读