Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1.0 backport: Add helper modules/scripts to know where ARA is
The location where ARA is installed is hard to predict because it will depend on the operating system, python2 vs python3 or the usage of virtualenvs, for example. That's why we have this rather convenient snippet: python -c "import os,ara; print(os.path.dirname(ara.__file__))" This snippet is now further reduced to: python -m ara.setup.path But there is also many other variants such as: - python -m ara.setup.path - python -m ara.setup.callback_plugins - python -m ara.setup.action_plugins - python -m ara.setup.library - python -m ara.setup.env - python -m ara.setup.ansible These can also be imported as such: from ara.setup import path from ara.setup import callback_plugins [...] This might be expanded upon later but let's stop at this for now. Change-Id: Ibf1eb495ea0df2f6d8589abeb2220b6e93afdea9 (cherry picked from commit f1e4b5d)
- Loading branch information
David Moreau Simard
committed
Apr 7, 2018
1 parent
b030fb0
commit 001ed74
Showing
12 changed files
with
253 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
This directory contains scripts meant to help configuring ARA with Ansible. | ||
|
||
For more information, visit the documentation_. | ||
|
||
.. _documentation: http://ara.readthedocs.io/en/latest/configuration.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Copyright (c) 2017 Red Hat, Inc. | ||
# | ||
# This file is part of ARA: Ansible Run Analysis. | ||
# | ||
# ARA is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# ARA is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with ARA. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
import os | ||
|
||
# The path where ARA is installed (parent directory) | ||
path = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) | ||
|
||
action_plugins = os.path.abspath(os.path.join(path, 'plugins/actions')) | ||
callback_plugins = os.path.abspath(os.path.join(path, 'plugins/callbacks')) | ||
library = os.path.abspath(os.path.join(path, 'plugins/modules')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Copyright (c) 2017 Red Hat, Inc. | ||
# | ||
# This file is part of ARA: Ansible Run Analysis. | ||
# | ||
# ARA is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# ARA is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with ARA. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
from __future__ import print_function | ||
from . import action_plugins | ||
|
||
if __name__ == "__main__": | ||
print(action_plugins) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Copyright (c) 2017 Red Hat, Inc. | ||
# | ||
# This file is part of ARA: Ansible Run Analysis. | ||
# | ||
# ARA is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# ARA is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with ARA. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
from __future__ import print_function | ||
from . import callback_plugins, action_plugins, library | ||
|
||
config = """ | ||
[defaults] | ||
callback_plugins={} | ||
action_plugins={} | ||
library={} | ||
""".format(callback_plugins, action_plugins, library) | ||
|
||
if __name__ == "__main__": | ||
print(config.strip()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Copyright (c) 2017 Red Hat, Inc. | ||
# | ||
# This file is part of ARA: Ansible Run Analysis. | ||
# | ||
# ARA is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# ARA is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with ARA. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
from __future__ import print_function | ||
from . import callback_plugins | ||
|
||
if __name__ == "__main__": | ||
print(callback_plugins) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Copyright (c) 2017 Red Hat, Inc. | ||
# | ||
# This file is part of ARA: Ansible Run Analysis. | ||
# | ||
# ARA is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# ARA is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with ARA. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
from __future__ import print_function | ||
from . import callback_plugins, action_plugins, library | ||
|
||
exports = """ | ||
export ANSIBLE_CALLBACK_PLUGINS={} | ||
export ANSIBLE_ACTION_PLUGINS={} | ||
export ANSIBLE_LIBRARY={} | ||
""".format(callback_plugins, action_plugins, library) | ||
|
||
if __name__ == "__main__": | ||
print(exports.strip()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Copyright (c) 2017 Red Hat, Inc. | ||
# | ||
# This file is part of ARA: Ansible Run Analysis. | ||
# | ||
# ARA is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# ARA is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with ARA. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
from __future__ import print_function | ||
from . import library | ||
|
||
if __name__ == "__main__": | ||
print(library) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Copyright (c) 2017 Red Hat, Inc. | ||
# | ||
# This file is part of ARA: Ansible Run Analysis. | ||
# | ||
# ARA is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# ARA is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with ARA. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
from __future__ import print_function | ||
from . import path | ||
|
||
if __name__ == "__main__": | ||
print(path) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Copyright (c) 2017 Red Hat, Inc. | ||
# | ||
# This file is part of ARA: Ansible Run Analysis. | ||
# | ||
# ARA is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# ARA is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with ARA. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
from ara.tests.unit.common import TestAra | ||
|
||
|
||
class TestSetup(TestAra): | ||
""" Tests the utils module """ | ||
def setUp(self): | ||
super(TestSetup, self).setUp() | ||
|
||
def tearDown(self): | ||
super(TestSetup, self).tearDown() | ||
|
||
# TODO: Add tests :D |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters