Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
david-mclain committed Nov 26, 2024
1 parent df1b4d2 commit 37fc03e
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 5 deletions.
32 changes: 29 additions & 3 deletions landscape/client/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,20 @@ def make_parser(self):
"Send a new registration request only if one has not been sent"
),
)
parser.add_argument(
"--actively-registered",
action="store_true",
help="Exit with code 0 (success) if client is "
"registered else returns {}. Displays "
"registration info.".format(EXIT_NOT_REGISTERED),
)
parser.add_argument(
"--registration-sent",
action="store_true",
help="Exit with code 0 (success) if client is "
"registered else returns {}. Displays "
"registration info.".format(EXIT_NOT_REGISTERED),
)
return parser


Expand Down Expand Up @@ -863,7 +877,7 @@ def get_secure_id(config):
return identity.secure_id


def main(args, print=print):
def main(args, print=print): # noqa: C901
"""Interact with the user and the server to set up client configuration."""
config = LandscapeSetupConfiguration()
try:
Expand All @@ -885,9 +899,9 @@ def main(args, print=print):
"and force registration together.",
)

already_registered = actively_registered(config)
already_registered = is_registered(config)

if config.is_registered:
if config.is_registered or config.registration_sent:

registration_status = already_registered

Expand All @@ -899,6 +913,18 @@ def main(args, print=print):
else:
sys.exit(EXIT_NOT_REGISTERED)

currently_registered = actively_registered(config)
if config.actively_registered:
registration_status = currently_registered

info_text = registration_info_text(config, registration_status)
print(info_text)

if registration_status:
sys.exit(0)
else:
sys.exit(EXIT_NOT_REGISTERED)

if os.getuid() != 0:
sys.exit("landscape-config must be run as root.")

Expand Down
10 changes: 8 additions & 2 deletions man/landscape-config.txt
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ OPTIONS
enter: ALL.
--include-manager-plugins=PLUGINS A comma-separated list of manager
plugins to load explicitly.
--manage-sources-list-d [MANAGE_SOURCES_LIST_D] Repository profiles manage
the files in ’etc/apt/sources.list.d'. (default: true)
--manage-sources-list-d [MANAGE_SOURCES_LIST_D] Repository profiles manage
the files in ’etc/apt/sources.list.d'. (default: true)
-n, --no-start Don't start the client automatically.
--ok-no-register Return exit code 0 instead of 2 if the client can't be
registered.
Expand All @@ -83,6 +83,12 @@ OPTIONS
--is-registered Exit with code 0 (success) if client
is registered else returns 5. Display
registration info.
--registration-sent Exit with code 0 (success) if client
has sent registration request else returns 5.
Display registration sent info.
--actively-registered Exit with code 0 (success) if client
is registered else returns 5. Display
registration info.

CLOUD

Expand Down

0 comments on commit 37fc03e

Please sign in to comment.