Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch for #10 and fixed changed boolean for unchanged "present" state #11

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion conda.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ def _check_installed(module, conda, name):
version = None

data = json.loads(stdout)
if data:
if data and type(data[0]) is str:
# At this point data will be a list of len 1, with the element of
# the format: "channel::package-version-py35_1"
line = data[0]
Expand All @@ -142,6 +142,11 @@ def _check_installed(module, conda, name):
if pname == name: # verify match for safety
installed = True
version = pversion
elif data and type(data[0]) is dict:
# conda 4.3 now returns a dictionary
if data[0]['name'] == name:
installed = True
version = data[0]['version']

return installed, version

Expand Down Expand Up @@ -206,6 +211,9 @@ def _install_package(
if rc != 0:
module.fail_json(msg='failed to install package ' + name)

if 'requested packages already installed' in stdout:
module.exit_json(changed=False, name=name)

module.exit_json(
changed=True, name=name, version=version, stdout=stdout, stderr=stderr)

Expand Down