接手一坨缩进、格式乱七八糟的Nginx 配置，简直要命。想起golang 有一个gofmt，动手做一个简单的ngxfmt。Continue ->
Articles with the python tag
最近在一臺外網機器上起了salt minion ，但是同事發現
/etc/salt/minion_id 不對，之前自動生成的minion_id 都是機器的
hostname --all-fqdns 返回的結果相同。先查下minion_id 是怎麼生成的。
When the minion is started, it will generate an id value, unless it has been generated on a previous run and cached (in /etc/salt/minion_id by default). This is the name by which the minion will attempt to authenticate to the master. The following steps are attempted, in order to try to find a value that is not localhost:
- The Python function socket.getfqdn() is run
- /etc/hostname is checked (non-Windows only)
- /etc/hosts (%WINDIR%\system32\drivers\etc\hosts on Windows hosts) is checked for hostnames that map to anything within 127.0.0.0/8.
If none of the above are able to produce an id which is not localhost, then a sorted list of IP addresses on the minion (excluding any within 127.0.0.0/8) is inspected. The first publicly-routable IP address is used, if there is one. Otherwise, the first privately-routable IP address is used.
If all else fails, then localhost is used as a fallback.
hostname --all-fqdns 拿到的結果一樣。