#1 Assorted initial fixes
Merged 6 years ago by tflink. Opened 6 years ago by merlinm.
taskotron/ merlinm/task-standard-interface-shim fixes-1  into  master

file modified
+11 -4
@@ -54,17 +54,20 @@ 

      inventory_filename = os.path.join(workdir, name, 'inventory')

      if os.path.exists(inventory_filename):

          environment['ANSIBLE_INVENTORY'] = inventory_filename

+     else:

+         environment['ANSIBLE_INVENTORY'] = '/usr/share/ansible/inventory'

  

-     environment['TEST_SUBJECTS'] = ','.join(rpms['downloaded_rpms'])

+     environment['TEST_SUBJECTS'] = ' '.join(rpms['downloaded_rpms'])

      environment['TEST_ARTIFACTS'] = artifactsdir

  

-     environment['PATH'] = '$PATH:/usr/bin:/usr/local/bin'

+     environment['HOME'] = os.environ.get('HOME', '/')

+     environment['PATH'] = os.environ.get('PATH', '') + ':/usr/bin:/usr/local/bin'

  

      # create the command

      testdir = os.path.join(workdir, name)

-     command = ['ansible-playbook', 'tests.yml']

+     command = ['ansible-playbook', '-e', 'artifacts='+artifactsdir, '--tags', 'classic', 'tests.yml']

  

-     log.debug("sending environment: ", environment)

+     log.debug("sending environment: {}".format(environment))

  

  

      # execute the tests
@@ -72,9 +75,13 @@ 

      try:

          output, _ = os_utils.popen_rt(' '.join(command), shell=True, cwd=testdir, env=environment)

          returncode = 0

+         warnings = 0

+         errors = 0

      except subprocess.CalledProcessError as e:

          output = e.output

          returncode = e.returncode

+         warnings = 0

+         errors = 1

          outcome = 'FAILED'

  

          log.error("Command '{}' FAILED with exit code {}: ".format(' '.join(command), returncode, output))

Correct runtime NameError exception
Update to conform more closely to standard test interface playbook calling conventions
Fix environment setup and debug dumping

Pull-Request has been merged by tflink

6 years ago
Metadata