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

import sys, os

argvlist=sys.argv
entrypath = os.path.abspath(argvlist[0])
entrydir = os.path.dirname(entrypath)
entrydir = entrydir.replace('\\','/')

SYSTYPE = "Windows"

"""配置dir路径"""
EXE_FILEPATH=entrydir

"""配置文件的目录和路径"""
CONFIG_DIR = entrydir+"/../cfg"
CONFIG_PATH = entrydir+"/../cfg/openstackclient.conf"

"""版本号路径"""
VERSION_PATH  = entrydir+"/../cfg/VERSION"

"""样式表文件"""
STYLE_PATH  = entrydir+"/openstackclient.qss"

#日志文件的路径
LOG_DIR = entrydir+"/../log"
LOG_PATH = entrydir+"/../log/record.log"

"""window程序的路径"""
WINDOW_CMD_NAME  = entrydir+"/../bin/window.exe"

"""window程序目录上层路径 """
WINDOW_UPPER_PATH = entrydir+"/../"

"""window程序的路径"""
USB_DIRVER_FILE_PATH  = entrydir+"/../sbin/usb/"

"""wget路径"""
WGET_PATH = entrydir+"/../sbin/wget.exe"

"""版本号文件路径"""
VERSION_FILE_PATH = entrydir+"/../cfg/VERSION"

"""CA_STORAGE_PATH"""
CA_STORAGE_PATH=entrydir+"/../cfg/ca_storage/"

"""CA_TEMP_PATH"""
CA_TEMP_PATH=entrydir+"/../cfg/smep/ca_temp.pem"

HOSTS_FILE = "/etc/hosts" #域名映射

UPGRADE_DIR = "/usr/massclouds/update/"

UPGRADE_CFG_NAME = "/usr/massclouds/vdi/client/cfg/upgrade.conf" #更新
UPDATE_INDEX_SERVER = "/usr/massclouds/update/update_index.xml"
UPDATE_INDEX_OLD = "/usr/massclouds/vdi/client/cfg/update_index.xml"
UPDATE_PAK_SERVER = "/usr/massclouds/update/upgrade.zip"
UPDATE_MD5_TEXT = "/usr/massclouds/update/md5.text"
TMEP_DIR = "/usr/massclouds/update/packet"
MASS_CLIENT_DIR = "/usr/massclouds/vdi/client/"

X86_DIR = ":21/cclient/x86/" #ftp链接
ARM_DIR = ":21/cclient/arm/"


CHECK_UPGRADE_TIME = 3600*6

CFG_DEFAULT_VM = 'defaultvm'

"""http请求头属性"""
headers = {
                'Host': 'identity.api.openstack.org',
                'Content-Type': 'application/json',
                'Accept': 'application/json',
                'Accept-Encoding': 'gzip, deflate',
                'Accept-Language': 'en-US,en;q=0.5',
                'Cookie': 'username=root; kimchiLang=zh_CN',
                'X-Requested-With': 'XMLHttpRequest',
                        }

"""认证失败返回的信息"""
authFailMsg = "Authentication required"

"""request请求的路径"""
GET_VMS_DETAIL_PATH = "http://%s:8774/v2/%s/servers/detail"
GET_FLAVORS_DETAIL_PATH = "http://%s:8774/v2/%s/flavors/detail"
GET_FLAVOR_DETAIL_PATH = "http://%s:8774/v2/%s/flavors/%s"
GET_IMAGES_DETAIL_PATH = "http://%s:8774/v2/%s/images/detail"
GET_TENANTS_PATH = "http://%s:5000/v2.0/tenants"
POST_VM_ACTION = "http://%s:8774/v2/%s/servers/%s/action"
GET_VM_DETAIL_PATH = "http://%s:8774/v2/%s/servers/%s"
GET_VM_PORT_INFO = "http://%s:8774/v2/%s/servers/%s/action"
GET_USER_LIST_INFO_PATH = "http://%s:35357/v2.0/users/%s"
GET_USER_INFO_PATH = "http://%s:35357/v2.0/users"


"""错误信息"""
OPEN_VM_FAILED = u"执行打开云主机操作失败！"
VM_START_FAILIED = "云主机启动失败！"


"""action操作前的提示信息"""
actionHintInfo = {
                        "shutDown": u"是否关闭云主机",
                        "reboot": u"是否重启云主机",
                        "poweroff": u"是否强制关闭云主机",
                        }

vmStatusMap = {
                        "SHUTOFF": u"关机",
                        "ACTIVE": u"正在运行",
                        "REBOOT": u"正在重启",
                    
                    }

"""桥接网络配置文件"""
netBridgeFile = "/etc/sysconfig/network-scripts/ifcfg-breth0"


