mirror of https://github.com/sipwise/ngcpcfg.git
On a Carrier cluster setup the command 'ngcpcfg clean --all' can be executed on several nodes in parallel (e.g. using ngcp-parallel-ssh). Which can get stuck on the yes/no question if the operator forgot to use '--force'. In practice it causes 100% CPU usage after several days due to logs rotation (reason is not 100% clear). Strace for such case: > read(0, "", 1) = 0 > select(1, [0], NULL, [0], {tv_sec=0, tv_usec=0}) = 1 (in [0], left {tv_sec=0, tv_usec=0}) > rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0 > rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0 > ioctl(0, TCGETS, 0x7fff317e39a0) = -1 ENOTTY (Inappropriate ioctl for device) > lseek(0, 0, SEEK_CUR) = -1 ESPIPE (Illegal seek) > read(0, "", 1) = 0 > select(1, [0], NULL, [0], {tv_sec=0, tv_usec=0}) = 1 (in [0], left {tv_sec=0, tv_usec=0}) > rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0 > rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0 > ioctl(0, TCGETS, 0x7fff317e39a0) = -1 ENOTTY (Inappropriate ioctl for device) > lseek(0, 0, SEEK_CUR) = -1 ESPIPE (Illegal seek) > read(0, "", 1) = 0 > select(1, [0], NULL, [0], {tv_sec=0, tv_usec=0}) = 1 (in [0], left {tv_sec=0, tv_usec=0}) > rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0 > rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0 > ioctl(0, TCGETS, 0x7fff317e39a0) = -1 ENOTTY (Inappropriate ioctl for device) > lseek(0, 0, SEEK_CUR) = -1 ESPIPE (Illegal seek) > read(0, "", 1) = 0 > select(1, [0], NULL, [0], {tv_sec=0, tv_usec=0}) = 1 (in [0], left {tv_sec=0, tv_usec=0}) > rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0 > rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0 > ioctl(0, TCGETS, 0x7fff317e39a0) = -1 ENOTTY (Inappropriate ioctl for device) > lseek(0, 0, SEEK_CUR) = -1 ESPIPE (Illegal seek) > read(0, "", 1) = 0 > select(1, [0], NULL, [0], {tv_sec=0, tv_usec=0}) = 1 (in [0], left {tv_sec=0, tv_usec=0}) > rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0 > rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0 > ioctl(0, TCGETS, 0x7fff317e39a0) = -1 ENOTTY (Inappropriate ioctl for device) > lseek(0, 0, SEEK_CUR) = -1 ESPIPE (Illegal seek) > read(0, "", 1) = 0 > select(1, [0], NULL, [0], {tv_sec=0, tv_usec=0}) = 1 (in [0], left {tv_sec=0, tv_usec=0}) > rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0 > rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0 > ioctl(0, TCGETS, 0x7fff317e39a0) = -1 ENOTTY (Inappropriate ioctl for device) > lseek(0, 0, SEEK_CUR) = -1 ESPIPE (Illegal seek) > read(0, "", 1) = 0 The idea here is to check tty invocation and skip questions if no tty found. JFYI, there is no tty when running scripts under ngcp-parallel-ssh. Change-Id: Ia8ded3ada4d48ecb374f36859161645776381c31mr10.0
parent
45de0f4e8a
commit
567318c578
Loading…
Reference in new issue