Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
sdm.oor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
sdm-nextcloud
sdm.oor
Commits
1fc032ca
Commit
1fc032ca
authored
3 years ago
by
Pietsch, Martin
Browse files
Options
Downloads
Patches
Plain Diff
added action plugin
parent
a23a1d2b
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
CHANGELOG.rst
+9
-0
9 additions, 0 deletions
CHANGELOG.rst
changelogs/changelog.yaml
+5
-0
5 additions, 0 deletions
changelogs/changelog.yaml
galaxy.yml
+2
-2
2 additions, 2 deletions
galaxy.yml
plugins/action/dump_role_vars.py
+88
-0
88 additions, 0 deletions
plugins/action/dump_role_vars.py
with
104 additions
and
2 deletions
CHANGELOG.rst
+
9
−
0
View file @
1fc032ca
...
...
@@ -12,3 +12,12 @@ Major Changes
- added strategy plugins `sdmfree` and `sdmhost_pinned`
- added callback plugin `sdmdefault`
v1.1.0
======
Minor Changes
-------------
- added action plugin `dump_role_vars`
This diff is collapsed.
Click to expand it.
changelogs/changelog.yaml
+
5
−
0
View file @
1fc032ca
...
...
@@ -6,3 +6,8 @@ releases:
-
added strategy plugins `sdmfree` and `sdmhost_pinned`
-
added callback plugin `sdmdefault`
release_date
:
'
2021-03-08'
1.1.0
:
changes
:
minor_changes
:
-
added action plugin `dump_role_vars`
release_date
:
'
2021-06-01'
This diff is collapsed.
Click to expand it.
galaxy.yml
+
2
−
2
View file @
1fc032ca
...
...
@@ -4,9 +4,9 @@ name: oor
description
:
plugins for object oriented roles
readme
:
README.md
repository
:
https://gitlab.mn.tu-dresden.de/sdm/sdm.oor.git
documentation
:
https://sdm.mn.tu-dresden.de/references/collections/sdm.
common
/
documentation
:
https://sdm.mn.tu-dresden.de/references/collections/sdm.
oor
/
homepage
:
https://sdm.mn.tu-dresden.de
version
:
1.
0
.0
version
:
1.
1
.0
authors
:
-
Martin Pietsch <martin.pietsch@tu-dresden.de>
-
Robin Richter <robin.richter@mailbox.tu-dresden.de>
...
...
This diff is collapsed.
Click to expand it.
plugins/action/dump_role_vars.py
0 → 100644
+
88
−
0
View file @
1fc032ca
# (c) 2021,Technische Universität Dresden, School of Science, Martin Pietsch <martin.pietsch@tu-dresden.de>
#
# This file is part of SDM Framework
#
# This plugin is free software: You can redistribute this file and/or modify
# file 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.
#
# The plugin 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 SDM framework. If not, see <http://www.gnu.org/licenses/>.
from
__future__
import
(
absolute_import
,
division
,
print_function
)
__metaclass__
=
type
DOCUMENTATION
=
'''
---
action: dump_role_vars
short_description: dump variables of the current role
license: GPL-3 license
authors:
- Martin Pietsch (martin.pietsch@tu-dresden.de)
description:
- This module dumps the variables of a role.
- It is part of the object-oriented [role concept](/userguides/sdm/roles/oor) of the SDM framework.
version_added:
"
2.10
"
options:
type:
description:
- Specifies the variable type of the current role which variables should dumped.
type: string
choices: [
"
vars
"
,
"
defaults
"
,
"
all
"
]
default:
"
all
"
'''
EXAMPLES
=
'''
- name:
"
dump all variables of the current role
"
sdm.oor.dump_role_vars:
- name:
"
dump default variables of the current role
"
sdm.oor.dump_role_vars:
type:
"
defaults
"
- name:
"
dump variables of the current role
"
sdm.oor.dump_role_vars:
type:
"
vars
"
'''
from
ansible.errors
import
AnsibleError
from
ansible.plugins.action
import
ActionBase
from
ansible.module_utils._text
import
to_text
from
pprint
import
pformat
try
:
from
ansible.plugins.callback.sdmoor
import
SDMRole
,
SDMTaskInclude
,
SDMIncludeRole
except
:
from
ansible_collections.sdm.oor.plugins.callback.sdmoor
import
SDMRole
,
SDMTaskInclude
,
SDMIncludeRole
class
ActionModule
(
ActionBase
):
_VALID_ARGS
=
frozenset
([
'
type
'
])
def
run
(
self
,
tmp
=
None
,
task_vars
=
None
):
if
self
.
_task
.
_role
is
None
or
not
isinstance
(
self
.
_task
.
_role
,
SDMRole
):
raise
AnsibleError
(
"
This action can only used inside a SDM role!
"
)
retval
=
super
(
ActionModule
,
self
).
run
(
tmp
,
task_vars
)
varstype
=
self
.
_task
.
args
.
get
(
'
type
'
,
'
all
'
)
allvars
=
dict
()
if
varstype
==
"
vars
"
or
varstype
==
"
all
"
:
allvars
.
update
(
dict
({
"
vars
"
:
self
.
_task
.
_role
.
_role_vars
}))
if
varstype
==
"
defaults
"
or
varstype
==
"
all
"
:
allvars
.
update
(
dict
({
"
defaults
"
:
self
.
_task
.
_role
.
_default_vars
}))
retval
[
to_text
(
type
(
allvars
))]
=
allvars
retval
[
'
failed
'
]
=
False
retval
[
'
_ansible_verbose_always
'
]
=
True
return
retval
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment