Remove several CR chars in log messages

When msger functions are called in an environment where the TTY supports
color, and the log messages begin with a carriage return (CR), then
message headers are formatted differently than they would be without the
CR.

For msger Info messages, it looks like:

  \033[2K\033[32m\rInfo:\033[0m

and is interpreted as:

  1. Clear the entire line
  2. Change color code to 32
  3. Print "\rInfo:"
  4. Reset color code

This logic makes sense for messages that begin with a CR but do not end
with a newline, since TTYs on Linux will expect either a '\n' or a
'\r\n' combination. However, I don't see a situation where MIC needs to
log messages with the leading CR.

To avoid the above logic, remove the CR characters from existing log
messages so that newlines are always added when the messages are
printed.

Change-Id: Ib98ad1a7217033aeb1644098fea5b907d4f4729d
make customized setting of plugin_dir work in bootstrap mode

copy plugin_dir into bootstrap in bootstrap mode
Change "Warning: Failed to load plugin" to verbose info

 Fixes: #1191.

Change-Id: If0fede7c1fec739a29d81ff02f5b6b4816fad78a
Ensure MIC works well when "/etc/mic/mic.conf" does not exist

when "/etc/mic/mic.conf" does not exist, ensure MIC works in
native mode, and when requring bootstrap mode, MIC switches to
native mode to work,because bootstrap mode needs the existence
of "/etc/mic/mic.conf".

Fixes: #1196

Change-Id: Idf16cbb4da7748665f466eb3f2045a853821915e
Confirm user from pwd.getpwuid to avoid compress failure

In case mic compresses the image by tarfile module,it might fail
by pwd.getpwuid blocking; to avoid this,mic takes a comfirm for
user id from pwd.getpwuid after comfirming root permission.

Fixes: #1207

Change-Id: Iaa6a886936d5d6d60ba3b21608fa81d9f4c1a238
Fix native and bootstrap mode switch automatically

Fixes: #1242
MIC should not fallback to native mode if bootstrap package can not be found

Change-Id: Ia682572aaaf9e028ea8e15f2d8082d0b6f1a781c
clear output like 'close failed in file object'

Change-Id: I0b07b0dd708fd163ba37863ec550f94d06190903
Fixes: #1192
Add mic bash tab completion support

Change-Id: I6374f93b456ae4789ea79e6eaede8485dd6562dd
Signed-off-by: Xiaoning Zhu <xiaoning.zhu@intel.com>
fix redundant whitespace in logging info

Change-Id: I7e8103e802dcf7c473ec45681f075108a48597ca
avoid IndexError for loopdev assigning

when 'losetup -f' returns '' output,
out.split()[0] will raise IndexError

Fixes: #1094
Change-Id: Iad310d70defc3c8a83c221951f0d3f8e6dc5a8a6
Signed-off-by: Gui Chen <gui.chen@intel.com>
drop VERSION file, use __version__ directly in mic module

Change-Id: I0f0ea1a93d8bbc924f5853c0d161c286251eb670
Signed-off-by: Gui Chen <gui.chen@intel.com>
update Makefile

update handling of TAGVER
drop bz2 compress
add new target 'release' to track taring release tag

Change-Id: Ief896cec98a5b36c96d7a481db88fa720d7c1c1c
Signed-off-by: Gui Chen <gui.chen@intel.com>
better handling for installing config file in virtualenv

in this handling, mic will check 'real_prefix' which is
not existed in real python env but in virtualenv to
determine the config file location

Change-Id: Iaa67ba1d78395470bc20dd7682c29ec4c933fd56
Signed-off-by: Gui Chen <gui.chen@intel.com>
setup.py: correct project url

Change-Id: I037b517cb7b6ac89bd07f98150c8bc9bc97337c9
Signed-off-by: Gui Chen <gui.chen@intel.com>
prefer to use 'pbzip2'/'pgzip' than 'bzip2'/'gzip'

Fixes: #1281

Change-Id: I72c996fde9689c7c684848dade4add8b76b00b07
Signed-off-by: Gui Chen <gui.chen@intel.com>
fix typo

Change-Id: I4380c6076233079869b4563d93f5619cc54a990c
Signed-off-by: Gui Chen <gui.chen@intel.com>
Add mic zsh tab completion support

Fixes: #1187

Change-Id: I6a668990556431c5df8304a830a12943cef975a0
use sync mode in kpartx command

see kpartx man page:
-s sync mode. Don't return until the partitions are created
this should be the wanted option for current kpartx use

Change-Id: I99ba7d6413a54e9845c5a9f0654bef4d434e9c52
Signed-off-by: Gui Chen <gui.chen@intel.com>
tools/mic: rename variable

Get ride of these pylint warnings:
C: 82,8:MicCmd.help_create: Invalid name "cr" for type variable (should match [a-z_][a-z0-9_]{2,30}$)
C:220,8: Invalid name "mic" for type constant (should match (([A-Z_][A-Z0-9_]*)|(__.*__))$)
C:227,20: Invalid name "e" for type variable (should match [a-z_][a-z0-9_]{2,30}$)

Change-Id: Ic5cf5de9ca253a2725d7dcff0ecb9aba84eaf587
raw.py: remove unused variable

Change-Id: Ic704651421e50958c2b4977081c1ddb1096ccdf4
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@intel.com>