Page MenuHomePhabricator

os_version strict distro check doesn't work
Closed, InvalidPublic

Description

The docs for the os_version puppet function say:

#  # True if exactly Debian jessie
#  os_version('debian jessie')

This is incorrect, though; os_version('debian jessie') seems to returns True on e.g. Ubuntu Trusty.

I've looked at the code and as best I can tell the test is skipped entirely if the distro doesn't match the version we are testing.

Event Timeline

I can't reproduce. I'm testing with this for example:

$is_trusty = os_version('ubuntu trusty')
notice("is trusty is ${is_trusty}")

$is_stretch = os_version('debian stretch')
notice("is stretch is ${is_stretch}")

$is_jessie = os_version('debian jessie')
notice("is jessie is ${is_jessie}")

The output on a Debian stretch machine seems to be:

Notice: Scope(Class[main]): is trusty is false
Notice: Scope(Class[main]): is stretch is true
Notice: Scope(Class[main]): is jessie is false

…while the output on an Ubuntu trusty machine seems to be:

Notice: Scope(Class[main]): is trusty is true
Notice: Scope(Class[main]): is stretch is false
Notice: Scope(Class[main]): is jessie is false

Change 405387 had a related patch set uploaded (by Faidon Liambotis; owner: Faidon Liambotis):
[operations/puppet@production] wmflib: make os_version spec more extensive

https://gerrit.wikimedia.org/r/405387

Change 405387 merged by Faidon Liambotis:
[operations/puppet@production] wmflib: make os_version spec more extensive

https://gerrit.wikimedia.org/r/405387

I just pushed a change to make the rspec more extensive, including a test case for the scenario that you described here. It seems to pass fine, so I merged the change. Is there a specific server/VPS you're experiencing this on? I could give it a look.

ok, what I've learned is that my test puppet runs are swallowing all warning and notices. So 100% of my tests are invalid and I don't know anything :(

That means a I have a /new/ problem, but this one is probably moot. I'll re-open if I'm actually able to reproduce.