Skip to content
This repository has been archived by the owner on Mar 24, 2022. It is now read-only.

Environ.setenv return unicode #188

Open
xiaoxiaojushi-ivan opened this issue Apr 1, 2019 · 0 comments
Open

Environ.setenv return unicode #188

xiaoxiaojushi-ivan opened this issue Apr 1, 2019 · 0 comments

Comments

@xiaoxiaojushi-ivan
Copy link

xiaoxiaojushi-ivan commented Apr 1, 2019

cat Set_ENV.sls
set_env:
  environ.setenv:
    - name: matter
    - value: {{pillar['env']}}
    - update_minion: True
curl -sSk https://salt-api:8000 \
     -H 'Content-type: application/json; charset=UTF-8' \
     -H 'Accept: application/x-yaml' \
     -H "X-Auth-Token: 48ed68a256a9f5a25ef078f8efce58ca" \
     -d '[{
          "client": "local",
          "tgt": "127.1.33.193",
          "fun": "state.sls",
          "tgt_type": "list",
          "arg": "Set_ENV",
          "kwarg": {"saltenv":"prod","pillar":{"env":{"PROFILE":"prod"}}}
      }]'
return:
- 127.1.33.193:
    environ_|-set_env_|-matter_|-setenv:
      __id__: set_env
      __run_num__: 0
      __sls__: Set_ENV
      changes:
         PROFILE: u'prod'
      comment: Environ values were set
      duration: 0.412
      name: matter
      result: true
      start_time: '03:44:51.501446'
salt-api -V
Salt Version:
           Salt: 2018.3.0
 
Dependency Versions:
           cffi: 1.9.1
       cherrypy: 3.2.2
       dateutil: 2.1
      docker-py: 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: 1.2.5
      pycparser: 2.17
       pycrypto: 2.6.1
   pycryptodome: Not Installed
         pygit2: Not Installed
         Python: 2.7.10 (default, Aug 11 2015, 23:39:10)
   python-gnupg: Not Installed
         PyYAML: 3.10
          PyZMQ: 14.5.0
           RAET: Not Installed
          smmap: Not Installed
        timelib: Not Installed
        Tornado: 4.2.1
            ZMQ: 4.0.5
 
System Versions:
           dist:   
         locale: UTF-8
        machine: x86_64
        release: 4.1.10-17.31.amzn1.x86_64
         system: Linux
        version: Not Installed

Execute the state.sls file through the salt-api interface. Environ.setenv sets the environment variable and the value is unicode. How to solve it?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant