Пример #1
0
  getCurrentBlueprint: function() {
    var self = this;

    var res = {
      blueprint: { host_groups: [] },
      blueprint_cluster_binding: { host_groups: [] }
    };

    var mapping = self.get('masterHostMapping');

    mapping.forEach(function(item, i) {
      var group_name = 'host-group-' + (i+1);

      var host_group = {
        name: group_name,
        components: item.masterServices.map(function(master) {
          return { name: master.component_name };
        })
      };

      var binding = {
        name: group_name,
        hosts: [ { fqdn: item.host_name } ]
      };

      res.blueprint.host_groups.push(host_group);
      res.blueprint_cluster_binding.host_groups.push(binding);
    });

    return blueprintUtils.mergeBlueprints(res, self.getCurrentSlaveBlueprint());
  },
Пример #2
0
 it('should merge components', function() {
   expect(blueprintUtils.mergeBlueprints(masterBlueprint, slaveBlueprint)).to.deep.equal(
     {
       blueprint: {
         host_groups: [
           {
             name: "host-group-1",
             components: [
               { name: "ZOOKEEPER_SERVER" },
               { name: "NAMENODE" },
               { name: "HBASE_MASTER" }
             ]
           },
           {
             name: "host-group-2",
             components: [
               { name: "SECONDARY_NAMENODE" },
               { name: "DATANODE" }
             ]
           },
           {
             name: "host-group-3",
             components: [
               { name: "DATANODE" },
               { name: "HDFS_CLIENT" },
               { name: "ZOOKEEPER_CLIENT" }
             ]
           }
         ]
       },
       blueprint_cluster_binding: {
         host_groups: [
           {
             name: "host-group-1",
             hosts: [
               { fqdn: "host1" },
               { fqdn: "host2" }
             ]
           },
           {
             name: "host-group-2",
             hosts: [
               { fqdn: "host3" }
             ]
           },
           {
             name: "host-group-3",
             hosts: [
               { fqdn: "host4" },
               { fqdn: "host5" }
             ]
           }
         ]
       }
     }
   );
 });