Fix problems with outdated sunet puppet modules
Problem seen: ``` Error: Evaluation Error: Error while evaluating a Resource Statement, Evaluation Error: Unknown variable: '::osfamily'. (file: /etc/puppet/cosmos-modules/augeas/manifests/params.pp, line: 7, column: 8) on node example-1.sunet.se ``` This way we run modules installed from upstream apt packages instead. Solution to delete keys to use local pacakges from pahol. While here fix pylint issue with not importing platform module at beginning of file.
This commit is contained in:
parent
3d0413b450
commit
94a65a31e0
1 changed files with 16 additions and 3 deletions
|
@ -4,8 +4,11 @@
|
|||
import hashlib
|
||||
import os
|
||||
import os.path
|
||||
import platform
|
||||
import sys
|
||||
|
||||
from debian import debian_support
|
||||
|
||||
try:
|
||||
from configobj import ConfigObj
|
||||
|
||||
|
@ -109,11 +112,21 @@ def main():
|
|||
},
|
||||
}
|
||||
|
||||
# Make test machines use special test branch of puppet-sunet:
|
||||
if OS_INFO:
|
||||
if OS_INFO["ID"] == "ubuntu":
|
||||
import platform
|
||||
# Provided by Debian/Ubuntu via
|
||||
# https://github.com/SUNET/multiverse/blob/main/global/pre-tasks.d/030puppet
|
||||
|
||||
if (OS_INFO["ID"] == "debian" and int(OS_INFO["VERSION_ID"]) >= 12) or (
|
||||
OS_INFO["ID"] == "ubuntu"
|
||||
and debian_support.version_compare(OS_INFO["VERSION_ID"], "24.04") >= 0
|
||||
):
|
||||
del modules["augeas"]
|
||||
del modules["apt"]
|
||||
del modules["concat"]
|
||||
del modules["stdlib"]
|
||||
|
||||
# Make test machines use special test branch of puppet-sunet:
|
||||
if OS_INFO["ID"] == "ubuntu":
|
||||
nodename = platform.node()
|
||||
name_parts = nodename.split("-")
|
||||
if len(name_parts) > 1:
|
||||
|
|
Loading…
Add table
Reference in a new issue