def _represent_node_attributes(self, api, node_id):  # pragma: no cover
        node = api._model_get_by_id('nodes', node_id)

        # walk through all the facts and determine which are
        # cluster facts and which are node facts.  Generate templates
        # for each.

        node_attributes = {}
        cluster_attributes = {}

        if 'facts' in node:
            for fact in node['facts']:
                fact_info = opencenter.backends.fact_by_name(fact)

                if fact_info is None or 'cluster_wide' not in fact_info:
                    self.logger.debug('Invalid fact: %s' % fact)
                else:
                    # serialize non-string facts so we can safely embed in
                    # template (which gets de-serialized later)
                    if isinstance(node['facts'][fact], basestring):
                        fact_serialized = node['facts'][fact]
                    else:
                        fact_serialized = json.dumps(node['facts'][fact])

                    if fact_info['cluster_wide'] is True:
                        if fact in cluster_attributes:
                            raise KeyError('fact already exists')

                        cluster_attributes[fact] = fact_serialized
                    else:
                        if fact in node_attributes:
                            raise KeyError('fact already exists')

                        node_attributes[fact] = fact_serialized

        # now generate the json from the facts
        environment_template = os.path.join(os.path.dirname(__file__),
                                            'environment.tmpl')
        node_template = os.path.join(os.path.dirname(__file__),
                                     'node.tmpl')

        chef_node_attrs = mako.template.Template(
            filename=node_template).render(facts=node_attributes)

        chef_env_attrs = mako.template.Template(
            filename=environment_template).render(facts=cluster_attributes)

        return (json.loads(chef_node_attrs), json.loads(chef_env_attrs))

    # README(shep): not executed on the server, skipping from code coverage
dataset/ETHPy150Open rcbops/opencenter/opencenter/backends/chef-client/__init__.py/ChefClientBackend._represent_node_attributes/original