Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unicode error and expected <block end>, but found '<block mapping start>' in the SLS file #8549

Closed
ghost opened this Issue Nov 15, 2013 · 3 comments

Comments

Projects
None yet
4 participants
@ghost
Copy link

ghost commented Nov 15, 2013

Hi, all!

I use the salt config my squid and facing the "unicode error" and "expected , but found ''" there.

and here is my config

    /usr/local/etc/squid/backend1a.conf:
     file.managed:
      - source: salt://squidlayer1/backend1a.conf
      - template: jinja
      - context:
       id: 1
       instances: backend1a
       mgmt_interface: {{ grains['ip_interfaces']['vlan67'][0]}}
       listen_interface: {{grains['ip_interfaces']['vlan62'][0]}}

    /usr/local/etc/squid/backend1b.conf:
     file.managed:
      - source: salt://squidlayer1/backend1b.conf
      - template: jinja
      - context:
        id: 2
        instances: backend1b
        mgmt_interface: {{grains['ip_interfaces']['vlan67'][0]}}
        listen_interface: {{grains['ip_interfaces']['vlan62'][0]}}


    /usr/local/etc/squid/backend1c.conf:
     file.managed:
      - source: salt://squidlayer1/backend1c.conf
      - template: jinja
      - context:
       id: 3
       instances: backend1c
       mgmt_interface: {{ grains['ip_interfaces']['vlan67'][0]}}
       listen_interface: {{grains['ip_interfaces']['vlan62'][0]}}

and the error here

  sq-l1-n1:
      Data failed to compile:
  ----------
      Rendering SLS squidlayer1_node1 failed, render error: while parsing a block collection
    in "<unicode string>", line 13, column 3:
        - source: salt://squidlayer1/bac ... 
        ^
  expected <block end>, but found '<block mapping start>'
    in "<unicode string>", line 16, column 4:
         id: 2
         ^
  Traceback (most recent call last):
    File "/usr/lib/python2.7/dist-packages/salt/state.py", line 1944, in render_state
      rendered_sls=mods
    File "/usr/lib/python2.7/dist-packages/salt/template.py", line 69, in compile_template
      ret = render(input_data, env, sls, **render_kwargs)
    File "/usr/lib/python2.7/dist-packages/salt/renderers/yaml.py", line 34, in render
      data = load(yaml_data, Loader=get_yaml_loader(argline))
    File "/usr/lib/python2.7/dist-packages/yaml/__init__.py", line 71, in load
      return loader.get_single_data()
    File "/usr/lib/python2.7/dist-packages/yaml/constructor.py", line 37, in get_single_data
      node = self.get_single_node()
    File "/usr/lib/python2.7/dist-packages/yaml/composer.py", line 36, in get_single_node
      document = self.compose_document()
    File "/usr/lib/python2.7/dist-packages/yaml/composer.py", line 55, in compose_document
      node = self.compose_node(None, None)
    File "/usr/lib/python2.7/dist-packages/yaml/composer.py", line 84, in compose_node
      node = self.compose_mapping_node(anchor)
    File "/usr/lib/python2.7/dist-packages/yaml/composer.py", line 133, in compose_mapping_node
      item_value = self.compose_node(node, item_key)
    File "/usr/lib/python2.7/dist-packages/yaml/composer.py", line 84, in compose_node
      node = self.compose_mapping_node(anchor)
    File "/usr/lib/python2.7/dist-packages/yaml/composer.py", line 133, in compose_mapping_node
      item_value = self.compose_node(node, item_key)
    File "/usr/lib/python2.7/dist-packages/yaml/composer.py", line 82, in compose_node
      node = self.compose_sequence_node(anchor)
    File "/usr/lib/python2.7/dist-packages/yaml/composer.py", line 110, in compose_sequence_node
      while not self.check_event(SequenceEndEvent):
    File "/usr/lib/python2.7/dist-packages/yaml/parser.py", line 98, in check_event
      self.current_event = self.state()
    File "/usr/lib/python2.7/dist-packages/yaml/parser.py", line 393, in parse_block_sequence_entry
      "expected <block end>, but found %r" % token.id, token.start_mark)
  ParserError: while parsing a block collection
    in "<unicode string>", line 13, column 3:
        - source: salt://squidlayer1/bac ... 
        ^
  expected <block end>, but found '<block mapping start>'
    in "<unicode string>", line 16, column 4:
         id: 2
         ^

I change the file many time but no use there.
Can anyone give me a suggestion there?

@basepi

This comment has been minimized.

Copy link
Collaborator

basepi commented Nov 15, 2013

Can you try indenting the context like this?

/usr/local/etc/squid/backend1a.conf:
    file.managed:
      - source: salt://squidlayer1/backend1a.conf
      - template: jinja
      - context:
          id: 1
          instances: backend1a
          mgmt_interface: {{ grains['ip_interfaces']['vlan67'][0]}}
          listen_interface: {{grains['ip_interfaces']['vlan62'][0]}}

If I remember correctly, the context dict has to be indented from the level of the c character, I think it's a YAML idiosyncrasy. Can't remember for sure, however.

@rallytime rallytime closed this Feb 4, 2015

@SuryaJoe

This comment has been minimized.

Copy link

SuryaJoe commented Apr 11, 2017

Hi all,
I use the mistral.yaml config and I am getting [expected , but found ''] error and here is my config.
I am trying to do a scenario which stackstorm have shown in their blog..
If any guys have tried that and got the output,please help me also to do that

The create_vm action metadata:

name: "create_vm"
runner_type: "action-chain"
description: "Create a VM, add DNS to Route53"
enabled: true
entry_point: "workflows/create_vm.yaml"
parameters:
image_id:
type: "string"
description: "AWS image id to create instance from"
required: true
instance_type:
type: "string"
description: "Flavor to use for instance creation"
default: "t2.medium"
key_name:
type: "string"
description: "SSH key to use during intial instance creation"
required: true
base_user:
type: "string"
description: "Username for initial ssh test"
default: "ubuntu"
keyfile:
type: "string"
description: "Path to local private key that corresponds to {{key_name}}"
required: true
dns_zone:
type: "string"
description: "Route53 DNS Zone to add host to"
required: true
hostname:
type: "string"
description: "Short hostname"
required: true
subnet_id:
type: "string"
description: "AWS Subnet ID"
required: true

and this is the error i got :
/opt/stackstorm/packs/packs/actions$ mistral action-create create_vm.yaml
ERROR (app) Definition could not be parsed: while parsing a block mapping
in "", line 1, column 2:
name: "createvm"
^
expected , but found ''
in "", line 2, column 3:
runner_type: "action-chain"
^

@tapasudenia

This comment has been minimized.

Copy link

tapasudenia commented Dec 13, 2017

version: '2.1'

services:
mycoreappfordocker:
labels:
- "com.microsoft.visualstudio.targetoperatingsystem=windows"
volumes:
- ~/clrdbg:/clrdbg:ro
entrypoint: tail -f /dev/null

What is wrong with my indentation? :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.