Issue#352: Debug Report Section NOT Hidden for Non-root User

When a non-root user tries to request /debugreports, he will receive
an HTTP 403 error. In this situation, we should hide the section.

Signed-off-by: Hongliang Wang <hlwang@linux.vnet.ibm.com>
bug fix: instantiate the Yum manager when update the yum packages list

an instance just refresh packagekit once.

for example:
$ sudo PYTHONPATH=src python -c '
> from yum import YumBase
> YumBase().doPackageLists("updates")
> _yb = YumBase()
> _yb.doPackageLists("updates")
> _yb.doPackageLists("updates")
> '
Loaded plugins: langpacks, refresh-packagekit
Loaded plugins: langpacks, refresh-packagekit

you can seen the second _yb.doPackageLists will not refresh packagekit.

The apt manager may also has the same problem.
But not test it on ubuntu, will send a patch later after I have check.

Signed-off-by: Aline Manera <alinefm@br.ibm.com>
Signed-off-by: ShaoHe Feng <shaohef@linux.vnet.ibm.com>
partitions: Fix when disk does not have extended partition

Disk may just have primary partitions,
this makes getExtendedPartition return none and
throw exception when refer to extended partition path.
Fix this by check whether extended partition exists.

Signed-off-by: Royce Lv <lvroyce@linux.vnet.ibm.com>
Remove debug report's file path from UI

Now the file path displayed on UI is "/data/debugreports/<reportname>/",
It's misleading because people could assume it's path on file system,
but it's the uri path in fact. We don't need expose the URI path because
the download button can help user to get the file. So this patch removes
it from UI.  And this patch also renames debug report's 'file' attribute
to 'uri', because we use it to represent the download uri path.

Signed-off-by: Mark Wu <wudxw@linux.vnet.ibm.com>
make pyflakes happly, remove the unused import module

remove the unused import module.
make pyflakes happly before introduce pyflakes.

Signed-off-by: ShaoHe Feng <shaohef@linux.vnet.ibm.com>
Signed-off-by: Zhou Zheng Sheng <zhshzhou@linux.vnet.ibm.com>
make pyflakes happly, remove unused availables

remove unused availables
make pyflakes happly before introduce pyflakes.

1. the info is unused when start the vm, remove the statement.
2. the AsyncTask, we use it to create a task and run the task.
3. the Exception, we just catch it and do not use it.

Signed-off-by: ShaoHe Feng <shaohef@linux.vnet.ibm.com>
add template_delete to rollback after create a template

We know ModelTests will tear down the template datebase.
But it is better to delete the template explicitly.
In this way, the test case also can test the template_delete.

Also this can make pyflakes happy.

Signed-off-by: ShaoHe Feng <shaohef@linux.vnet.ibm.com>
Signed-off-by: Zhou Zheng Sheng <zhshzhou@linux.vnet.ibm.com>
run pyflakes when make check

Pyflakes analyzes programs and detects various errors. It works by
parsing the source file, not importing it, so it is safe to use on
modules with side effects. It's also much faster.

This is important to improve the code quality.

Signed-off-by: ShaoHe Feng <shaohef@linux.vnet.ibm.com>
Signed-off-by: Zhou Zheng Sheng <zhshzhou@linux.vnet.ibm.com>
Fix a typo.
Optimize return code check.

Instead of doing two comparisons, make just one and make this check
faster.
Show error message if debug report generation errors.

While generating a debug report in Kimchi, if this process fails while
it was executing (e.g. due to running out of disk space to generate the
report), the error message was not being shown correctly in the Kimchi
UI. Basically src/kimchi/control/tasks.py was putting the error message
in a JSON field called message, while the UI was looking for the error
message in a field called reason.
Merge branches 'typo' and 'optimize' into devel