Bug 1195002

Summary: Support abbreviated flags in Go version of SUSEConnect
Product: [openSUSE] PUBLIC SUSE Linux Enterprise Server 15 SP4 Reporter: Oleksandr Orlov <oorlov>
Component: RegistrationAssignee: Darragh O'Reilly <doreilly>
Status: RESOLVED WONTFIX QA Contact: Hernan Schmidt <hschmidt>
Severity: Normal    
Priority: P4 - Low CC: doreilly, old_jtomasiak, rbranco, robert.simai, sweiberg, taroth, tschmidt
Version: unspecified   
Target Milestone: ---   
Hardware: Other   
OS: Other   
URL: https://openqa.suse.de/tests/7980644/modules/addon_products_sle/steps/8
Whiteboard:
Found By: openQA Services Priority:
Business Priority: Blocker: Yes
Marketing QA Status: --- IT Deployment: ---

Description Oleksandr Orlov 2022-01-21 15:10:26 UTC
Starting from SLE 15 SP4 [Build 84.1], Go version of SUSEConnect is used.

We noticed that abbreviated flags become not supported with it, e.g. `SUSEConnect --clean` (as an abbreviated version of --cleanup) was supported in 0.3.32 ruby version, but is not supported in Go version.

Darragh O'Reilly discovered that ruby parser allowed that behavior:

SLEMicro1:~ # SUSEConnect --version
0.3.32
SLEMicro1:~ # SUSEConnect --debug | head -1
cmd options: '{:debug=>true, :language=>"en_US.UTF-8"}'
SLEMicro1:~ # SUSEConnect --debug --cle | head -1
cmd options: '{:debug=>true, :cleanup=>true, :language=>"en_US.UTF-8"}'

There still may be a chance that customers use the abbreviated flags in their scripts, so it would be great to have the support of them in Go version as well to keep backward compatibility.

Example of failure in openQA tests: https://openqa.suse.de/tests/8009598#step/scc_cleanup_reregister/11
Comment 1 Ricardo Branco 2022-01-21 15:57:29 UTC
Related to
https://bugzilla.suse.com/show_bug.cgi?id=1195003
Comment 3 Stefan Weiberg 2022-01-24 18:07:35 UTC
--clean is not a supported abbreviation of SUSEConnect. According to the --help output of the old SUSEConnect:

Usage: SUSEConnect [options]
Register SUSE Linux Enterprise installations with the SUSE Customer Center.
Registration allows access to software repositories (including updates)
and allows online management of subscriptions and organizations.

Manage subscriptions at https://scc.suse.com

    -p, --product [PRODUCT]  Specify a product for activation/deactivation. Only
                             one product can be processed at a time. Defaults to
                             the base SUSE Linux Enterprise product on this 
                             system. Product identifiers can be obtained
                             with `--list-extensions`.
                             Format: <name>/<version>/<architecture>
    -r, --regcode [REGCODE]  Subscription registration code for the product to
                             be registered.
                             Relates that product to the specified subscription,
                             and enables software repositories for that product.
    -d, --de-register        De-registers the system and base product, or in
                             conjunction with --product, a single extension, and
                             removes all its services installed by SUSEConnect.
                             After de-registration the system no longer consumes
                             a subscription slot in SCC.
        --instance-data  [path to file]
                             Path to the XML file holding the public key and
                             instance data for cloud registration with SMT.
    -e, --email <email>      Email address for product registration.
        --url [URL]          URL of registration server
                             (e.g. https://scc.suse.com).
                             Implies --write-config so that subsequent
                             invocations use the same registration server.
        --namespace [NAMESPACE]
                             Namespace option for use with SMT staging
                             environments.
    -s, --status             Get current system registration status in json
                             format.
        --status-text        Get current system registration status in text
                             format.
        --list-extensions    List all extensions and modules available for
                             installation on this system.
        --write-config       Write options to config file at /etc/SUSEConnect.
        --cleanup            Remove old system credentials and all zypper
                             services installed by SUSEConnect.
        --rollback           Revert the registration state in case of a failed
                             migration.

Common options:
        --root [PATH]        Path to the root folder, uses the same parameter
                             for zypper.
        --version            Print program version.
        --debug              Provide debug output.
    -h, --help               Show this message.


options like --clean and --list or -l only worked due to the way Ruby parses option, but they weren't officially supported or documented. For -l (reported in https://bugzilla.suse.com/show_bug.cgi?id=1195006) I agree that this would be a sensible decision to add, but in regards to --clean I advise to adjust the test cases to use the documented --cleanup.

To avoid that user run into any kind of trouble, in case they adopted this wrong parameter, we might want to think about documenting this in the Release Notes.
Comment 4 Oleksandr Orlov 2022-01-24 18:15:38 UTC
> I advise to adjust the test cases to use the documented --cleanup.

We already adjusted them to use --cleanup, so for automated tests this is not an issue. 

Just in case it is important for customers, this could be fixed. As we discussed with Darragh O'Reilly, the SUSEConnect may allow specific aliases like clean, but not cl, cle, clea etc.

I guess, it is definitely up to Product Management if we need to support the abbreviated flags or just drop this ability from requirements for Go version.
Comment 5 Tanja Roth 2022-01-25 17:01:33 UTC
(In reply to Stefan Weiberg from comment #3)
> --clean is not a supported abbreviation of SUSEConnect. 
[...]
> 
> options like --clean and --list or -l only worked due to the way Ruby parses
> option, but they weren't officially supported or documented. For -l
> (reported in https://bugzilla.suse.com/show_bug.cgi?id=1195006) I agree that
> this would be a sensible decision to add, but in regards to --clean I advise
> to adjust the test cases to use the documented --cleanup.
> 
> To avoid that user run into any kind of trouble, in case they adopted this
> wrong parameter, we might want to think about documenting this in the
> Release Notes.

Thanks, I have opened https://bugzilla.suse.com/show_bug.cgi?id=1195106 for Lukas now to mention this in the RN.
Comment 7 Stefan Weiberg 2022-01-26 11:01:03 UTC
Closing, as a separate bug for the RN entry has been opened. Abbreviations for --cleanup and --list-extensions have been added to the upstream project and will be submitted to 15 SP4.