summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStef Walter <stefw@redhat.com>2013-07-19 17:37:32 +0200
committerStef Walter <stefw@redhat.com>2013-07-19 17:37:32 +0200
commitf914fa138cfb0d00f40c8328777f0d7193fb2c4e (patch)
tree109b56adf04bf776b868bfd809e3669635a897fc
parent9fe0c385107a1bb0c2b0f250a08a5df4c485556c (diff)
Delete current computer if no host specified to delete-computer
realmd will use this. realmd lets adcli calculate the current host name during join, and so it makes sense to do the same during delete-computer. https://bugs.freedesktop.org/show_bug.cgi?id=65032
-rw-r--r--doc/adcli.xml4
-rw-r--r--tools/computer.c7
2 files changed, 8 insertions, 3 deletions
diff --git a/doc/adcli.xml b/doc/adcli.xml
index 2257eef..108ffed 100644
--- a/doc/adcli.xml
+++ b/doc/adcli.xml
@@ -558,6 +558,10 @@ Password for Administrator:
treated as fully qualified host name, otherwise it is treated
as short computer name.</para>
+ <para>If no computer name is specified, then the host name of the
+ computer adcli is running on is used, as returned by
+ <literal>gethostname()</literal>.</para>
+
<para>The various global options can be used.</para>
</refsect1>
diff --git a/tools/computer.c b/tools/computer.c
index c38123f..c12bd99 100644
--- a/tools/computer.c
+++ b/tools/computer.c
@@ -576,7 +576,7 @@ adcli_tool_computer_delete (adcli_conn *conn,
};
static adcli_tool_desc usages[] = {
- { 0, "usage: adcli delete-computer --domain=xxxx host1.example.com" },
+ { 0, "usage: adcli delete-computer --domain=xxxx [host1.example.com]" },
{ 0 },
};
@@ -601,7 +601,7 @@ adcli_tool_computer_delete (adcli_conn *conn,
argc -= optind;
argv += optind;
- if (argc != 1)
+ if (argc > 1)
errx (EUSAGE, "specify one host name of computer account to delete");
adcli_conn_set_allowed_login_types (conn, ADCLI_LOGIN_USER_ACCOUNT);
@@ -613,7 +613,8 @@ adcli_tool_computer_delete (adcli_conn *conn,
adcli_get_last_error ());
}
- parse_fqdn_or_name (enroll, argv[0]);
+ if (argc == 1)
+ parse_fqdn_or_name (enroll, argv[0]);
res = adcli_enroll_delete (enroll, 0);
if (res != ADCLI_SUCCESS) {