def _parse_services(self, template_json):
        handler = (vhf.VersionHandlerFactory.get_instance().
                   get_version_handler(self.version))
        sp = handler.get_services_processor()
        for s in template_json['services']:
            name = s['name']
            service = sp.create_service(name)

            self.services.append(service)
            for c in s['components']:
                component = Component(c['name'], c['type'], c['cardinality'])
                service.add_component(component)

            if 'users' in s:
                for u in s['users']:
                    user = User(u['name'], u['password'], u['groups'])
                    service.add_user(user)

            configs = self._parse_configurations(s)
            for config in configs:
                service.add_configuration(config)
dataset/ETHPy150Open openstack/sahara/sahara/plugins/hdp/clusterspec.py/ClusterSpec._parse_services/original