Skip to content
This repository has been archived by the owner on Oct 30, 2018. It is now read-only.

pkgin: added check mode support, laid some groundwork for future `state=latest' support #298

Merged
merged 1 commit into from
Mar 10, 2015

Conversation

L2G
Copy link
Contributor

@L2G L2G commented Mar 6, 2015

I think this may be the first significant pull request I've made to any Python-based project, let alone Ansible. So please don't be shy about pointing out anything that violates Ansible or Python style.

Functionally, all this does is call pkgin -n (answer "no" to everything) when check mode is in effect, instead of pkgin -y. But I also tried to gussy up the messages in the output and to get the code prepared for adding in support for state=latest another time.

Please note the "Known bug" that I described in the documentation block. This is not a bug I introduced, it's something that apparently has always been there due to the way pkgin works. I raised the issue in the pkgin project (see NetBSDfr/pkgin#42).

module.fail_json(msg="failed to remove %s: %s" % (package, out))

remove_c += 1

if remove_c > 0:

module.exit_json(changed=True, msg="removed %s package(s)" % remove_c)
module.exit_json(changed=True, msg=format_action_message(module, "removed", remove_c))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why remove the information about # of packages?
never mind, it gets formatted in external function now

@bcoca
Copy link
Member

bcoca commented Mar 10, 2015

changes look good, could you squash the commits?

@L2G
Copy link
Contributor Author

L2G commented Mar 10, 2015

@bcoca Sure thing.

* Add support for check mode
* Use "pkgin search" to guarantee 0 or 1 result
* Edit documentation for style, new feature, etc.
* General refactoring
* Lay some groundwork for future support of "state=latest"
bcoca added a commit that referenced this pull request Mar 10, 2015
pkgin: added check mode support, laid some groundwork for future `state=latest' support
@bcoca bcoca merged commit 016a778 into ansible:devel Mar 10, 2015
@L2G L2G deleted the smartos-pkgin branch March 11, 2015 01:17
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants