From b9d07def2564a55c87f1523cf7e9641812de88fd Mon Sep 17 00:00:00 2001 From: Alexander Lutay Date: Fri, 18 Sep 2015 14:05:07 +0200 Subject: [PATCH] MT#15261 Allow using symbolic links for YML files At the moment it is impossible to use symbolic links for YML files. The following error happens: > root@spce:/etc/ngcp-config# ngcpcfg apply > Error: Encoding check of /etc/ngcp-config/config.spce.yml fails: neither ASCII nor UTF-8. > Error: Please convert /etc/ngcp-config/config.spce.yml to UTF-8. > > NOTE: > * Check encoding via: > # file /etc/ngcp-config/config.spce.yml > * To convert ISO-8859/latin1 to UTF-8 execute: > # iconv -f latin1 -t utf8 < /etc/ngcp-config/config.spce.yml > /etc/ngcp-config/config.spce.yml.tmp \ > && mv /etc/ngcp-config/config.spce.yml.tmp /etc/ngcp-config/config.spce.yml As a result the following usecase ('node-type' specific file) failed: > >>> ls -la /etc/ngcp-config/* > total 72 > drwxr-xr-x 2 root root 4096 Sep 18 13:57 . > drwxr-xr-x 6 root root 4096 Sep 16 23:34 .. > lrwxrwxrwx 1 root root 15 Sep 18 13:57 config.db01a.yml -> ./config.db.yml > lrwxrwxrwx 1 root root 15 Sep 18 13:57 config.db01b.yml -> ./config.db.yml > -rw-r--r-- 1 root root 224 Sep 18 12:43 config.db.yml > -rw-r--r-- 1 root root 250 Sep 18 12:34 config.lb.yml > -rw-r--r-- 1 root root 146 Sep 18 12:44 config.mgmt.yml > -rw-r--r-- 1 root root 251 Sep 18 13:56 config.proxy.yml > lrwxrwxrwx 1 root root 18 Sep 18 13:57 config.prx01a.yml -> ./config.proxy.yml > lrwxrwxrwx 1 root root 18 Sep 18 13:57 config.prx01b.yml -> ./config.proxy.yml > lrwxrwxrwx 1 root root 18 Sep 18 13:57 config.prx02a.yml -> ./config.proxy.yml > lrwxrwxrwx 1 root root 18 Sep 18 13:57 config.prx02b.yml -> ./config.proxy.yml > lrwxrwxrwx 1 root root 18 Sep 18 13:57 config.prx03a.yml -> ./config.proxy.yml > lrwxrwxrwx 1 root root 18 Sep 18 13:57 config.prx03b.yml -> ./config.proxy.yml > lrwxrwxrwx 1 root root 18 Sep 18 13:57 config.prx04a.yml -> ./config.proxy.yml > lrwxrwxrwx 1 root root 18 Sep 18 13:57 config.prx04b.yml -> ./config.proxy.yml > lrwxrwxrwx 1 root root 18 Sep 18 13:57 config.prx05a.yml -> ./config.proxy.yml > lrwxrwxrwx 1 root root 18 Sep 18 13:57 config.prx05b.yml -> ./config.proxy.yml > lrwxrwxrwx 1 root root 15 Sep 18 13:57 config.slb01a.yml -> ./config.lb.yml > lrwxrwxrwx 1 root root 15 Sep 18 13:57 config.slb01b.yml -> ./config.lb.yml > lrwxrwxrwx 1 root root 17 Sep 18 13:57 config.web01a.yml -> ./config.mgmt.yml > lrwxrwxrwx 1 root root 17 Sep 18 13:57 config.web01b.yml -> ./config.mgmt.yml > -rw-r--r-- 1 root root 13051 Sep 18 12:54 config.yml > -rw-r--r-- 1 root root 4633 Sep 15 16:13 constants.yml > -rw-r--r-- 1 root root 16534 Sep 15 16:09 network.yml > >>> cat config.lb.yml > --- > checktools: > collcheck: > loadlong: 2 > loadmedium: 2 > loadshort: 3 > heartbeat: > pingnodes: > - 1.1.1.1 > - 2.2.2.2 Change-Id: I43045d08c715d17612617c29cf1ed04cf13e650b --- scripts/check | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/check b/scripts/check index ccee78a8..3573458b 100755 --- a/scripts/check +++ b/scripts/check @@ -19,7 +19,7 @@ fi check_config_encoding() { log_debug "Checking encoding for $config_files" for f in $config_files ; do - if [ -r "$f" ] && ! file "$f" | grep -qe "UTF-8" -qe "ASCII" ; then + if [ -r "$f" ] && ! file -L "$f" | grep -qe "UTF-8" -qe "ASCII" ; then log_error "Encoding check of ${f} fails: neither ASCII nor UTF-8." log_error "Please convert ${f} to UTF-8." log_info