python常见的报错
Posted cjw1219
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python常见的报错相关的知识,希望对你有一定的参考价值。
pip3 安装salt报错
pip3 install salt
安装python36-devel 问题解决
yum install python3.6-devel
saltstack 执行命令出错
Minion did not return. [No response]
查看minion的日志
root@salt-minion: ~ # tail -f /var/log/salt/minion
The master public key can be found at:
/etc/salt/pki/minion/minion_master.pub
2019-08-23 03:01:05,340 [salt.crypt ][ERROR ][22697] The master key has changed, the salt master could have been subverted, verify salt master's public key
2019-08-23 03:01:05,341 [salt.crypt ][CRITICAL][22697] The Salt Master server's public key did not authenticate!
删除公钥并重启minion
root@salt-minion: ~ # cat /etc/salt/pki/minion/minion_master.pub
-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzZ0JW14Ddso9t14i7Q9e
xnw5E/q8AAFQm9oi5ON0Q3wcnVabp8qrkM6iwf7yIelBrz9HWkys8e5PVnX80Tr9
/uhRX7JwXxHTUfVqwTaBvSF+ShNKWrB8IFl4ZER4bn6V9BtTty1UsE6t/nh4iSPO
uW1UWsgv0BNpTOj6o1cQSQnUdBEIH0mYYQPCBwY/0avqbpB7NblZH5PLfe3a7bG1
N+jrbjla5Wo0KOICrD6qJlp/5cUsq5YnGKMnDtwgP0oQ9lSr8rP4qWpWnhIkjI69
n3/yAjmCehnK+7SZBaxrqhRPRT/muphpwmqhmVtQSjLjNXoKjBHCC5+UAiveLdmC
/QIDAQAB
-----END PUBLIC KEY-----
root@salt-minion: ~ # rm -rf /etc/salt/pki/minion/minion_master.pub
root@salt-minion: ~ # systemctl restart salt-minion
master端可以正常和minion通信
root@salt-master: ~ # salt 'slave1' cmd.run 'ip a'
slave1:
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 00:0c:29:2e:48:02 brd ff:ff:ff:ff:ff:ff
inet 172.16.240.130/24 brd 172.16.240.255 scope global noprefixroute ens33
valid_lft forever preferred_lft forever
inet6 fe80::bc7e:e9f9:591c:208d/64 scope link noprefixroute
valid_lft forever preferred_lft forever
Django ORM
mysql.W002
System check identified some issues:
WARNINGS:
?: (mysql.W002) MySQL Strict Mode is not set for database connection 'default'
HINT: MySQL's Strict Mode fixes many data integrity problems in MySQL, such as data truncation upon insertion, by escalating warnings into errors. It is strongly recommended you activate it. See: https://docs.djangoproject.com/en/1.11/ref/databases/#mysql-sql-mode
解决: 在setting.py中添加选项
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'cmdb1',
'HOST': '127.0.0.1',
'USER': 'root',
'PASSWORD': '123',
'PORT': 3306,
'CHARSET': 'utf8',
'OPTIONS': {
"init_command": "SET default_storage_engine='INNODB'"
}
}
}
DATABASES['default']['OPTIONS']['init_command'] = "SET sql_mode='STRICT_TRANS_TABLES'"
以上是关于python常见的报错的主要内容,如果未能解决你的问题,请参考以下文章