Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1374676

Summary: atomic install on non-Atomic OS always says too few arguments
Product: Red Hat Enterprise Linux 7 Reporter: Jan Pazdziora (Red Hat) <jpazdziora>
Component: atomicAssignee: Lokesh Mandvekar <lsm5>
Status: CLOSED DUPLICATE QA Contact: atomic-bugs <atomic-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.3CC: ajia, bbaude, dwalsh, jpazdziora
Target Milestone: rcKeywords: Regression
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1375719 (view as bug list) Environment:
Last Closed: 2016-09-13 20:29:13 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jan Pazdziora (Red Hat) 2016-09-09 11:54:13 UTC
Description of problem:

Help for atomic install command says

# atomic install --help
usage: atomic install [-h] [-n NAME] [--display] image ...

positional arguments:
  image                 container image
  args                  Additional arguments appended to the image install
                        method

optional arguments:
  -h, --help            show this help message and exit
  -n NAME, --name NAME  name of container
  --display             preview the command that /usr/bin/atomic would execute

atomic install attempts to read the LABEL INSTALL field in the image, if it
does not exist atomic will just pull the image on to your machine. You could
add a LABEL INSTALL command to your Dockerfile like: 'LABEL INSTALL docker run
-t -i --rm --privileged -v /:/host --net=host --ipc=host --pid=host -e
HOST=/host -e NAME=${NAME} -e IMAGE=${IMAGE} -e CONFDIR=/host/etc/${NAME} -e
LOGDIR=/host/var/log/${NAME} -e DATADIR=/host/var/lib/${NAME} --name ${NAME}
${IMAGE} /usr/bin/INSTALLCMD'

The atomic 1.12 says too few arguments, even if image is provided.

Version-Release number of selected component (if applicable):

atomic-1.12.0-1.el7.x86_64

How reproducible:

Deterministic.

Steps to Reproduce:
1. atomic install rhel7

Actual results:

# atomic install rhel7
/usr/bin/atomic install rhel7: too few arguments
Try '/usr/bin/atomic install rhel7 --help' for more information.
# /usr/bin/atomic install rhel7 --help
/usr/bin/atomic install rhel7 --help: too few arguments
Try '/usr/bin/atomic install rhel7 --help --help' for more information.

Expected results:

No error about too few arguments, the default docker run is executed.

Additional info:

Comment 2 Alex Jia 2016-09-09 16:17:23 UTC
It's weird for me, I can successfully install rhel7 w/  atomic-1.12.0-1.el7.x86_64 and docker-1.10.3-53.el7.x86_64 on my RHEL7.2 system.

[root@dhcp-2-50 ~]# atomic install rhel7
Using default tag: latest
Trying to pull repository registry.access.redhat.com/rhel7 ... 
latest: Pulling from registry.access.redhat.com/rhel7
ee4aeaf2fc2d: Pull complete 
Digest: sha256:8bedcf1091d26337900510275d268f7aa817026f3327c91620ca266c2cc26924
Status: Downloaded newer image for registry.access.redhat.com/rhel7:latest

[root@dhcp-2-50 ~]# rpm -q atomic docker
atomic-1.12.0-1.el7.x86_64
docker-1.10.3-53.el7.x86_64

Comment 7 Jan Pazdziora (Red Hat) 2016-09-13 08:21:11 UTC
The message gets printed from

    except AttributeError:
        # python3 throws exception on no args to atomic
        if aparser:
            aparser.print_usage()
        else:
            traceback.print_exc(file=sys.stdout)
        sys.exit(1)

When I run the print_exc unconditionally, I get

Traceback (most recent call last):
  File "/usr/bin/atomic", line 184, in <module>
    sys.exit(_func())
  File "/usr/lib/python2.7/site-packages/Atomic/install.py", line 87, in install
    elif self.args.setvalues:
AttributeError: 'Namespace' object has no attribute 'setvalues'

Comment 8 Jan Pazdziora (Red Hat) 2016-09-13 08:30:11 UTC
Adding

import argparse

to /usr/lib/python2.7/site-packages/Atomic/containers.py (Atomic/containers.py) seems to fix the issue.

In upstream it was added via 48c1d2519c75cec10fd5f447977f7b0ae23c3d22.

Please backport the whole commit or just that one-line import change.

Comment 9 Jan Pazdziora (Red Hat) 2016-09-13 13:05:52 UTC
I spoke too fast, this does not seem to fix the issue.

Comment 10 Jan Pazdziora (Red Hat) 2016-09-13 13:09:58 UTC
So the problem is only present if the ostree package is not available, like on non-Atomic RHEL installation.

When ostree is installed, the

if OSTREE_PRESENT:

in /usr/lib/python2.7/site-packages/Atomic/install.py kicks in and

        installp.add_argument("--set", dest="setvalues",
                              action='append',
                              help=_("Specify a variable in the VARIABLE=VALUE "
                                     "form for a system container"))

is used.

Comment 11 Alex Jia 2016-09-13 14:27:27 UTC
Does full quality image name works for you? 

If you want do pull registry.access.redhat.com/rhel7 image w/ short name in RHEL7 system, you should append ADD_REGISTRY='--add-registry registry.access.redhat.com' into /etc/sysconfig/docker and restart docker service, I assume you haven't do this, otherwise, please ignore this.


[root@dhcp-2-50 ~]# atomic install registry.access.redhat.com/rhel7
Using default tag: latest
Trying to pull repository registry.access.redhat.com/rhel7 ... 
latest: Pulling from registry.access.redhat.com/rhel7
ee4aeaf2fc2d: Pull complete 
Digest: sha256:8bedcf1091d26337900510275d268f7aa817026f3327c91620ca266c2cc26924
Status: Downloaded newer image for registry.access.redhat.com/rhel7:latest

[root@dhcp-2-50 ~]# cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 7.2 (Maipo)

[root@dhcp-2-50 ~]# rpm -q atomic docker
atomic-1.12.0-1.el7.x86_64
docker-1.10.3-54.el7.x86_64

Comment 12 Alex Jia 2016-09-13 16:37:37 UTC
I met the same issue for atomic install although I used full quality image name.

# atomic install registry.access.redhat.com/rhel7/sadc
/usr/bin/atomic install registry.access.redhat.com/rhel7/sadc: too few arguments
Try '/usr/bin/atomic install registry.access.redhat.com/rhel7/sadc --help' for more information.

Comment 13 Lokesh Mandvekar 2016-09-13 19:04:48 UTC
could you retry with the latest 1.12.1 https://brewweb.engineering.redhat.com/brew/buildinfo?buildID=513056

Comment 14 Lokesh Mandvekar 2016-09-13 19:10:41 UTC
looks like the latest build has this issue has well.

Comment 15 Brent Baude 2016-09-13 19:49:13 UTC
Fixed in https://github.com/projectatomic/atomic/pull/612.