zoukankan      html  css  js  c++  java
  • saltstack--关于报错“UnicodeDecodeError: 'ascii' codec can't decode byte 0xe6 in position 6: ordinal not in range(128)”

    [root@linux-node1 桌面]# salt-key
    [ERROR ] 'ascii' codec can't decode byte 0xe6 in position 6: ordinal not in range(128)
    Traceback (most recent call last):
    File "/usr/lib/python2.7/site-packages/salt/utils/parsers.py", line 210, in parse_args
    process_option_func()
    File "/usr/lib/python2.7/site-packages/salt/utils/parsers.py", line 386, in process_saltfile
    saltfile = os.path.join(os.getcwd(), 'Saltfile')
    File "/usr/lib64/python2.7/posixpath.py", line 80, in join
    path += '/' + b
    UnicodeDecodeError: 'ascii' codec can't decode byte 0xe6 in position 6: ordinal not in range(128)
    Usage: salt-key [options]
    
    salt-key: error: Error while processing <bound method SaltKey.process_saltfile of <salt.cli.key.SaltKey object at 0x7f4734a5ae50>>: Traceback (most recent call last):
    File "/usr/lib/python2.7/site-packages/salt/utils/parsers.py", line 210, in parse_args
    process_option_func()
    File "/usr/lib/python2.7/site-packages/salt/utils/parsers.py", line 386, in process_saltfile
    saltfile = os.path.join(os.getcwd(), 'Saltfile')
    File "/usr/lib64/python2.7/posixpath.py", line 80, in join
    path += '/' + b
    UnicodeDecodeError: 'ascii' codec can't decode byte 0xe6 in position 6: ordinal not in range(128)

    SaltStack管理工具允许管理员对多个操作系统创建一个一致的管理系统,包括VMware vSphere环境。

    在安装saltstack的过程中,执行到 salt-key(在master中查看所有key的状态)的时候,遇到上述报错。

      1. 在python的安装路径下找到     Libmimetypes.py文件

      2. 在导包下面加入以下代码,将编码格式改成gbk

        

    # -*- coding: utf-8 -*-


    if
    sys.getdefaultencoding() != 'gbk': reload(sys) sys.setdefaultencoding('gbk')

    就是这样

  • 相关阅读:
    git pull遇到错误:error: Your local changes to the following files would be overwritten by merge:
    angular 过滤器(日期转换,时间转换,数据转换等)
    js 毫秒转天时分秒
    使用Vue-Router 2实现路由功能
    vue-cli中安装方法
    Vue 2.5 发布了:15篇前端热文回看
    es6 语法 (模块化)
    es6 语法 (Decorator)
    es6 语法 (Generator)
    js 判断当前是什么浏览器
  • 原文地址:https://www.cnblogs.com/lutt/p/11253487.html
Copyright © 2011-2022 走看看