Refactor get_logs()

Sometimes, 'tar' returns exit code 1, because some files in the
/var/log/ were changed during the archiving.

To avoid this error, let's copy /var/log/ to another place first.

Other changes:

- extend the collected information from the nodes
(inspired by the fuel snapshots from Nailgun)

- allow get_logs() to execute also when rep_setup.failed is set
  (when any fixture failed)

Change-Id: I59caeb9df42639df53d439866c26bac8ba59e696
diff --git a/tcp_tests/fixtures/salt_fixtures.py b/tcp_tests/fixtures/salt_fixtures.py
index 58c8509..9bd24b3 100644
--- a/tcp_tests/fixtures/salt_fixtures.py
+++ b/tcp_tests/fixtures/salt_fixtures.py
@@ -35,7 +35,7 @@
 @pytest.mark.revert_snapshot(ext.SNAPSHOT.salt_deployed)
 @pytest.fixture(scope='function')
 def salt_deployed(revert_snapshot, request, config,
-                  hardware, underlay, salt_actions, grab_versions, snapshot):
+                  hardware, underlay, salt_actions, snapshot, grab_versions):
     """Fixture to get or install salt service on environment
 
     :param revert_snapshot: fixture that reverts snapshot that is specified
diff --git a/tcp_tests/fixtures/underlay_fixtures.py b/tcp_tests/fixtures/underlay_fixtures.py
index 7502df2..d991548 100644
--- a/tcp_tests/fixtures/underlay_fixtures.py
+++ b/tcp_tests/fixtures/underlay_fixtures.py
@@ -211,10 +211,17 @@
     grab_version = request.keywords.get('grab_versions', None)
 
     def test_fin():
-        if hasattr(request.node, 'rep_call') and \
-                (request.node.rep_call.passed or request.node.rep_call.failed)\
-                and grab_version:
+        fixture_failed = (hasattr(request.node, 'rep_setup') and
+                          request.node.rep_setup.failed)
+        test_passed = (hasattr(request.node, 'rep_call') and
+                       request.node.rep_call.passed)
+        test_failed = (hasattr(request.node, 'rep_call') and
+                       request.node.rep_call.failed)
+
+        if fixture_failed or test_passed or test_failed:
             artifact_name = utils.extract_name_from_mark(grab_version) or \
                 "{}".format(func_name)
             underlay.get_logs(artifact_name)
-    request.addfinalizer(test_fin)
+
+    if grab_version:
+        request.addfinalizer(test_fin)