Debian Codegraph @

ansible_collections/theforeman/foreman/plugins/modules/content_import_library.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 DOCUMENTATION = '''
22 ---
23 module: content_import_library
24 version_added: 4.1.0
25 short_description: Manage library content imports
26 description:
27 - Import library content.
28 author:
29 - "Partha Aji (@parthaa)"
30 extends_documentation_fragment:
31 - theforeman.foreman.foreman
32 - theforeman.foreman.foreman.organization
33 - theforeman.foreman.foreman.katelloimport
34 '''
35
36 EXAMPLES = '''
37 - name: "Import library content from metadata"
38 theforeman.foreman.content_import_library:
39 path: "/var/lib/pulp/imports/example-content"
40 metadata: "{{ lookup('file', '/tmp/metadata.json') | from_json }}"
41 username: "admin"
42 password: "changeme"
43 server_url: "https://foreman.example.com"
44 organization: "Default Organization"
45
46 - name: "Import library content with specific metadata json"
47 theforeman.foreman.content_import_library:
48 path: "/var/lib/pulp/imports/example-content"
49 metadata_file: "/tmp/metadata.json"
50 username: "admin"
51 password: "changeme"
52 server_url: "https://foreman.example.com"
53 organization: "Default Organization"
54 destination_server: "airgapped.example.com"
55 fail_on_missing_content: true
56 '''
57
58 from ansible_collections.theforeman.foreman.plugins.module_utils.foreman_helper import KatelloContentImportBaseModule
59
60
61 class KatelloContentImportModule(KatelloContentImportBaseModule):
62 pass
63
64
65 def main():
66 module = KatelloContentImportModule(
67 import_action='library'
68 )
69
70 with module.api_connection():
71 module.run()
72
73
74 if __name__ == '__main__':
75 main()