mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 09:23:56 +00:00
parent
61e05c0f4b
commit
b2cf293ee4
@ -11,6 +11,8 @@ import logging
|
|||||||
import urlparse
|
import urlparse
|
||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
import time
|
import time
|
||||||
|
import codecs
|
||||||
|
import chardet
|
||||||
|
|
||||||
# import third party libs
|
# import third party libs
|
||||||
import yaml
|
import yaml
|
||||||
@ -1780,6 +1782,9 @@ def get_id(root_dir=None, minion_id=False, cache=True):
|
|||||||
try:
|
try:
|
||||||
with salt.utils.fopen(id_cache) as idf:
|
with salt.utils.fopen(id_cache) as idf:
|
||||||
name = idf.read().strip()
|
name = idf.read().strip()
|
||||||
|
utf_8_name = name.decode(chardet.detect(name)['encoding']).encode('utf-8')
|
||||||
|
if utf_8_name.startswith(codecs.BOM_UTF8): # Remove BOM if exists
|
||||||
|
name = utf_8_name.replace(codecs.BOM_UTF8, '', 1)
|
||||||
if name:
|
if name:
|
||||||
log.info('Using cached minion ID from {0}: {1}'
|
log.info('Using cached minion ID from {0}: {1}'
|
||||||
.format(id_cache, name))
|
.format(id_cache, name))
|
||||||
|
Loading…
Reference in New Issue
Block a user