Debian Codegraph @

ansible_collections/theforeman/foreman/plugins/modules/content_import_version.py

raw symbols SCIP
1 #!/usr/bin/python
2 # -*- coding: utf-8 -*-
3 # (c) 2024, Partha Aji
4 #
5 # This program is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation, either version 3 of the License, or
8 # (at your option) any later version.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
17
18 from __future__ import absolute_import, division, print_function
19 __metaclass__ = type
20
21
22 DOCUMENTATION = '''
23 ---
24 module: content_import_version
25 version_added: 4.1.0
26 short_description: Manage content view version content imports
27 description:
28 - Import a content view version.
29 author:
30 - "Partha Aji (@parthaa)"
31 extends_documentation_fragment:
32 - theforeman.foreman.foreman
33 - theforeman.foreman.foreman.organization
34 - theforeman.foreman.foreman.katelloimport
35 '''
36
37 EXAMPLES = '''
38 - name: "Import content view version from metadata"
39 theforeman.foreman.content_import_version:
40 path: "/var/lib/pulp/imports/example-content"
41 metadata: "{{ lookup('file', '/tmp/metadata.json') | from_json }}"
42 username: "admin"
43 password: "changeme"
44 server_url: "https://foreman.example.com"
45 organization: "Default Organization"
46
47 - name: "Import content view version with specific metadata json"
48 theforeman.foreman.content_import_version:
49 path: "/var/lib/pulp/imports/example-content"
50 metadata_file: "/tmp/metadata.json"
51 username: "admin"
52 password: "changeme"
53 server_url: "https://foreman.example.com"
54 organization: "Default Organization"
55 '''
56
57 from ansible_collections.theforeman.foreman.plugins.module_utils.foreman_helper import KatelloContentImportBaseModule
58
59
60 class KatelloContentImportModule(KatelloContentImportBaseModule):
61 pass
62
63
64 def main():
65 module = KatelloContentImportModule(
66 import_action='version',
67 )
68
69 with module.api_connection():
70 module.run()
71
72
73 if __name__ == '__main__':
74 main()