Skip to content

Commit

Permalink
Merge pull request #5333 from mvermaes/yum_fix
Browse files Browse the repository at this point in the history
yum module: Attempt #2 to cause yum to fail on invalid url
  • Loading branch information
jctanner committed Jan 20, 2014
2 parents 7b76ad9 + c55d144 commit 297a28a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion library/packaging/yum
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,11 @@ def install(module, items, repoq, yum_basecmd, conf_file, en_repos, dis_repos):

rc, out, err = module.run_command(cmd)

if (rc != 0 and 'Nothing to do' in err) or 'Nothing to do' in out:
# Fail on invalid urls:
if (rc == 1 and '://' in spec and ('No package %s available.' % spec in out or 'Cannot open: %s. Skipping.' % spec in err)):
err = 'Package at %s could not be installed' % spec
module.fail_json(changed=False,msg=err,rc=1)
elif (rc != 0 and 'Nothing to do' in err) or 'Nothing to do' in out:
# avoid failing in the 'Nothing To Do' case
# this may happen with an URL spec.
# for an already installed group,
Expand Down

0 comments on commit 297a28a

Please sign in to comment.