saltstack / salt

Software to automate the management and configuration of any infrastructure or application at scale. Install Salt from the Salt package repositories here:
https://docs.saltproject.io/salt/install-guide/en/latest/
Apache License 2.0
14.19k stars 5.48k forks source link

[BUG] poudriere commands do not work when jail is a number #61082

Open ari opened 3 years ago

ari commented 3 years ago

Description poudriere.delete_jail does not work in some situations

Setup

Steps to Reproduce the behavior

Let's get a list of jails.

# salt-call poudriere.list_jails
local:
    - 12              12.2-RELEASE-p9 amd64         ftp    2021-07-13 07:35:16 /var/poudriere/jails/12
    - 13              13.0-RELEASE-p4 amd64         ftp    2021-10-20 08:10:06 /var/poudriere/jails/13
    - 13-arm-oncourse 13.0-RELEASE-p4 arm64.aarch64 ftp    2021-10-20 08:11:59 /var/poudriere/jails/13-arm-oncourse

Now delete one.

# salt-call poudriere.delete_jail 12
local:
    Looks like jail 12 has not been created

Strange error message, and nothing happened.

# salt-call poudriere.list_jails
local:
    - 12              12.2-RELEASE-p9 amd64         ftp    2021-07-13 07:35:16 /var/poudriere/jails/12
    - 13              13.0-RELEASE-p4 amd64         ftp    2021-10-20 08:10:06 /var/poudriere/jails/13
    - 13-arm-oncourse 13.0-RELEASE-p4 arm64.aarch64 ftp    2021-10-20 08:11:59 /var/poudriere/jails/13-arm-oncourse

Looks like the problem might be the jail is just digits.

# salt-call poudriere.is_jail 13
local:
    False
# salt-call poudriere.is_jail 13-arm-oncourse
local:
    True

Expected behavior A clear and concise description of what you expected to happen.

Versions Report

# salt --versions-report
Salt Version:
          Salt: 3003.3

Dependency Versions:
          cffi: 1.14.6
      cherrypy: Not Installed
      dateutil: 2.8.1
     docker-py: Not Installed
         gitdb: Not Installed
     gitpython: Not Installed
        Jinja2: 3.0.1
       libgit2: Not Installed
      M2Crypto: Not Installed
          Mako: Not Installed
       msgpack: 1.0.2
  msgpack-pure: Not Installed
  mysql-python: Not Installed
     pycparser: 2.20
      pycrypto: Not Installed
  pycryptodome: 3.10.1
        pygit2: Not Installed
        Python: 3.8.12 (default, Sep 10 2021, 01:14:56)
  python-gnupg: Not Installed
        PyYAML: 5.4.1
         PyZMQ: 22.3.0
         smmap: Not Installed
       timelib: Not Installed
       Tornado: 4.5.3
           ZMQ: 4.3.4

System Versions:
          dist: freebsd 13.0
        locale: utf-8
       machine: amd64
       release: 13.0-RELEASE-p3
        system: FreeBSD
       version: FreeBSD 13.0
OrangeDog commented 3 years ago

If you quote it, does it work?

salt-call poudriere.delete_jail '"12"'
ari commented 3 years ago
# salt-call poudriere.is_jail '13'
local:
    False

# salt-call poudriere.is_jail "'13'"
local:
    True

# salt-call poudriere.is_jail '"13"'
local:
    True