- hosts: all
  tasks:
    - shell:
        cmd: |
          if [ -f Modulefile -o -f metadata.json ]; then
            if [ -f Modulefile ]; then
              MODULE=$(awk '/^name/ {print $NF}' Modulefile |tr -d \"\')
            elif [ -f metadata.json ]; then
              MODULE=$(python -c 'import json;print json.load(open("metadata.json"))["name"]')
            fi
            if [ -z "$MODULE" ]; then
              echo "Module name not defined in Modulefile or metadata.json"
            else
              mkdir -p "$MODULE"
              rsync -a --exclude="$MODULE" --exclude ".*" . "$MODULE"
              cd "$MODULE"
            fi
          fi
          mkdir .bundled_gems
          export GEM_HOME=`pwd`/.bundled_gems
          if [ -f Gemfile ]; then
            gem install bundler --no-rdoc --no-ri --verbose
            $GEM_HOME/bin/bundle install --without system_tests
            $GEM_HOME/bin/bundle exec rake lint 2>&1
          else
            gem install rake -n ./.bundled_gems/
            gem install puppet-lint
            gem install puppetlabs_spec_helper
            ./.bundled_gems/rake lint 2>&1
          fi
        chdir: '{{ ansible_user_dir }}/workspace'
      environment: '{{ zuul | zuul_legacy_vars }}'

- hosts: all
  tasks:
    - shell:
        cmd: |
          if [ -f Modulefile -o -f metadata.json ]; then
            if [ -f Modulefile ]; then
              MODULE=$(awk '/^name/ {print $NF}' Modulefile |tr -d \"\')
            elif [ -f metadata.json ]; then
              MODULE=$(python -c 'import json;print json.load(open("metadata.json"))["name"]')
            fi
            if [ -z "$MODULE" ]; then
              echo "Module name not defined in Modulefile or metadata.json"
            else
              mkdir -p "$MODULE"
              rsync -a --exclude="$MODULE" --exclude ".*" . "$MODULE"
              cd "$MODULE"
            fi
          fi
          mkdir .bundled_gems
          export GEM_HOME=`pwd`/.bundled_gems
          if [ -f Gemfile ]; then
            gem install bundler --no-rdoc --no-ri --verbose
            $GEM_HOME/bin/bundle install --without system_tests --retry 3
            $GEM_HOME/bin/bundle exec rake lint 2>&1
          else
            gem install rake -n ./.bundled_gems/
            gem install puppet-lint
            gem install puppetlabs_spec_helper
            ./.bundled_gems/rake lint 2>&1
          fi
        chdir: '{{ ansible_user_dir }}/workspace'
      environment: '{{ zuul | zuul_legacy_vars }}'

Add 3 retries when the installation fails for lint test
Add 3 retries when the installation fails for lint test

Change-Id: I9ae31a3934d10eb37509f9889381377cef94df0a
