#!/usr/bin/env python
# -*- coding: utf-8 -*-

# LXCF - LXC Facility
# Copyright (C) 2013-2014 FUJITSU LIMITED

# 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; version 2
# of the License.
#
# 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., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.

#
# A scripts for creating LXC domain in which some daemons are running.
# running systemd, rsyslog, sshd in a container.
#

import sys
import json
from optparse import OptionParser

parser = OptionParser()
(options, args) = parser.parse_args(sys.argv)

if len(args) != 2:
    print("usage: lxcf check-json JSON_FILE")
    sys.exit(1)

RESOURCEFILE2 = args[1]

# load parameter resource json file
try:
    f2 = open(RESOURCEFILE2)
except:
    print("can't open: " + RESOURCEFILE2)
    sys.exit(1)

try:
    data2 = json.load(f2)
except:
    print("illegal json format: " + RESOURCEFILE2)
    f2.close()
    sys.exit(1)

f2.close()

sys.exit(0)
