From 0b0ff62bc58931157d87722f21e6a1a995d7d27b Mon Sep 17 00:00:00 2001 From: m0duspwnens Date: Tue, 8 Oct 2024 09:40:44 -0400 Subject: [PATCH] update comments --- salt/_modules/qcow2.py | 6 +++--- salt/manager/tools/sbin/so-salt-cloud | 12 ++++++++++++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/salt/_modules/qcow2.py b/salt/_modules/qcow2.py index 56ccb36a0..8a4f89b59 100644 --- a/salt/_modules/qcow2.py +++ b/salt/_modules/qcow2.py @@ -23,7 +23,7 @@ def modify_network_config(image, interface, mode, ip4=None, gw4=None, dns4=None, :param image: Path to the QCOW2 image. :param interface: Network interface to modify (e.g., 'eth0'). :param mode: 'dhcp4' or 'static4'. - :param ip4: IPv4 address with CIDR notation (e.g., '192.168.1.100/24'). Required for static configuration. + :param ip4: IPv4 address with CIDR notation (e.g., '192.168.1.10/24'). Required for static configuration. :param gw4: IPv4 gateway (e.g., '192.168.1.1'). Required for static configuration. :param dns4: Comma-separated list of IPv4 DNS servers (e.g., '8.8.8.8,8.8.4.4'). :param search4: DNS search domain for IPv4. @@ -34,11 +34,11 @@ def modify_network_config(image, interface, mode, ip4=None, gw4=None, dns4=None, .. code-block:: bash - salt '*' qcow2.modify_network_config image='/path/to/image.qcow2' interface='eth0' mode='static4' ip4='192.168.1.100/24' gw4='192.168.1.1' dns4='8.8.8.8,8.8.4.4' search4='example.com' + salt '*' qcow2.modify_network_config image='/path/to/image.qcow2' interface='eth0' mode='static4' ip4='192.168.1.10/24' gw4='192.168.1.1' dns4='8.8.8.8,8.8.4.4' search4='example.local' ''' - cmd = ['/usr/sbin/so-qcow2-modify-network.py', '-I', image, '-i', interface] + cmd = ['/usr/sbin/so-qcow2-modify-network', '-I', image, '-i', interface] if mode.lower() == 'dhcp4': cmd.append('--dhcp4') diff --git a/salt/manager/tools/sbin/so-salt-cloud b/salt/manager/tools/sbin/so-salt-cloud index c62519182..600d7bb8e 100644 --- a/salt/manager/tools/sbin/so-salt-cloud +++ b/salt/manager/tools/sbin/so-salt-cloud @@ -5,6 +5,18 @@ # https://securityonion.net/license; you may not use this file except in compliance with the # Elastic License 2.0. +""" +Script to assist with salt-cloud VM provisioning. This is only intended to work with a libvirt salt-cloud provider. + +Usage: + python so-salt-cloud -p (--dhcp4 | --static4 --ip4 --gw4 ) [--dns4 ] [--search4 ] + +Examples: + python so-salt-cloud -p core-hype1 hostname_nodetype --static4 --ip4 192.168.1.10/24 --gw4 192.168.1.1 --dns4 192.168.1.1,192.168.1.2 --search4 example.local + + python so-salt-cloud -p core-hype1 hostname_nodetype --dhcp4 +""" + import argparse import subprocess import re