Ejemplo n.º 1
0
def write_startup_setting(section, setting, value):
    """
    Set a new value for a startup setting.
    """
    configparser.set(section, setting, value)

    if section == TL_SECTION:
        configparser.write(open(TL_SETTINGS, 'w'))
        # update representation
        configparser.read(TL_SETTINGS)
    elif section == INV_SECTION:
        configparser.write(open(Path.get_umit_conf(), 'w'))
        # update representation
        configparser.read(Path.get_umit_conf())
Ejemplo n.º 2
0
def write_startup_setting(section, setting, value):
    """
    Set a new value for a startup setting.
    """
    configparser.set(section, setting, value)

    if section == TL_SECTION:
        configparser.write(open(TL_SETTINGS, 'w'))
        # update representation
        configparser.read(TL_SETTINGS)
    elif section == INV_SECTION:
        configparser.write(open(Path.get_umit_conf(), 'w'))
        # update representation
        configparser.read(Path.get_umit_conf())
Ejemplo n.º 3
0
    def __init__(self, running_file=None, home_conf=None, verbose=False,
            svc_class=None, svc_path=None):
        if running_file is None or home_conf is None:
            if home_conf is None:
                home_conf = os.path.split(Path.get_umit_conf())[0]
            running_file = os.path.join(home_conf, 'schedrunning')

        self.svc_class = svc_class
        self.svc_path = svc_path
        self.running_file = running_file
        self.home_conf = home_conf
        self.verbose = verbose
def setup_homedir(usethis, force=False):
    """
    Setting umit home directory.
    """
    if force:
        Path.force_set_umit_conf(usethis)
    else:
        Path.set_umit_conf(usethis)

    global HOME_CONF, RUNNING_FILE

    HOME_CONF = os.path.split(Path.get_umit_conf())[0]
    RUNNING_FILE = os.path.join(HOME_CONF, 'qsrunning')
Ejemplo n.º 5
0
def setup_homedir(usethis, force=False):
    """
    Setting umit home directory.
    """
    if force:
        Path.force_set_umit_conf(usethis)
    else:
        Path.set_umit_conf(usethis)

    global HOME_CONF, RUNNING_FILE

    HOME_CONF = os.path.split(Path.get_umit_conf())[0]
    RUNNING_FILE = os.path.join(HOME_CONF, 'schedrunning')
Ejemplo n.º 6
0
    def __init__(self,
                 running_file=None,
                 home_conf=None,
                 verbose=False,
                 svc_class=None,
                 svc_path=None):
        if running_file is None or home_conf is None:
            if home_conf is None:
                home_conf = os.path.split(Path.get_umit_conf())[0]
            running_file = os.path.join(home_conf, 'schedrunning')

        self.svc_class = svc_class
        self.svc_path = svc_path
        self.running_file = running_file
        self.home_conf = home_conf
        self.verbose = verbose
Ejemplo n.º 7
0
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
# USA
"""
Controls read and write for startup options in Network Inventory.
"""

from ConfigParser import ConfigParser

from umit.core.Paths import Path

TL_SETTINGS = Path.tl_conf
TL_SECTION = "Startup"
INV_SECTION = "inventory"

configparser = ConfigParser()
configparser.read((TL_SETTINGS, Path.get_umit_conf()))


def startup_options():
    """
    Returns startup options dict.
    """
    startup = {}

    section = TL_SECTION

    for opt, value in configparser.items(section):
        startup[opt] = value

    section = INV_SECTION
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 
# USA

"""
A module with a cool name that controls database data removal if it gets 
too old.
"""

from ConfigParser import ConfigParser, NoOptionError, NoSectionError
from umit.core.Paths import Path
from umit.db.Remove import ScanRemover

umitdb = Path.umitdb_ng
umit_conf = Path.get_umit_conf()

def get_decays():
    """
    Return decay for Inventory data and standard UMIT data.
    """
    section = "database"
    
    cfgparse = ConfigParser()
    cfgparse.read(umit_conf)
    
    decays = ()
    
    try:
        decays = (cfgparse.getint(section, "umit_decay"),
                  cfgparse.getint(section, "inventory_decay"))
Ejemplo n.º 9
0
# USA

"""
Controls read and write for startup options in Network Inventory.
"""

from ConfigParser import ConfigParser

from umit.core.Paths import Path

TL_SETTINGS = Path.tl_conf
TL_SECTION = "Startup"
INV_SECTION = "inventory"

configparser = ConfigParser()
configparser.read((TL_SETTINGS, Path.get_umit_conf()))

def startup_options():
    """
    Returns startup options dict.
    """
    startup = { }

    section = TL_SECTION

    for opt, value in configparser.items(section):
        startup[opt] = value

    section = INV_SECTION

    inv_opts = configparser.options(section)