Remove warnings of import statements of module util.misc

* sys is useless
* hashlib, sqlite are duplicated
* avoid to import * of error and fs_related

Change-Id: I926a906939f4f8f12acab6707df992a06f74061b
Remove import warnings of imager.fs module

* sys and subprocess are useless
* avoid to import * from utils.fs_related
* import baseimager in absolute way

Change-Id: I44c970402f06da32a576c68d4650dd7dd010fa1c
Remove import warnings of utils.runner module

Avoid to import * from subprocess

Change-Id: Ib41c3a8716694d8acddf925b500fc89334a6e6f4
Fix bug that "disk" is undefined.

Change-Id: I35f43b560c8e2176d8baa9cc873c4994b0105b27
utils.fs_related: fix undefined 'out'

Change-Id: I78737c26c3fc9ed3acbd8ed71b51f40e17191bda
Signed-off-by: Gui Chen <gui.chen@intel.com>
imager.loop: fix undefined 'part'

Change-Id: Ibf16cf33ece80a6d0d400978dd8d3f6d949b8da0
Signed-off-by: Gui Chen <gui.chen@intel.com>
imager.livecd: cleanup anaconda related code

Change-Id: I6539572adf9cd03d2b524db7f76f3bcfa7ba46df
Signed-off-by: Gui Chen <gui.chen@intel.com>
Fix bad indentations.

Change-Id: I6a1b15a130576c87a85db864ec3997b7c3005f05
Give reason when failed to load plugin module.

It will be helpful to solve problems.

Change-Id: I02f36706c67cfb9fedc9029ea5a177aa85c2ac61
Keep error info from exception URLGrabError.

The origianl URLGrabError exception contains useful information
describing detail of the error, such as errno and http error
code.

However in some situation it doesn't include url address. So append
it if not appear.

Examples of console output before:
    Error <creator>: URLGrabber error: https://xxxx
    Error <creator>: URLGrabber error: https://xxxx

We can't find out difference from those two message.
After:
    Error <creator>: [Errno 14] HTTP Error 401 : https://xxxx
    Error <creator>: [Errno 14] problem making ssl connection on https://xxxx

Change-Id: I3f153e4caf8bbfcbac56ca22118733de7c5a3e66
Fix import error of kickstart.custom_commands

Names listed in __all__ don't exist.

>>> from mic.kickstart.custom_commands import *
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'Mic_Desktop'

Change-Id: Ie9ea1cccacb5fb9faaabc1951c513425c377d549
be compatible with python-zypp built with swig 2.0

differences in python-zypp between swig 1.3 and swig 2.0 built
make the original code not work, this patch trys to fix this
compatiblity issue

Change-Id: Ie0a16182463886e9cf89f6fa1c63756e4d50c02d
Signed-off-by: Gui Chen <gui.chen@intel.com>
Merge branch 'release-0.17' into devel
Uniform import statements to absolute import.

Change all relative imports into absolute since mixing them is bad.
Refer PEP8 for more details.

Change-Id: I39fdbe056cb0d76c5ed5812c4f69e74ce8837924
Refactor get_mic_binpath() to avoid catch all exceptions.

Catch the specific exceptions it cares about, and reduce "try"
block to minimal, otherwise some other errors will be hidden.

Change-Id: Icbef03eef1591ba44466d5634943db5b8c86bdc4
Reraise exception in bootstrap_mic() but keep original traceback.

When exception occurs, we could add additional information but
should keep the original traceback. Otherwise traceback shows up
in console will be the second one, which hide the true exception.

A bare "raise" statement is a special syntax to reraise the
original exception, which will also keep its traceback.

Please Refer PEP3134 for more details.

Change-Id: I420399061de89b911cecd5da60fde0023f1893ac
Refactor function safecopy().

* Change ignore_ptns from [] to (). A mutable default value isn't
as expected when invoke in the second time.
>>> def safecopy(ignore_ptns=[]):
...     ignore_ptns += ['*.pyc']
...     print ignore_ptns
...
>>> safecopy()
['*.pyc']
>>> safecopy()
['*.pyc', '*.pyc']

* Add a list into ignore_ptns rather than a string
>>> l = []
>>> l += os.path.basename('/usr/bin')
>>> l
['b', 'i', 'n']

* Include all exception classes by (), otherwise it will catch
OSError and assign this exception instance to a local variable
named IOError.
* Move shutil.ignore_patterns() out of try block since it can
never throw OSError nor IOError.
* Remove useless try/except/raise block which catches every
error but reraise it. It's the same as without this try block.

Change-Id: I8837169bbf4acbadf4a2cfd8ac999d371831d86a
Fix an issue with building the man page

If the python-docutils package is available in a distro, then make sure
a BuildRequires is added for it.

Change-Id: Ic404fe4ed94bd40aa63139bec3c12b1bcdd59640
Change default parameters from mutable type into immutable.

Get ride of these pylint warnings:

W0102:190,0:cleanup_chrootenv: Dangerous default value [] as argument
W0102: 47,4:ImagerPlugin.check_image_exists: Dangerous default value [] as argument
W0102:109,8:read_kickstart.KSHandlers.__init__: Dangerous default value {} as argument
W0102:708,0:get_repos: Dangerous default value {} as argument
W0102:772,0:get_attachment: Dangerous default value [] as argument
W0102:775,0:get_pre_packages: Dangerous default value [] as argument
W0102:778,0:get_packages: Dangerous default value [] as argument
W0102:781,0:get_groups: Dangerous default value [] as argument
W0102:784,0:get_excluded: Dangerous default value [] as argument
W0102:787,0:get_partitions: Dangerous default value [] as argument
W0102:877,4:BaseImageCreator.install: Dangerous default value {} as argument
W0102:210,4:Bootstrap.create: Dangerous default value [] as argument

Change-Id: Icc04896829ecfb0e2542f4d4755f4adb07b01319
Change default mutable arguments of Mic_RepoData.__init__.

Only pass arguments includepkgs, excludepkgs, baseurl,
mirrorlist, name to super __init__ if they are not false.
If they are not present the super __init__ will choose proper
default values for those arguments.

W0102: 26,4:Mic_RepoData.__init__: Dangerous default value [] as argument
W0102: 26,4:Mic_RepoData.__init__: Dangerous default value [] as argument

Change-Id: I56db875ee3d42213726a147a46f9d2e998025cce