mirror of
https://github.com/kubevirt/kubevirt.core.git
synced 2026-03-27 03:13:10 +00:00
@@ -7,7 +7,7 @@
|
||||
</div>
|
||||
<hr/>
|
||||
<div role="contentinfo">
|
||||
<p>© Copyright 2023 Red Hat, Inc.</p>
|
||||
<p>© Copyright 2024 Red Hat, Inc.</p>
|
||||
</div>
|
||||
Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a
|
||||
<a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Kubevirt Ansible Collection documentation index</title>
|
||||
<title>KubeVirt Ansible Collection documentation index</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<link rel="stylesheet" href="https://ansible-middleware.github.io/amq/main/_static/pygments.css" type="text/css" />
|
||||
@@ -19,7 +19,7 @@
|
||||
<nav data-toggle="wy-nav-shift" class="wy-nav-side">
|
||||
<div class="wy-side-scroll">
|
||||
<div class="wy-side-nav-search" >
|
||||
<a href="#" class="icon icon-home"> Kubevirt Ansible Collection</a>
|
||||
<a href="#" class="icon icon-home"> KubeVirt Ansible Collection</a>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
@@ -29,7 +29,7 @@
|
||||
<div role="navigation" aria-label="Page navigation">
|
||||
<ul class="wy-breadcrumbs">
|
||||
<li><a href="#" class="icon icon-home"></a> »</li>
|
||||
<li>Welcome to Kubevirt Collection documentation</li>
|
||||
<li>Welcome to KubeVirt Collection documentation</li>
|
||||
<li class="wy-breadcrumbs-aside"></li>
|
||||
</ul>
|
||||
<hr/>
|
||||
@@ -37,7 +37,7 @@
|
||||
<div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
|
||||
<div itemprop="articleBody">
|
||||
<section id="welcome-to-amq-collection-documentation">
|
||||
<h1>Welcome to Kubevirt Collection documentation<a class="headerlink" href="#welcome-to-amq-collection-documentation" title="Permalink to this headline"></a></h1>
|
||||
<h1>Welcome to KubeVirt Collection documentation<a class="headerlink" href="#welcome-to-amq-collection-documentation" title="Permalink to this headline"></a></h1>
|
||||
<div class="toctree-wrapper compound">
|
||||
<p class="caption" role="heading"><span class="caption-text">Pick collection version:</span></p>
|
||||
<ul>
|
||||
|
||||
79
docs/conf.py
79
docs/conf.py
@@ -15,19 +15,20 @@
|
||||
import datetime
|
||||
import os
|
||||
import sys
|
||||
sys.path.insert(0, os.path.abspath('../plugins/module_utils/'))
|
||||
|
||||
sys.path.insert(0, os.path.abspath("../plugins/module_utils/"))
|
||||
# sys.path.insert(0, os.path.abspath('.'))
|
||||
|
||||
# -- Project information -----------------------------------------------------
|
||||
|
||||
project = 'Kubevirt Ansible Collection'
|
||||
copyright = '{y} Red Hat, Inc.'.format(y=datetime.date.today().year)
|
||||
author = 'Red Hat, Inc.'
|
||||
project = "KubeVirt Ansible Collection"
|
||||
copyright = "{y} Red Hat, Inc.".format(y=datetime.date.today().year)
|
||||
author = "Red Hat, Inc."
|
||||
|
||||
# The short X.Y version
|
||||
version = ''
|
||||
version = ""
|
||||
# The full version, including alpha/beta/rc tags
|
||||
release = ''
|
||||
release = ""
|
||||
|
||||
|
||||
# -- General configuration ---------------------------------------------------
|
||||
@@ -40,24 +41,24 @@ release = ''
|
||||
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
|
||||
# ones.
|
||||
extensions = [
|
||||
'myst_parser',
|
||||
'sphinx.ext.autodoc',
|
||||
'sphinx.ext.intersphinx',
|
||||
'sphinx_antsibull_ext',
|
||||
'ansible_basic_sphinx_ext',
|
||||
"myst_parser",
|
||||
"sphinx.ext.autodoc",
|
||||
"sphinx.ext.intersphinx",
|
||||
"sphinx_antsibull_ext",
|
||||
"ansible_basic_sphinx_ext",
|
||||
]
|
||||
|
||||
# Add any paths that contain templates here, relative to this directory.
|
||||
templates_path = ['_templates']
|
||||
templates_path = ["_templates"]
|
||||
|
||||
# The suffix(es) of source filenames.
|
||||
# You can specify multiple suffix as a list of string:
|
||||
#
|
||||
# source_suffix = ['.rst', '.md']
|
||||
source_suffix = ['.rst', '.md']
|
||||
source_suffix = [".rst", ".md"]
|
||||
|
||||
# The master toctree document.
|
||||
master_doc = 'index'
|
||||
master_doc = "index"
|
||||
|
||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||
# for a list of supported languages.
|
||||
@@ -69,20 +70,20 @@ language = None
|
||||
# List of patterns, relative to source directory, that match files and
|
||||
# directories to ignore when looking for source files.
|
||||
# This pattern also affects html_static_path and html_extra_path .
|
||||
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store', '.tmp']
|
||||
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store", ".tmp"]
|
||||
|
||||
# The name of the Pygments (syntax highlighting) style to use.
|
||||
pygments_style = 'ansible'
|
||||
pygments_style = "ansible"
|
||||
|
||||
highlight_language = 'YAML+Jinja'
|
||||
highlight_language = "YAML+Jinja"
|
||||
|
||||
# -- Options for HTML output -------------------------------------------------
|
||||
html_theme_path = ['_themes']
|
||||
html_theme_path = ["_themes"]
|
||||
# The theme to use for HTML and HTML Help pages. See the documentation for
|
||||
# a list of builtin themes.
|
||||
#
|
||||
# html_theme = 'alabaster'
|
||||
html_theme = 'sphinx_rtd_theme'
|
||||
html_theme = "sphinx_rtd_theme"
|
||||
|
||||
# Theme options are theme-specific and customize the look and feel of a theme
|
||||
# further. For a list of options available for each theme, see the
|
||||
@@ -109,7 +110,7 @@ html_static_path = []
|
||||
# -- Options for HTMLHelp output ---------------------------------------------
|
||||
|
||||
# Output file base name for HTML help builder.
|
||||
htmlhelp_basename = 'KubevirtCollectionDoc'
|
||||
htmlhelp_basename = "KubeVirtCollectionDoc"
|
||||
|
||||
|
||||
# -- Options for LaTeX output ------------------------------------------------
|
||||
@@ -118,15 +119,12 @@ latex_elements = {
|
||||
# The paper size ('letterpaper' or 'a4paper').
|
||||
#
|
||||
# 'papersize': 'letterpaper',
|
||||
|
||||
# The font size ('10pt', '11pt' or '12pt').
|
||||
#
|
||||
# 'pointsize': '10pt',
|
||||
|
||||
# Additional stuff for the LaTeX preamble.
|
||||
#
|
||||
# 'preamble': '',
|
||||
|
||||
# Latex figure (float) alignment
|
||||
#
|
||||
# 'figure_align': 'htbp',
|
||||
@@ -136,8 +134,13 @@ latex_elements = {
|
||||
# (source start file, target name, title,
|
||||
# author, documentclass [howto, manual, or own class]).
|
||||
latex_documents = [
|
||||
(master_doc, 'KubevirtCollection.tex', 'Red Hat Kubevirt Ansible Collection Documentation',
|
||||
'Red Hat, Inc.', 'manual'),
|
||||
(
|
||||
master_doc,
|
||||
"KubeVirtCollection.tex",
|
||||
"Red Hat KubeVirt Ansible Collection Documentation",
|
||||
"Red Hat, Inc.",
|
||||
"manual",
|
||||
),
|
||||
]
|
||||
|
||||
|
||||
@@ -146,8 +149,13 @@ latex_documents = [
|
||||
# One entry per manual page. List of tuples
|
||||
# (source start file, name, description, authors, manual section).
|
||||
man_pages = [
|
||||
(master_doc, 'KubevirtCollection', 'Red Hat Kubevirt Ansible Collection Documentation',
|
||||
[author], 1)
|
||||
(
|
||||
master_doc,
|
||||
"KubeVirtCollection",
|
||||
"Red Hat KubeVirt Ansible Collection Documentation",
|
||||
[author],
|
||||
1,
|
||||
)
|
||||
]
|
||||
|
||||
|
||||
@@ -157,9 +165,15 @@ man_pages = [
|
||||
# (source start file, target name, title, author,
|
||||
# dir menu entry, description, category)
|
||||
texinfo_documents = [
|
||||
(master_doc, 'KubevirtCollection', 'Red Hat Kubevirt Ansible Collection Documentation',
|
||||
author, 'KubevirtCollection', 'One line description of project.',
|
||||
'Miscellaneous'),
|
||||
(
|
||||
master_doc,
|
||||
"KubeVirtCollection",
|
||||
"Red Hat KubeVirt Ansible Collection Documentation",
|
||||
author,
|
||||
"KubeVirtCollection",
|
||||
"One line description of project.",
|
||||
"Miscellaneous",
|
||||
),
|
||||
]
|
||||
|
||||
|
||||
@@ -168,4 +182,7 @@ texinfo_documents = [
|
||||
# -- Options for intersphinx extension ---------------------------------------
|
||||
|
||||
# Example configuration for intersphinx: refer to the Python standard library.
|
||||
intersphinx_mapping = {'python': ('https://docs.python.org/2', None), 'ansible': ('https://docs.ansible.com/ansible/latest/', None)}
|
||||
intersphinx_mapping = {
|
||||
"python": ("https://docs.python.org/2", None),
|
||||
"ansible": ("https://docs.ansible.com/ansible/latest/", None),
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ from ansible_collections.kubevirt.core.tests.unit.utils.ansible_module_mock impo
|
||||
exit_json,
|
||||
fail_json,
|
||||
set_module_args,
|
||||
get_api_client
|
||||
get_api_client,
|
||||
)
|
||||
|
||||
FIXTURE1 = {
|
||||
@@ -28,24 +28,15 @@ FIXTURE1 = {
|
||||
"metadata": {
|
||||
"name": "testvm",
|
||||
"namespace": "default",
|
||||
"labels": {
|
||||
"environment": "staging",
|
||||
"service": "loadbalancer"
|
||||
}
|
||||
"labels": {"environment": "staging", "service": "loadbalancer"},
|
||||
},
|
||||
"spec": {
|
||||
"running": True,
|
||||
"instancetype": {
|
||||
"name": "u1.medium"
|
||||
},
|
||||
"preference": {
|
||||
"name": "fedora"
|
||||
},
|
||||
"instancetype": {"name": "u1.medium"},
|
||||
"preference": {"name": "fedora"},
|
||||
"dataVolumeTemplates": [
|
||||
{
|
||||
"metadata": {
|
||||
"name": "testdv"
|
||||
},
|
||||
"metadata": {"name": "testdv"},
|
||||
"spec": {
|
||||
"source": {
|
||||
"registry": {
|
||||
@@ -53,36 +44,22 @@ FIXTURE1 = {
|
||||
},
|
||||
},
|
||||
"storage": {
|
||||
"accessModes": [
|
||||
"ReadWriteOnce"
|
||||
],
|
||||
"resources": {
|
||||
"requests": {
|
||||
"storage": "5Gi"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
"accessModes": ["ReadWriteOnce"],
|
||||
"resources": {"requests": {"storage": "5Gi"}},
|
||||
},
|
||||
},
|
||||
}
|
||||
],
|
||||
"template": {
|
||||
"metadata": {
|
||||
"labels": {
|
||||
"environment": "staging",
|
||||
"service": "loadbalancer"
|
||||
}
|
||||
"labels": {"environment": "staging", "service": "loadbalancer"}
|
||||
},
|
||||
"spec": {
|
||||
"domain": {
|
||||
"devices": {}
|
||||
},
|
||||
"terminationGracePeriodSeconds": 180
|
||||
}
|
||||
}
|
||||
}
|
||||
"spec": {"domain": {"devices": {}}, "terminationGracePeriodSeconds": 180},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
METADATA = '''apiVersion: kubevirt.io/v1
|
||||
METADATA = """apiVersion: kubevirt.io/v1
|
||||
kind: VirtualMachine
|
||||
metadata:
|
||||
name: "testvm"
|
||||
@@ -118,78 +95,70 @@ spec:
|
||||
domain:
|
||||
devices: {}
|
||||
terminationGracePeriodSeconds: 180
|
||||
'''
|
||||
"""
|
||||
|
||||
FIXTURE2 = {
|
||||
'name': 'testvm',
|
||||
'namespace': 'default',
|
||||
'state': 'present',
|
||||
'labels': {
|
||||
'service': 'loadbalancer',
|
||||
'environment': 'staging'
|
||||
},
|
||||
'instancetype': {
|
||||
'name': 'u1.medium'
|
||||
},
|
||||
'preference': {
|
||||
'name': 'fedora'
|
||||
},
|
||||
'data_volume_templates': [
|
||||
"name": "testvm",
|
||||
"namespace": "default",
|
||||
"state": "present",
|
||||
"labels": {"service": "loadbalancer", "environment": "staging"},
|
||||
"instancetype": {"name": "u1.medium"},
|
||||
"preference": {"name": "fedora"},
|
||||
"data_volume_templates": [
|
||||
{
|
||||
'metadata': {
|
||||
'name': 'testdv'
|
||||
},
|
||||
'spec': {
|
||||
'source': {
|
||||
'registry': {
|
||||
'url': 'docker://quay.io/containerdisks/fedora:latest'
|
||||
"metadata": {"name": "testdv"},
|
||||
"spec": {
|
||||
"source": {
|
||||
"registry": {
|
||||
"url": "docker://quay.io/containerdisks/fedora:latest"
|
||||
},
|
||||
},
|
||||
'storage': {
|
||||
'accessModes': [
|
||||
'ReadWriteOnce'
|
||||
],
|
||||
'resources': {
|
||||
'requests': {
|
||||
'storage': '5Gi'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
"storage": {
|
||||
"accessModes": ["ReadWriteOnce"],
|
||||
"resources": {"requests": {"storage": "5Gi"}},
|
||||
},
|
||||
},
|
||||
}
|
||||
],
|
||||
'spec': {
|
||||
'domain': {
|
||||
'devices': {}
|
||||
},
|
||||
'terminationGracePeriodSeconds': 180
|
||||
},
|
||||
'api_version': 'kubevirt.io/v1', 'running': True, 'wait': False, 'wait_sleep': 5, 'wait_timeout': 120, 'force': False,
|
||||
'generate_name': None, 'annotations': None, 'kubeconfig': None, 'context': None, 'host': None, 'api_key': None,
|
||||
'username': None, 'password': None, 'validate_certs': None, 'ca_cert': None, 'client_cert': None, 'client_key': None,
|
||||
'proxy': None, 'no_proxy': None, 'proxy_headers': None, 'persist_config': None, 'impersonate_user': None,
|
||||
'impersonate_groups': None, 'delete_options': None,
|
||||
'resource_definition': METADATA,
|
||||
'wait_condition': {
|
||||
'type': 'Ready',
|
||||
'status': True
|
||||
}
|
||||
"spec": {"domain": {"devices": {}}, "terminationGracePeriodSeconds": 180},
|
||||
"api_version": "kubevirt.io/v1",
|
||||
"running": True,
|
||||
"wait": False,
|
||||
"wait_sleep": 5,
|
||||
"wait_timeout": 120,
|
||||
"force": False,
|
||||
"generate_name": None,
|
||||
"annotations": None,
|
||||
"kubeconfig": None,
|
||||
"context": None,
|
||||
"host": None,
|
||||
"api_key": None,
|
||||
"username": None,
|
||||
"password": None,
|
||||
"validate_certs": None,
|
||||
"ca_cert": None,
|
||||
"client_cert": None,
|
||||
"client_key": None,
|
||||
"proxy": None,
|
||||
"no_proxy": None,
|
||||
"proxy_headers": None,
|
||||
"persist_config": None,
|
||||
"impersonate_user": None,
|
||||
"impersonate_groups": None,
|
||||
"delete_options": None,
|
||||
"resource_definition": METADATA,
|
||||
"wait_condition": {"type": "Ready", "status": True},
|
||||
}
|
||||
|
||||
|
||||
class TestCreateVM(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.mock_module_helper = patch.multiple(
|
||||
basic.AnsibleModule,
|
||||
exit_json=exit_json,
|
||||
fail_json=fail_json
|
||||
basic.AnsibleModule, exit_json=exit_json, fail_json=fail_json
|
||||
)
|
||||
self.mock_module_helper.start()
|
||||
|
||||
self.mock_runner = patch.multiple(
|
||||
runner,
|
||||
get_api_client=get_api_client
|
||||
)
|
||||
self.mock_runner = patch.multiple(runner, get_api_client=get_api_client)
|
||||
self.mock_runner.start()
|
||||
|
||||
# Stop the patch after test execution
|
||||
@@ -208,56 +177,37 @@ class TestCreateVM(unittest.TestCase):
|
||||
"name": "testvm",
|
||||
"namespace": "default",
|
||||
"state": "present",
|
||||
"labels": {
|
||||
"service": "loadbalancer",
|
||||
"environment": "staging"
|
||||
},
|
||||
'instancetype': {
|
||||
'name': 'u1.medium'
|
||||
},
|
||||
'preference': {
|
||||
'name': 'fedora'
|
||||
},
|
||||
'data_volume_templates': [
|
||||
"labels": {"service": "loadbalancer", "environment": "staging"},
|
||||
"instancetype": {"name": "u1.medium"},
|
||||
"preference": {"name": "fedora"},
|
||||
"data_volume_templates": [
|
||||
{
|
||||
'metadata': {
|
||||
'name': 'testdv'
|
||||
},
|
||||
'spec': {
|
||||
'source': {
|
||||
'registry': {
|
||||
'url': 'docker://quay.io/containerdisks/fedora:latest'
|
||||
"metadata": {"name": "testdv"},
|
||||
"spec": {
|
||||
"source": {
|
||||
"registry": {
|
||||
"url": "docker://quay.io/containerdisks/fedora:latest"
|
||||
},
|
||||
},
|
||||
'storage': {
|
||||
'accessModes': [
|
||||
'ReadWriteOnce'
|
||||
],
|
||||
'resources': {
|
||||
'requests': {
|
||||
'storage': '5Gi'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
"storage": {
|
||||
"accessModes": ["ReadWriteOnce"],
|
||||
"resources": {"requests": {"storage": "5Gi"}},
|
||||
},
|
||||
},
|
||||
}
|
||||
],
|
||||
'spec': {
|
||||
'domain': {
|
||||
'devices': {}
|
||||
},
|
||||
'terminationGracePeriodSeconds': 180
|
||||
}
|
||||
"spec": {
|
||||
"domain": {"devices": {}},
|
||||
"terminationGracePeriodSeconds": 180,
|
||||
},
|
||||
}
|
||||
)
|
||||
with patch.object(runner, "perform_action") as mock_run_command:
|
||||
mock_run_command.return_value = (
|
||||
{
|
||||
"method": "create",
|
||||
"changed": True,
|
||||
"result": "success"
|
||||
}
|
||||
) # successful execution
|
||||
mock_run_command.return_value = {
|
||||
"method": "create",
|
||||
"changed": True,
|
||||
"result": "success",
|
||||
} # successful execution
|
||||
with self.assertRaises(AnsibleExitJson) as result:
|
||||
kubevirt_vm.main()
|
||||
mock_run_command.assert_called_once_with(
|
||||
|
||||
@@ -47,5 +47,5 @@ def fail_json(*args, **kwargs):
|
||||
|
||||
|
||||
def get_api_client(*args, **kwargs):
|
||||
"""function to patch over get_api_client """
|
||||
"""function to patch over get_api_client"""
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user