#!/opt/opensvc/bin/python
#
# Copyright (c) 2009 Christophe Varoqui <christophe.varoqui@free.fr>'
# Copyright (c) 2009 Cyril Galibern <cyril.galibern@free.fr>'
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# 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., 675 Mass Ave, Cambridge, MA 02139, USA.
#
import sys
import os

"""
When installed in /etc/cron.daily/ this must be a symlink to the
file in the opensvc distrib, wherever installed, so that we can compute
relative paths to locate libs
"""

pathsvc = os.path.realpath(os.path.join(os.path.dirname(__file__), '..', '..'))
pathlib = os.path.join(pathsvc, 'lib')
sys.path.append(pathlib)

import node
n = node.Node()
n.cron = True

for action in ["pushstats", "pushpkg", "pushpatch", "pushservices",
               "pushasset", "checks", "syncservices", "compliance_check"]:
    try:
        n.action(action)
    except:
        import traceback
        traceback.print_exc()

n.close()
