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

Error that % cannot start token #34648

Closed
bortels opened this issue Jul 13, 2016 · 3 comments
Closed

Error that % cannot start token #34648

bortels opened this issue Jul 13, 2016 · 3 comments
Labels
Bug broken, incorrect, or confusing behavior Documentation Relates to Salt documentation help-wanted Community help is needed to resolve this P3 Priority 3 severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around
Milestone

Comments

@bortels
Copy link

bortels commented Jul 13, 2016

Description of Issue/Question

Using syntax from https://docs.saltstack.com/en/latest/ref/states/all/salt.states.ssh_auth.html triggers an error when you try to apply it. I have no idea if this is a bug in the code or the docs. :-)

Setup

[root@jabba login]# salt 'centos68-cis' state.apply login test=True
centos68-cis:
    Data failed to compile:
----------
    Rendering SLS 'base:login.hosting' failed: found character '%' that cannot start any token; line 5

---
tbortels:
  ssh_auth.present:
    - user: tbortels
    - source: salt://ssh_keys/tbortels.pub
    - config: %h/.ssh/authorized_keys    <======================
  user.present:
    - fullname: Tom Bortels
    - shell: /bin/sh
    - home: /home/tbortels
    - uid: 100758
[...]

---
ERROR: Minions returned with non-zero exit code

Versions Report

Salt Version:
           Salt: 2016.3.1

Dependency Versions:
           cffi: Not Installed
       cherrypy: Not Installed
       dateutil: Not Installed
          gitdb: Not Installed
      gitpython: Not Installed
          ioflo: Not Installed
         Jinja2: 2.7.2
        libgit2: Not Installed
        libnacl: Not Installed
       M2Crypto: Not Installed
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.4.6
   mysql-python: Not Installed
      pycparser: Not Installed
       pycrypto: 2.6.1
         pygit2: Not Installed
         Python: 2.7.5 (default, Nov 20 2015, 02:00:19)
   python-gnupg: Not Installed
         PyYAML: 3.11
          PyZMQ: 14.7.0
           RAET: Not Installed
          smmap: Not Installed
        timelib: Not Installed
        Tornado: 4.2.1
            ZMQ: 4.0.5

System Versions:
           dist: centos 7.2.1511 Core
        machine: x86_64
        release: 3.10.0-327.el7.x86_64
         system: Linux
        version: CentOS Linux 7.2.1511 Core
@zzzirk
Copy link

zzzirk commented Jul 17, 2016

I ran into this same issue today. I am guessing that the error has something to do with how YAML is handled or interpreted. I made the simple change of wrapping the %h/.ssh/authorized_keys in single quotes ('%h/.ssh/authorized_keys') and it worked brilliantly. The single quotes were the only change I made from the example both in the docs and that you've listed above.

@rallytime
Copy link
Contributor

@bortels and @zzzirk Yeah, the % notation there is a directive in the YAML processor. We should update the doc example to include the single quotes around the config value and a .. note:: on that page to explain that the single quotes are needed.

I think it would also be useful to add a section to the YAML Idiosyncracies docs about this finding.

@rallytime rallytime added Documentation Relates to Salt documentation Bug broken, incorrect, or confusing behavior severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around help-wanted Community help is needed to resolve this P3 Priority 3 labels Jul 18, 2016
@rallytime rallytime added this to the Approved milestone Jul 18, 2016
thatch45 added a commit to thatch45/salt that referenced this issue Jul 20, 2016
@thatch45 thatch45 mentioned this issue Jul 20, 2016
rallytime pushed a commit that referenced this issue Jul 20, 2016
@rallytime
Copy link
Contributor

Fixed with #34828

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug broken, incorrect, or confusing behavior Documentation Relates to Salt documentation help-wanted Community help is needed to resolve this P3 Priority 3 severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around
Projects
None yet
Development

No branches or pull requests

3 participants