ArielGlenn has submitted this change and it was merged.

Change subject: use yaml instead of python for global config, ignore list
......................................................................


use yaml instead of python for global config, ignore list

Change-Id: I13ebc7978ce217ca0d9f864edf6cac1e57b61ff5
---
M dataretention/retention/cli.py
M dataretention/retention/config.py
A dataretention/retention/config.yaml
A dataretention/retention/ignored.yaml
M dataretention/retention/ignores.py
M dataretention/retention/localfileaudit.py
M dataretention/retention/localhomeaudit.py
M dataretention/retention/locallogaudit.py
M dataretention/retention/remotefileauditor.py
M dataretention/retention/runner.py
10 files changed, 396 insertions(+), 194 deletions(-)

Approvals:
  ArielGlenn: Verified; Looks good to me, approved



diff --git a/dataretention/retention/cli.py b/dataretention/retention/cli.py
index d199e29..b13174a 100644
--- a/dataretention/retention/cli.py
+++ b/dataretention/retention/cli.py
@@ -14,7 +14,7 @@
 from retention.fileinfo import FileInfo
 import retention.utils
 from retention.utils import JsonHelper
-from retention.config import Config
+import retention.config
 from retention.examiner import RemoteDirExaminer, RemoteFileExaminer
 import retention.fileutils
 import retention.ruleutils
@@ -223,6 +223,7 @@
         self.dircontents = CurrentDirContents(self.timeout)
         self.cenv = CurrentEnv()
         self.cmpl = Completion(self.dircontents, self.cenv, 
self.max_depth_top_level)
+        retention.config.set_up_conf()
 
     def do_one_host(self, host, report):
         self.set_host(host)
@@ -352,7 +353,7 @@
         return contents
 
     def get_basedir_from_path(self, path):
-        for location in Config.cf[self.locations]:
+        for location in retention.config.cf[self.locations]:
             if path == location or path.startswith(location + os.path.sep):
                 return location
         # fixme is this really the right fallback? check it
diff --git a/dataretention/retention/config.py 
b/dataretention/retention/config.py
index 267d511..ea589b1 100644
--- a/dataretention/retention/config.py
+++ b/dataretention/retention/config.py
@@ -1,153 +1,21 @@
-class Config(object):
-    '''
-    directories and files to skip, where to look for files to be
-    scanned, etc.
-    change to suit your setup.
-    '''
+import os
+import salt.utils.yamlloader
 
-    cf = {
-        'root_locations': ["/root"],
-        'logs_locations': ["/var/log", "/a",
-                           "/var/store"],
-        'homes_locations': ["/home", "/data/db20/home"],
+cf = {}
 
-        'rotate_basedir': "/etc/logrotate.d",
-        'rotate_mainconf': "/etc/logrotate.conf",
+def set_up_conf():
+    global cf
 
-        'mysqlconf': ["/etc/mysql/my.cnf", "/etc/my.cnf"],
+    if cf:
+        return
 
-        # ignore these
-        'ignored_dirs': {
-            '*':
-            [".aptitude", ".augeas",
-             ".bash.completion.d",
-             ".bazaar", "benchmarks",
-             ".byobu", ".bzr",
-             ".store", ".cassandra", ".cache",
-             ".config", ".cpan",
-             ".dbus",
-             "deb", ".debug", ".debtags", ".drush",
-             ".fontconfig", ".gconfd",
-             ".gem", ".git",
-             ".gnome", ".gnupg",
-             "hadoop-benchmarks", ".hivehistory",
-             ".ipython", ".irssi",
-             ".jmxsh_history", ".kde",
-             ".lftp", ".links2",
-             ".liquidprompt", "mediawiki-config",
-             ".mozilla", "novaclient",
-             ".npm", ".oprofile",
-             ".oozie-auth-token", ".pig_history",
-             ".pip", ".puppet",
-             ".ssh", "software",
-             ".spamassassin", ".subversion",
-             ".sunw", ".svn", ".texmf-var",
-             ".w3m", ".wapi", ".vim"],
-
-            '/var/log':
-            ["anaconda", "apt", "atop", "dist-upgrade",
-             "fsck", "ganeti/cleaner", "ganeti/master-cleaner",
-             "hadoop-hdfs", "hadoop-yarn", "hive", "hhvm",
-             "installer", "journal", "l10nupdatelog",
-             "libvirt", "news", "ntpstats",
-             "oozie", "samba", "src/pystatsd", "sysstat", "upstart",
-             "wikidata", "zuul"],
-
-            '/var/cache':
-            ["abrt-di", "akmods", "apache2", "apt",
-             "apt-show-versions", "apt-xapian-index",
-             "archiva", "cups", "debconf", "dnf", "fontconfig",
-             "fonts", "git", "jenkins/war", "jetty", "ldconfig",
-             "lighttpd/compress", "man", "pbuilder",
-             "planet", "pppconfig",
-             "request-tracker4/mason_data",
-             "salt", "samba", "smokeping/images", "svnusers", "yum"],
-
-            '/a':
-            ['mediawiki-config'],
-
-            '/a/sqldata':
-            ["*"],
-
-            '/a/sqldata-cache':
-            ["*"],
-
-            '/srv/sqldata':
-            ["*"],
-
-            '/a/search':
-            ["conf", "dumps", "indexes"]
-        },
-        'ignored_prefixes': [".bash_", ".xauth"],
-        'ignored_files': {
-            '*':
-            [".ackrc", "apt.conf", "authorized_keys",
-             ".bashrc",
-             ".bconsole_history",
-             "CmdTool.log", ".cshrc", ".cvspass",
-             ".data_retention",
-             ".emacs",
-             ".exrc", ".forward",
-             ".gdbinit", "gdbinit",
-             ".gitconfig", ".gitignore",
-             ".gitmodules", ".gitreview",
-             ".gitignore_global", ".gnupg",
-             ".gtkrc", ".hivehistory",
-             ".hhvm.hhbc", ".hphpd.history",
-             ".hphpd.ini",
-             ".htoprc", ".hushlogin",
-             ".inputrc", ".joe_state", ".joerc",
-             ".lesshst", ".liquidpromptrc", "MegaSAS.log",
-             ".mailcap", ".mh_profile",
-             ".mime.types",
-             ".mwsql_history",
-             ".mweval_history", ".my.cnf",
-             ".mysql_history", ".nano_history",
-             ".npmrc",
-             ".pearrc", ".pep8",
-             ".php_history",
-             ".pinerc", ".profile",
-             "proxy-server.conf", "README",
-             "README.txt",
-             ".rediscli_history", ".rnd", ".screenrc",
-             ".selected_editor", ".sh_history",
-             "swift.conf", ".tcshrc",
-             "__tokudb_lock_dont_delete_me_*",
-             ".toprc", ".tramp_history",
-             "twemproxy.conf", ".variables",
-             ".vcl", ".viminfo", ".viminfo.tmp",
-             ".vimrc", ".Xauthority",
-             ".zshrc", ".zsh_history"],
-
-            '/var/log':
-            ["alternatives.log", "atop.log", "auth.log",
-             "boot", "boot.log", "btmp", "daemon.log",
-             "debug", "dmesg", "dnf.log",
-             "dpkg.log", "faillog", "fontconfig.log", "fsck",
-             "kern.log", "lastlog", "lpr.log", "messages",
-             "puppet.log", "syslog", "udev", "ufw.log"],
-        },
-        'ignored_types': ["script", "package", "python", "debian", "HTML",
-                          "RPM", "GIF", "JPEG", "PNG", "SVG", "program", "DSA",
-                          "PDF", "symbolic link",
-                          "executable", "shared object", "MS Windows icon"],
-        'ignored_extensions': {
-            '*':
-            ["amd64.changes",
-             ".builder", ".cfg", ".class", ".conf", ".css",
-             ".deb", ".dsc",
-             ".flv", ".gem",
-             ".html", ".jar", ".java", ".jpg", ".js", ".json",
-             ".ogg", ".ogv", ".odp", ".odt", ".ods",
-             ".patch", ".pdf", ".php", ".png",
-             ".ppm", "precise.tar.gz",
-             ".py", ".pyc",
-             ".pem", ".ring.gz", ".sh",
-             ".swo", ".swp", ".ttf", ".tokudb", ".xcf",
-             ".webm", "~"]
-        },
-        # older than 90 days is bad
-        'cutoff': 90 * 86400,
-        # run on this many hosts at once
-        'batchsize': 20
-    }
+    print "INFO: about to parse config yaml"
+    if os.path.exists('/srv/salt/audits/retention/configs/config.yaml'):
+        try:
+            contents = 
open('/srv/salt/audits/retention/configs/config.yaml').read()
+            yamlcontents = salt.utils.yamlloader.load(contents, 
Loader=salt.utils.yamlloader.SaltYamlSafeLoader)
+            # fixme do I need this or will a direct assign get it?
+            for key in yamlcontents:
+                cf[key] = yamlcontents[key]
+        except:
+            raise
diff --git a/dataretention/retention/config.yaml 
b/dataretention/retention/config.yaml
new file mode 100644
index 0000000..137edca
--- /dev/null
+++ b/dataretention/retention/config.yaml
@@ -0,0 +1,23 @@
+root_locations:
+  - /root
+logs_locations:
+  - /var/log
+  - /a
+  - /var/store
+homes_locations:
+  - /home
+  - /data/db20/home
+
+rotate_basedir: /etc/logrotate.d
+rotate_mainconf: /etc/logrotate.conf
+
+mysqlconf:
+  - /etc/mysql/my.cnf
+  - /etc/my.cnf
+
+# older than 90 days is bad
+# 90 * 86400
+cutoff: 7776000
+
+# run on this many hosts at once
+batchsize: 20
diff --git a/dataretention/retention/ignored.yaml 
b/dataretention/retention/ignored.yaml
new file mode 100644
index 0000000..afffecd
--- /dev/null
+++ b/dataretention/retention/ignored.yaml
@@ -0,0 +1,287 @@
+ignored_dirs:
+  "*":
+    - .aptitude
+    - .augeas
+    - .bash.completion.d
+    - .bazaar
+    - benchmarks
+    - .byobu
+    - .bzr
+    - .store
+    - .cassandra
+    - .cache
+    - .config
+    - .cpan
+    - .dbus
+    - deb
+    - .debug
+    - .debtags
+    - .drush
+    - .fontconfig
+    - .gconfd
+    - .gem
+    - .git
+    - .gnome
+    - .gnupg
+    - hadoop-benchmarks
+    - .hivehistory
+    - .ipython
+    - .irssi
+    - .jmxsh_history
+    - .kde
+    - .lftp
+    - .links2
+    - .liquidprompt
+    - mediawiki-config
+    - .mozilla
+    - novaclient
+    - .npm
+    - .oprofile
+    - .oozie-auth-token
+    - .pig_history
+    - .pip
+    - .puppet
+    - .ssh
+    - software
+    - .spamassassin
+    - .subversion
+    - .sunw
+    - .svn
+    - .texmf-var
+    - .w3m
+    - .wapi
+    - .vim
+
+  /var/log:
+    - anaconda
+    - apt
+    - atop
+    - dist-upgrade
+    - fsck
+    - ganeti/cleaner
+    - ganeti/master-cleaner
+    - hadoop-hdfs
+    - hadoop-yarn
+    - hive
+    - hhvm
+    - installer
+    - journal
+    - l10nupdatelog
+    - libvirt
+    - news
+    - ntpstats
+    - oozie
+    - samba
+    - src/pystatsd
+    - sysstat
+    - upstart
+    - wikidata
+    - zuul
+
+  /var/cache:
+    - abrt-di
+    - akmods
+    - apache2
+    - apt
+    - apt-show-versions
+    - apt-xapian-index
+    - archiva
+    - cups
+    - debconf
+    - dnf
+    - fontconfig
+    - fonts
+    - git
+    - jenkins/war
+    - jetty
+    - ldconfig
+    - lighttpd/compress
+    - man
+    - pbuilder
+    - planet
+    - pppconfig
+    - request-tracker4/mason_data
+    - salt
+    - samba
+    - smokeping/images
+    - svnusers
+    - yum
+
+  /a:
+    - mediawiki-config
+
+  /a/sqldata:
+    - "*"
+
+  /a/sqldata-cache:
+    - "*"
+
+  /srv/sqldata:
+    - "*"
+
+  /a/search:
+    - conf
+    - dumps
+    - indexes
+
+
+ignored_prefixes:
+  - .bash_
+  - .xauth
+
+ignored_files:
+  "*":
+    - .ackrc
+    - apt.conf
+    - authorized_keys
+    - .bashrc
+    - .bconsole_history
+    - CmdTool.log
+    - .cshrc
+    - .cvspass
+    - .data_retention
+    - .emacs
+    - .exrc
+    - .forward
+    - .gdbinit
+    - gdbinit
+    - .gitconfig
+    - .gitignore
+    - .gitmodules
+    - .gitreview
+    - .gitignore_global
+    - .gnupg
+    - .gtkrc
+    - .hivehistory
+    - .hhvm.hhbc
+    - .hphpd.history
+    - .hphpd.ini
+    - .htoprc
+    - .hushlogin
+    - .inputrc
+    - .joe_state
+    - .joerc
+    - .lesshst
+    - .liquidpromptrc
+    - MegaSAS.log
+    - .mailcap
+    - .mh_profile
+    - .mime.types
+    - .mwsql_history
+    - .mweval_history
+    - .my.cnf
+    - .mysql_history
+    - .nano_history
+    - .npmrc
+    - .pearrc
+    - .pep8
+    - .php_history
+    - .pinerc
+    - .profile
+    - proxy-server.conf
+    - README
+    - README.txt
+    - .rediscli_history
+    - .rnd
+    - .screenrc
+    - .selected_editor
+    - .sh_history
+    - swift.conf
+    - .tcshrc
+    - "__tokudb_lock_dont_delete_me_*"
+    - .toprc
+    - .tramp_history
+    - twemproxy.conf
+    - .variables
+    - .vcl
+    - .viminfo
+    - .viminfo.tmp
+    - .vimrc
+    - .Xauthority
+    - .zshrc
+    - .zsh_history"],
+
+  /var/log:
+    - alternatives.log
+    - atop.log
+    - auth.log
+    - boot
+    - boot.log
+    - btmp
+    - daemon.log
+    - debug
+    - dmesg
+    - dnf.log
+    - dpkg.log
+    - faillog
+    - fontconfig.log
+    - fsck
+    - kern.log
+    - lastlog
+    - lpr.log
+    - messages
+    - puppet.log
+    - syslog
+    - udev
+    - ufw.log
+
+ignored_types:
+  - script
+  - package
+  - python
+  - debian
+  - HTML
+  - RPM
+  - GIF
+  - JPEG
+  - PNG
+  - SVG
+  - program
+  - DSA
+  - PDF
+  - symbolic link
+  - executable
+  - shared object
+  - MS Windows icon
+
+ignored_extensions:
+  "*":
+    - amd64.changes
+    - .builder
+    - .cfg
+    - .class
+    - .conf
+    - .css
+    - .deb
+    - .dsc
+    - .flv
+    - .gem
+    - .html
+    - .jar
+    - .java
+    - .jpg
+    - .js
+    - .json
+    - .ogg
+    - .ogv
+    - .odp
+    - .odt
+    - .ods
+    - .patch
+    - .pdf
+    - .php
+    - .png
+    - .ppm
+    - precise.tar.gz
+    - .py
+    - .pyc
+    - .pem
+    - .ring.gz
+    - .sh
+    - .swo
+    - .swp
+    - .ttf
+    - .tokudb
+    - .xcf
+    - .webm
+    - "~"
diff --git a/dataretention/retention/ignores.py 
b/dataretention/retention/ignores.py
index 482508b..4a0270b 100644
--- a/dataretention/retention/ignores.py
+++ b/dataretention/retention/ignores.py
@@ -3,6 +3,7 @@
 import runpy
 import json
 import salt.client
+import salt.utils.yamlloader
 
 sys.path.append('/srv/audits/retention/scripts/')
 
@@ -13,7 +14,7 @@
 import retention.fileutils
 import retention.ruleutils
 import retention.cliutils
-from retention.config import Config
+import retention.config
 
 def expand_ignored_dirs(basedir, ignored):
     '''
@@ -111,7 +112,7 @@
     '''
     home_dirs = []
 
-    for location in Config.cf[locations]:
+    for location in retention.config.cf[locations]:
         if not os.path.isdir(location):
             continue
         home_dirs.extend([os.path.join(location, d)
@@ -204,10 +205,23 @@
         collect up initial list of files/dirs to skip during audit
         '''
 
-        self.ignored['files'] = Config.cf['ignored_files']
-        self.ignored['dirs'] = Config.cf['ignored_dirs']
-        self.ignored['prefixes'] = Config.cf['ignored_prefixes']
-        self.ignored['extensions'] = Config.cf['ignored_extensions']
+        if os.path.exists('/srv/salt/audits/retention/configs/ignored.yaml'):
+            try:
+                contents = 
open('/srv/salt/audits/retention/configs/ignored.yaml').read()
+                ign = salt.utils.yamlloader.load(contents, 
Loader=salt.utils.yamlloader.SaltYamlSafeLoader)
+                if 'ignored_files' in ign:
+                    self.ignored['files'] = ign['ignored_files']
+                if 'ignored_dirs' in ign:
+                    self.ignored['dirs'] = ign['ignored_dirs']
+                if 'ignored_prefixes' in ign:
+                    self.ignored['prefixes'] = ign['ignored_prefixes']
+                if 'ignored_extensions' in ign:
+                    self.ignored['extensions'] = ign['ignored_extensions']
+            except:
+                self.ignored['files'] = {}
+                self.ignored['dirs'] = {}
+                self.ignored['prefixes'] = {}
+                self.ignored['extensions'] = {}
 
         if ignore_also is not None:
             # silently skip paths that are not absolute
@@ -317,33 +331,36 @@
         sys.stderr.write(
             "INFO: or rules derived from the directory status entries.\n")
 
-        sys.stderr.write("INFO: Ignoring the following directories:\n")
+        if 'dirs' in self.ignored:
+            sys.stderr.write("INFO: Ignoring the following directories:\n")
+            for basedir in self.ignored['dirs']:
+                if basedir in basedirs or basedir == '*' or basedir == '/':
+                    sys.stderr.write(
+                        "INFO: " + ','.join(self.ignored['dirs'][basedir])
+                        + " in " + basedir + '\n')
 
-        for basedir in self.ignored['dirs']:
-            if basedir in basedirs or basedir == '*' or basedir == '/':
-                sys.stderr.write(
-                    "INFO: " + ','.join(self.ignored['dirs'][basedir])
-                    + " in " + basedir + '\n')
+        if 'files' in self.ignored:
+            sys.stderr.write("INFO: Ignoring the following files:\n")
+            for basedir in self.ignored['files']:
+                if basedir in basedirs or basedir == '*' or basedir == '/':
+                    sys.stderr.write(
+                        "INFO: " + ','.join(self.ignored['files'][basedir])
+                        + " in " + basedir + '\n')
 
-        sys.stderr.write("INFO: Ignoring the following files:\n")
-        for basedir in self.ignored['files']:
-            if basedir in basedirs or basedir == '*' or basedir == '/':
-                sys.stderr.write(
-                    "INFO: " + ','.join(self.ignored['files'][basedir])
-                    + " in " + basedir + '\n')
+        if 'prefixes' in self.ignored:
+            sys.stderr.write(
+                "INFO: Ignoring files starting with the following:\n")
+            sys.stderr.write(
+                "INFO: " + ','.join(self.ignored['prefixes']) + '\n')
 
-        sys.stderr.write(
-            "INFO: Ignoring files starting with the following:\n")
-        sys.stderr.write(
-            "INFO: " + ','.join(self.ignored['prefixes']) + '\n')
-
-        sys.stderr.write(
-            "INFO: Ignoring files ending with the following:\n")
-        for basedir in self.ignored['extensions']:
-            if basedir in basedirs or basedir == '*':
-                sys.stderr.write("INFO: " + ','.join(
-                    self.ignored['extensions'][basedir])
-                                 + " in " + basedir + '\n')
+        if 'extensions' in self.ignored:
+            sys.stderr.write(
+                "INFO: Ignoring files ending with the following:\n")
+            for basedir in self.ignored['extensions']:
+                if basedir in basedirs or basedir == '*':
+                    sys.stderr.write("INFO: " + ','.join(
+                        self.ignored['extensions'][basedir])
+                                     + " in " + basedir + '\n')
 
 
 class RemoteUserCfRetriever(object):
diff --git a/dataretention/retention/localfileaudit.py 
b/dataretention/retention/localfileaudit.py
index 77538d1..dcef02d 100644
--- a/dataretention/retention/localfileaudit.py
+++ b/dataretention/retention/localfileaudit.py
@@ -11,7 +11,7 @@
 import retention.utils
 import retention.magic
 from retention.rule import Rule
-from retention.config import Config
+import retention.config
 from retention.fileinfo import FileInfo
 import retention.fileutils
 import retention.ruleutils
@@ -71,7 +71,8 @@
 
         self.hostname = socket.getfqdn()
 
-        self.cutoff = Config.cf['cutoff']
+        retention.config.set_up_conf()
+        self.cutoff = retention.config.cf['cutoff']
 
         self.perhost_rules_from_store = None
         self.perhost_rules_from_file = None
@@ -332,7 +333,7 @@
 
     def find_all_files(self):
         results = []
-        for location in Config.cf[self.locations]:
+        for location in retention.config.cf[self.locations]:
             dirs_to_do = self.get_dirs_to_do(location)
             if location.count(os.path.sep) >= self.depth + 1:
                 # do the run at least once
@@ -379,7 +380,7 @@
 
         for fname in all_files_sorted:
             if (not retention.fileutils.contains(all_files[fname].filetype,
-                                                 Config.cf['ignored_types'])
+                                                 
retention.config.cf['ignored_types'])
                     and not all_files[fname].is_empty):
                 result.append(all_files[fname].format_output(
                     self.show_sample_content, False,
diff --git a/dataretention/retention/localhomeaudit.py 
b/dataretention/retention/localhomeaudit.py
index 2936990..3b323f8 100644
--- a/dataretention/retention/localhomeaudit.py
+++ b/dataretention/retention/localhomeaudit.py
@@ -1,11 +1,9 @@
-import os
 import sys
 
 sys.path.append('/srv/audits/retention/scripts/')
 
 import retention.utils
 import retention.magic
-from retention.config import Config
 from retention.localfileaudit import LocalFilesAuditor
 import retention.ignores
 
diff --git a/dataretention/retention/locallogaudit.py 
b/dataretention/retention/locallogaudit.py
index c3b7571..71d86f8 100644
--- a/dataretention/retention/locallogaudit.py
+++ b/dataretention/retention/locallogaudit.py
@@ -6,7 +6,7 @@
 
 import retention.utils
 import retention.magic
-from retention.config import Config
+import retention.config
 from retention.fileinfo import LogInfo, LogUtils
 from retention.localfileaudit import LocalFilesAuditor
 import retention.fileutils
@@ -60,6 +60,7 @@
     @staticmethod
     def parse_logrotate_contents(contents,
                                  default_freq='-', default_keep='-'):
+        retention.config.set_up_conf()
         lines = contents.split('\n')
         state = 'want_lbracket'
         logs = {}
@@ -109,6 +110,7 @@
         return logs
 
     def get_logrotate_defaults(self):
+        retention.config.set_up_conf()
         contents = open(Config.cf['rotate_mainconf']).read()
         lines = contents.split('\n')
         skip = False
@@ -142,6 +144,7 @@
         gather all names of log files from logrotate
         config files
         '''
+        retention.config.set_up_conf()
         rotated_logs = {}
         default_freq, default_keep = self.get_logrotate_defaults()
         rotated_logs.update(LocalLogsAuditor.parse_logrotate_contents(
@@ -159,6 +162,7 @@
         check how long mysql logs are kept around
         '''
         # note that I also see my.cnf.s3 and we don't check those (yet)
+        retention.config.set_up_conf()
         output = ''
         for filename in Config.cf['mysqlconf']:
             found = False
@@ -229,6 +233,7 @@
         note that no summary report is done for a  single host,
         for logs we summarize across hosts
         '''
+        retention.config.set_up_conf()
         mysql_issues = self.check_mysqlconf()
         result = []
         if mysql_issues:
diff --git a/dataretention/retention/remotefileauditor.py 
b/dataretention/retention/remotefileauditor.py
index 233812e..8cf61a4 100644
--- a/dataretention/retention/remotefileauditor.py
+++ b/dataretention/retention/remotefileauditor.py
@@ -12,7 +12,7 @@
 from retention.status import Status
 from retention.saltclientplus import LocalClientPlus
 from retention.rule import Rule, RuleStore
-from retention.config import Config
+import retention.config
 from retention.fileinfo import FileInfo
 from retention.utils import JsonHelper
 from retention.runner import Runner
@@ -126,7 +126,8 @@
         # need this for locally running jobs
         self.hostname = socket.getfqdn()
 
-        self.cutoff = Config.cf['cutoff']
+        retention.config.set_up_conf()
+        self.cutoff = retention.config.cf['cutoff']
 
         client = LocalClientPlus()
         hosts, expr_type = Runner.get_hosts_expr_type(self.hosts_expr)
@@ -154,7 +155,7 @@
         self.ignores = Ignores(self.cdb)
         self.ignores.set_up_ignored(self.ignore_also)
         if self.verbose:
-            self.ignores.show_ignored(Config.cf[self.locations])
+            self.ignores.show_ignored(retention.config.cf[self.locations])
 
         self.today = time.time()
         self.magic = retention.magic.magic_open(retention.magic.MAGIC_NONE)
diff --git a/dataretention/retention/runner.py 
b/dataretention/retention/runner.py
index aef8867..8b6919e 100644
--- a/dataretention/retention/runner.py
+++ b/dataretention/retention/runner.py
@@ -3,7 +3,7 @@
 sys.path.append('/srv/audits/retention/scripts/')
 
 from retention.saltclientplus import LocalClientPlus
-from retention.config import Config
+import retention.config
 
 class Runner(object):
     '''
@@ -24,6 +24,7 @@
         self.to_check = to_check
         self.timeout = timeout
         self.verbose = verbose
+        retention.config.set_up_conf()
 
     def get_auditfunction_name(self):
         if self.audit_type == 'root':
@@ -49,9 +50,9 @@
         # fixme instead of this we call the right salt module based on the
         # audit type and with the self.auditmodule_args which is a list
 
-        hostbatches = [self.expanded_hosts[i: i + Config.cf['batchsize']]
+        hostbatches = [self.expanded_hosts[i: i + 
retention.config.cf['batchsize']]
                        for i in range(0, len(self.expanded_hosts),
-                                      Config.cf['batchsize'])]
+                                      retention.config.cf['batchsize'])]
 
         result = {}
         for hosts in hostbatches:

-- 
To view, visit https://gerrit.wikimedia.org/r/233466
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I13ebc7978ce217ca0d9f864edf6cac1e57b61ff5
Gerrit-PatchSet: 2
Gerrit-Project: operations/software
Gerrit-Branch: master
Gerrit-Owner: ArielGlenn <[email protected]>
Gerrit-Reviewer: ArielGlenn <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to