Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions cloudinit/cmd/devel/hotplug_hook.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# This file is part of cloud-init. See LICENSE file for license information.
"""Handle reconfiguration on hotplug events"""
"""Handle reconfiguration on hotplug events."""
import abc
import argparse
import os
Expand Down Expand Up @@ -45,24 +45,24 @@ def get_parser(parser=None):
subparsers.required = True

subparsers.add_parser(
"query", help="query if hotplug is enabled for given subsystem"
"query", help="Query if hotplug is enabled for given subsystem."
)

parser_handle = subparsers.add_parser(
"handle", help="handle the hotplug event"
"handle", help="Handle the hotplug event."
)
parser_handle.add_argument(
"-d",
"--devpath",
required=True,
metavar="PATH",
help="sysfs path to hotplugged device",
help="Sysfs path to hotplugged device",
)
parser_handle.add_argument(
"-u",
"--udevaction",
required=True,
help="action to take",
help="Specify action to take.",
choices=["add", "remove"],
)

Expand Down
2 changes: 1 addition & 1 deletion cloudinit/cmd/devel/make_mime.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This file is part of cloud-init. See LICENSE file for license information.

"""Generate multi-part mime messages for user-data """
"""Generate multi-part mime messages for user-data."""

import argparse
import sys
Expand Down
31 changes: 16 additions & 15 deletions cloudinit/cmd/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -844,28 +844,29 @@ def main(sysv_args=None):
"-v",
action="version",
version="%(prog)s " + (version.version_string()),
help="Show program's version number and exit.",
)
parser.add_argument(
"--file",
"-f",
action="append",
dest="files",
help="additional yaml configuration files to use",
help="Use additional yaml configuration files.",
type=argparse.FileType("rb"),
)
parser.add_argument(
"--debug",
"-d",
action="store_true",
help="show additional pre-action logging (default: %(default)s)",
help="Show additional pre-action logging (default: %(default)s).",
default=False,
)
parser.add_argument(
"--force",
action="store_true",
help=(
"force running even if no datasource is"
" found (use at your own risk)"
"Force running even if no datasource is"
" found (use at your own risk)."
),
dest="force",
default=False,
Expand All @@ -877,13 +878,13 @@ def main(sysv_args=None):

# Each action and its sub-options (if any)
parser_init = subparsers.add_parser(
"init", help="initializes cloud-init and performs initial modules"
"init", help="Initialize cloud-init and perform initial modules."
)
parser_init.add_argument(
"--local",
"-l",
action="store_true",
help="start in local mode (default: %(default)s)",
help="Start in local mode (default: %(default)s).",
default=False,
)
# This is used so that we can know which action is selected +
Expand All @@ -892,21 +893,21 @@ def main(sysv_args=None):

# These settings are used for the 'config' and 'final' stages
parser_mod = subparsers.add_parser(
"modules", help="activates modules using a given configuration key"
"modules", help="Activate modules using a given configuration key."
)
parser_mod.add_argument(
"--mode",
"-m",
action="store",
help="module configuration name to use (default: %(default)s)",
help="Module configuration name to use (default: %(default)s).",
default="config",
choices=("init", "config", "final"),
)
parser_mod.set_defaults(action=("modules", main_modules))

# This subcommand allows you to run a single module
parser_single = subparsers.add_parser(
"single", help="run a single module "
"single", help="Run a single module."
)
parser_single.add_argument(
"--name",
Expand All @@ -918,21 +919,21 @@ def main(sysv_args=None):
parser_single.add_argument(
"--frequency",
action="store",
help="frequency of the module",
help="Set module frequency.",
required=False,
choices=list(FREQ_SHORT_NAMES.keys()),
)
parser_single.add_argument(
"--report",
action="store_true",
help="enable reporting",
help="Enable reporting.",
required=False,
)
parser_single.add_argument(
"module_args",
nargs="*",
metavar="argument",
help="any additional arguments to pass to this module",
help="Any additional arguments to pass to this module.",
)
parser_single.set_defaults(action=("single", main_single))

Expand All @@ -947,20 +948,20 @@ def main(sysv_args=None):
dhclient_hook.get_parser(parser_dhclient)

parser_features = subparsers.add_parser(
"features", help="list defined features"
"features", help="List defined features."
)
parser_features.set_defaults(action=("features", main_features))

parser_analyze = subparsers.add_parser(
"analyze", help="Devel tool: Analyze cloud-init logs and data"
"analyze", help="Devel tool: Analyze cloud-init logs and data."
)

parser_devel = subparsers.add_parser(
"devel", help="Run development tools."
)

parser_collect_logs = subparsers.add_parser(
"collect-logs", help="Collect and tar all cloud-init debug info"
"collect-logs", help="Collect and tar all cloud-init debug info."
)

parser_clean = subparsers.add_parser(
Expand Down
17 changes: 8 additions & 9 deletions doc/man/cloud-init.1
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
cloud-init \- Cloud instance initialization

.SH SYNOPSIS
.BR "cloud-init" " [-h] [-d] [-f FILES] [--force] [-v]
{init,modules,single,query,dhclient-hook,features,analyze,devel,collect-logs,clean,status}"
.BR "cloud-init" " [-h] [-d] [-f FILES] [--force] [-v] [SUBCOMMAND]"

.SH DESCRIPTION
Cloud-init provides a mechanism for cloud instance initialization.
Expand All @@ -20,23 +19,23 @@ debug of deployments.
.SH OPTIONS
.TP
.B "-h, --help"
Show help message and exit
Show help message and exit.

.TP
.B "-d, --debug"
Show additional pre-action logging (default: False)
Show additional pre-action logging (default: False).

.TP
.B "-f <files>, --files <files>"
Additional YAML configuration files to use
Use additional YAML configuration files.

.TP
.B "--force"
Force running even if no datasource is found (use at your own risk)
Force running even if no datasource is found (use at your own risk).

.TP
.B "-v, --version"
Show program's version number and exit
Show program's version number and exit.

.SH SUBCOMMANDS
Please see the help output for each subcommand for additional details,
Expand Down Expand Up @@ -68,11 +67,11 @@ List defined features.

.TP
.B "init"
Initializes cloud-init and performs initial modules.
Initialize cloud-init and execute initial modules.

.TP
.B "modules"
Activates modules using a given configuration key.
Activate modules using a given configuration key.

.TP
.B "query"
Expand Down
42 changes: 20 additions & 22 deletions doc/rtd/topics/cli.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,35 +9,33 @@ option. This can be used against cloud-init itself or any of its subcommands.
.. code-block:: shell-session

$ cloud-init --help
usage: /usr/bin/cloud-init [-h] [--version] [--file FILES] [--debug] [--force]
{init,modules,single,query,dhclient-hook,features,analyze,devel,collect-logs,clean,status}
...

optional arguments:
-h, --help show this help message and exit
--version, -v show program's version number and exit
--file FILES, -f FILES
additional yaml configuration files to use
--debug, -d show additional pre-action logging (default: False)
--force force running even if no datasource is found (use at
your own risk)
usage: cloud-init [-h] [--version] [--file FILES] [--debug] [--force]
{init,modules,single,query,dhclient-hook,features,analyze,devel,collect-logs,clean,status,schema} ...

options:
-h, --help show this help message and exit
--version, -v Show program's version number and exit.
--file FILES, -f FILES
Use additional yaml configuration files.
--debug, -d Show additional pre-action logging (default: False).
--force Force running even if no datasource is found (use at your own risk).

Subcommands:
{init,modules,single,query,dhclient-hook,features,analyze,devel,collect-logs,clean,status}
init initializes cloud-init and performs initial modules
modules activates modules using a given configuration key
single run a single module
query Query standardized instance metadata from the command
line.
{init,modules,single,query,dhclient-hook,features,analyze,devel,collect-logs,clean,status,schema}
init Initialize cloud-init and perform initial modules.
modules Activate modules using a given configuration key.
single Run a single module.
query Query standardized instance metadata from the command line.
dhclient-hook Run the dhclient hook to record network info.
features list defined features
analyze Devel tool: Analyze cloud-init logs and data
devel Run development tools
collect-logs Collect and tar all cloud-init debug info
features List defined features.
analyze Devel tool: Analyze cloud-init logs and data.
devel Run development tools.
collect-logs Collect and tar all cloud-init debug info.
clean Remove logs and artifacts so cloud-init can re-run.
status Report cloud-init status or wait on completion.
schema Validate cloud-config files using jsonschema.


The rest of this document will give an overview of each of the subcommands.


Expand Down
2 changes: 2 additions & 0 deletions doc/rtd/topics/faq.rst
Original file line number Diff line number Diff line change
Expand Up @@ -313,5 +313,7 @@ variety of sources.
.. _Metadata and cloud-init: https://www.youtube.com/watch?v=RHVhIWifVqU
.. _The beauty of cloud-init: http://brandon.fuller.name/archives/2011/05/02/06.40.57/
.. _Introduction to cloud-init: http://www.youtube.com/watch?v=-zL3BdbKyGY
.. Blog Post: [terraform, azure, devops, docker, dotnet, cloud-init] https://codingsoul.org/2022/04/25/build-azure-devops-agents-with-linux-cloud-init-for-dotnet-development/
.. Youtube: [proxmox, cloud-init, template] https://www.youtube.com/watch?v=shiIi38cJe4

.. vi: textwidth=79