def __init__(self):
     self._data = {}
     self.VERSION = '0.2.0'
     self._data['version'] = self.VERSION
     self._data['organization'] = ''
     self._chef_conf = ChefConf()
     self._gcc_conf = GCCConf()
     self._auth_conf = AuthConf()
     self._ntp_conf = DateSyncConf()
     self._users_conf = UsersConf()
class ServerConf():

    # Version of the configuration JSON file

    def __init__(self):
        self._data = {}
        self.VERSION = '0.2.0'
        self._data['version'] = self.VERSION
        self._data['organization'] = ''
        self._chef_conf = ChefConf()
        self._gcc_conf = GCCConf()
        self._auth_conf = AuthConf()
        self._ntp_conf = DateSyncConf()
        self._users_conf = UsersConf()

    def load_data(self, conf):
        msg = 'ServerConf: Key "%s" not found in the configuration file.'
        try:
            v = conf['version']
            if v != self.VERSION:
                print 'WARNING: ServerConf and AUTOCONFIG_JSON version mismatch!'
        except KeyError as e:
            print msg % ('version',)
        try:
            self.set_organization(conf['organization'])
        except KeyError as e:
            print msg % ('organization',)
        try:
            self._chef_conf.load_data(conf['chef'])
        except KeyError as e:
            print msg % ('chef',)
        try:
            self._gcc_conf.load_data(conf['gcc'])
        except KeyError as e:
            print msg % ('gcc',)
        try:
            self._auth_conf.load_data(conf['auth'])
        except KeyError as e:
            print msg % ('auth',)
        try:
            self._ntp_conf.load_data(conf['uri_ntp'])
        except KeyError as e:
            print msg % ('ntp',)

    def validate(self):
        valid = len(self._data['version']) > 0 \
            and self._chef_conf.validate() \
            and self._auth_conf.validate() \
            and self._ntp_conf.validate() \
            and self._gcc_conf.validate()
        return valid

    def get_version(self):
        return self._data['version'].encode('utf-8')

    def set_version(self, version):
        self._data['version'] = version
        return self

    def get_organization(self):
        return self._data['organization'].encode('utf-8')

    def set_organization(self, organization):
        self._data['organization'] = organization
        return self

    def get_auth_conf(self):
        return self._auth_conf

    def get_chef_conf(self):
        return self._chef_conf

    def get_ntp_conf(self):
        return self._ntp_conf

    def get_gcc_conf(self):
        return self._gcc_conf

    def get_users_conf(self):
        return self._users_conf

    def set_auth_conf(self, auth_conf):
        self._auth_conf = auth_conf
        return self

    def set_chef_conf(self, chef_conf):
        self._chef_conf = chef_conf
        return self

    def set_ntp_conf(self, ntp_conf):
        self._ntp_conf = ntp_conf
        return self

    def set_gcc_conf(self, gcc_conf):
        self._gcc_conf = gcc_conf
        return gcc_conf

    def set_users_conf(self, user_conf):
        self._users_conf = user_conf
        return self