Skip to content

Commit

Permalink
rename command to --all-stages
Browse files Browse the repository at this point in the history
  • Loading branch information
holmanb committed Jul 23, 2024
1 parent 59bfbb9 commit dd69167
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
10 changes: 5 additions & 5 deletions cloudinit/cmd/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -945,12 +945,12 @@ def main(sysv_args=None):
)

parser.add_argument(
"--single-process",
dest="single_process",
"--all-stages",
dest="all_stages",
action="store_true",
help=(
"Run cloud-init's stages as a single process as an optimization."
"Requires init system integration."
"Run cloud-init's stages under a single process using a "
"syncronization protocol. This is not intended for CLI usage."
),
default=False,
)
Expand Down Expand Up @@ -1149,7 +1149,7 @@ def main(sysv_args=None):

args = parser.parse_args(args=sysv_args)
setattr(args, "skip_log_setup", False)
if not args.single_process:
if not args.all_stages:
return sub_main(args)
LOG.info("Running cloud-init in single process mode.")

Expand Down
2 changes: 1 addition & 1 deletion systemd/cloud-init.service.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ ConditionEnvironment=!KERNEL_CMDLINE=cloud-init=disabled

[Service]
Type=notify
ExecStart=/usr/bin/cloud-init --single-process
ExecStart=/usr/bin/cloud-init --all-stages
KillMode=process
TasksMax=infinity
TimeoutStartSec=infinity
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from threading import Thread
from unittest import mock


from cloudinit import socket as ci_socket


Expand Down Expand Up @@ -49,7 +48,7 @@ def __exit__(self, *_):
signal.alarm(0)


def test_single_process_times_out(tmp_path):
def test_all_stages_times_out(tmp_path):
"""Verify that no "start" makes the protocol block"""
with mock.patch.object(
ci_socket, "DEFAULT_RUN_DIR", tmp_path
Expand All @@ -72,7 +71,7 @@ def test_single_process_times_out(tmp_path):
raise AssertionError("Expected the thing to timeout!")


def test_single_process(tmp_path):
def test_all_stages(tmp_path):
"""Verify that a socket can store "start" messages
After a socket has been been bound but before it has started listening
Expand Down Expand Up @@ -110,7 +109,7 @@ def test_single_process(tmp_path):
assert expected == third.receive()


def test_single_process_threaded(tmp_path):
def test_all_stages_threaded(tmp_path):
"""Verify that arbitrary "start" order works"""

# in milliseconds
Expand Down Expand Up @@ -183,7 +182,7 @@ def syncer(index: int, name: str):
assert expected == sync_storage[5].receive()


def test_single_process_exception(tmp_path):
def test_all_stages_exception(tmp_path):
"""Verify that exceptions log messages produce a valid warning message"""
with mock.patch.object(
ci_socket, "DEFAULT_RUN_DIR", tmp_path
Expand Down

0 comments on commit dd69167

Please sign in to comment.