Bug 1374676 - atomic install on non-Atomic OS always says too few arguments
Summary: atomic install on non-Atomic OS always says too few arguments
Keywords:
Status: CLOSED DUPLICATE of bug 1375719
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: atomic
Version: 7.3
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Lokesh Mandvekar
QA Contact: atomic-bugs@redhat.com
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-09-09 11:54 UTC by Jan Pazdziora
Modified: 2016-09-13 22:49 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1375719 (view as bug list)
Environment:
Last Closed: 2016-09-13 20:29:13 UTC
Target Upstream Version:


Attachments (Terms of Use)

Description Jan Pazdziora 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 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 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 2016-09-13 13:05:52 UTC
I spoke too fast, this does not seem to fix the issue.

Comment 10 Jan Pazdziora 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.


Note You need to log in before you can comment on or make changes to this bug.