7

I have been trying to find a pattern (bcm2708_wdog) in the /etc/modules file and if it isnt there add it to the bottom. Every time I try this I get the "ID dog in SLS dog is not a dictionary". I have no idea what this means. Here is the file:

dog:
  - file.replace:
    - name: /etc/modules
    - pattern: 'bcm2708_wdog'
    - append_if_not_found: True
Sufiyan Ghori
  • 18,164
  • 14
  • 82
  • 110
ad450
  • 73
  • 1
  • 5

2 Answers2

14

It should probably look like this:

dog:
  file.replace:    # <--------this line was your problem.
    - name: /etc/modules
    - pattern: 'bcm2708_wdog'
    - append_if_not_found: True

Lines beginning with "-" denote items in a list. In your version, you've defined the top-level "dog" element as a list containing a dictionary. Salt expects it to be a straight dictionary instead, hence the error.

Andrew
  • 4,058
  • 4
  • 25
  • 37
  • Thank you so much, now I know how to use "-" properly! I just started working with salt so thanks for the help! – ad450 Jul 15 '15 at 15:11
0

Depending on your version, in 2018

You will get that message if wrote the state with just 'file.replace' without the "dog" on top.

file.replace: - name: /etc/modules - pattern: 'bcm2708_wdog' - append_if_not_found: True

Impermanence
  • 146
  • 1
  • 4