Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ansible
Commits
871f0378
Commit
871f0378
authored
May 23, 2014
by
James Cammarata
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #7085 from danieljaouen/brew
Add `upgrade_all` option to homebrew module.
parents
33053615
37fff3dc
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
4 deletions
+42
-4
library/packaging/homebrew
+42
-4
No files found.
library/packaging/homebrew
View file @
871f0378
...
...
@@ -44,6 +44,12 @@ options:
required
:
false
default
:
"no"
choices
:
[
"yes"
,
"no"
]
upgrade_all
:
description
:
-
upgrade
all
homebrew
packages
required
:
false
default
:
no
choices
:
[
"yes"
,
"no"
]
install_options
:
description
:
-
options
flags
to
install
a
package
...
...
@@ -56,7 +62,7 @@ EXAMPLES = '''
-
homebrew
:
name
=
foo
state
=
present
-
homebrew
:
name
=
foo
state
=
present
update_homebrew
=
yes
-
homebrew
:
name
=
foo
state
=
latest
update_homebrew
=
yes
-
homebrew
:
update_homebrew
=
yes
upgrade
=
yes
-
homebrew
:
update_homebrew
=
yes
upgrade
_all
=
yes
-
homebrew
:
name
=
foo
state
=
head
-
homebrew
:
name
=
foo
state
=
linked
-
homebrew
:
name
=
foo
state
=
absent
...
...
@@ -289,12 +295,14 @@ class Homebrew(object):
# /class properties -------------------------------------------- }}}
def
__init__
(
self
,
module
,
path
=
None
,
packages
=
None
,
state
=
None
,
update_homebrew
=
False
,
install_options
=
None
)
:
update_homebrew
=
False
,
upgrade_all
=
False
,
install_options
=
None
)
:
if
not
install_options
:
install_options
=
list
()
self
.
_setup_status_vars
()
self
.
_setup_instance_vars
(
module
=
module
,
path
=
path
,
packages
=
packages
,
state
=
state
,
update_homebrew
=
update_homebrew
,
upgrade_all
=
upgrade_all
,
install_options
=
install_options
,
)
self
.
_prep
()
...
...
@@ -418,6 +426,9 @@ class Homebrew(object):
if
self
.
update_homebrew
:
self
.
_update_homebrew
()
if
self
.
upgrade_all
:
self
.
_upgrade_all
()
if
self
.
packages
:
if
self
.
state
==
'
installed
'
:
return
self
.
_install_packages
()
...
...
@@ -458,6 +469,27 @@ class Homebrew(object):
raise
HomebrewException
(
self
.
message
)
# /updated ------------------------------- }}}
# _upgrade_all --------------------------- {{{
def
_upgrade_all
(
self
)
:
rc
,
out
,
err
=
self
.
module
.
run_command
([
self
.
brew_path
,
'
upgrade
'
,
])
if
rc
==
0
:
if
not
out
:
self
.
message
=
'
Homebrew
packages
already
upgraded
.
'
else
:
self
.
changed
=
True
self
.
message
=
'
Homebrew
upgraded
.
'
return
True
else
:
self
.
failed
=
True
self
.
message
=
err
.
strip
()
raise
HomebrewException
(
self
.
message
)
# /_upgrade_all -------------------------- }}}
# installed ------------------------------ {{{
def
_install_current_package
(
self
)
:
if
not
self
.
valid_package
(
self
.
current_package
)
:
...
...
@@ -741,6 +773,11 @@ def main():
aliases
=
[
"update-brew"
],
type
=
'
bool
'
,
),
upgrade_all
=
dict
(
default
=
"no"
,
aliases
=
[
"upgrade"
],
type
=
'
bool
'
,
),
install_options
=
dict
(
default
=
None
,
aliases
=
[
'
options
'
],
...
...
@@ -765,7 +802,7 @@ def main():
state
=
p
[
'
state
'
]
if
state
in
(
'
present
'
,
'
installed
'
)
:
state
=
'
installed
'
if
state
in
(
'
head
'
)
:
if
state
in
(
'
head
'
,
)
:
state
=
'
head
'
if
state
in
(
'
latest
'
,
'
upgraded
'
)
:
state
=
'
upgraded
'
...
...
@@ -777,13 +814,14 @@ def main():
state
=
'
absent
'
update_homebrew
=
p
[
'
update_homebrew
'
]
upgrade_all
=
p
[
'
upgrade_all
'
]
p
[
'
install_options
'
]
=
p
[
'
install_options
'
]
or
[]
install_options
=
[
'
--
{
0
}
'
.
format
(
install_option
)
for
install_option
in
p
[
'
install_options
'
]]
brew
=
Homebrew
(
module
=
module
,
path
=
path
,
packages
=
packages
,
state
=
state
,
update_homebrew
=
update_homebrew
,
install_options
=
install_options
)
upgrade_all
=
upgrade_all
,
install_options
=
install_options
)
(
failed
,
changed
,
message
)
=
brew
.
run
()
if
failed
:
module
.
fail_json
(
msg
=
message
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment