bstinson / centos / t_functional

Forked from centos/t_functional 3 years ago
Clone

Blame tests/0_common/000_centos_default_repos.py

Athmane Madjoudj 509fd6
#!/usr/bin/python
Athmane Madjoudj 509fd6
# Author: Athmane Madjoudj <athmanem@gmail.com>
Karanbir Singh d76413
#         Karanbir Singh <kbsingh@karan.org>
Athmane Madjoudj 509fd6
# Test default CentOS repos
Karanbir Singh 32fd86
# Note: since the -qa and CI setup will modify the
Karanbir Singh 32fd86
#       local repos, we need to run this tests
Karanbir Singh 32fd86
#       before those changes are made
Athmane Madjoudj 509fd6
Athmane Madjoudj 509fd6
import yum
Athmane Madjoudj 509fd6
import sys 
Athmane Madjoudj 6bb5a8
import datetime
Athmane Madjoudj 509fd6
Athmane Madjoudj 509fd6
yb = yum.YumBase()
Athmane Madjoudj 970889
centos_default_repos = ['base','extras','updates','cr']
Athmane Madjoudj 6bb5a8
now = lambda: datetime.datetime.today().strftime("%c")
Athmane Madjoudj 6bb5a8
print "[+] %s -> Check if non default repo is enabled" % now() 
Athmane Madjoudj 509fd6
for repo in yb.repos.listEnabled():
Athmane Madjoudj 509fd6
    if not repo.id in centos_default_repos:
Karanbir Singh d76413
        print '%s is enabled, should be disabled at this stage' % repo.id
Athmane Madjoudj 6bb5a8
        print '[+] %s -> FAIL' % now()
Athmane Madjoudj 509fd6
        sys.exit(1)
Athmane Madjoudj 6bb5a8
print '[+] %s -> PASS' % now()
Athmane Madjoudj 509fd6
sys.exit(0)
Athmane Madjoudj 509fd6