def test1(self): #print '++++++++++ DEBUG: starting test1' s = """{ "name" : "a-cluster", "idbversion" : "Latest", "boxtype" : "cal-precise64", "rolespec" : { "pm" : { "count" : 4, "memory" : 1024, "dbroots_per" : 1 } }, "hadoop" : { "instance-templates" : "1 hadoop-namenode+hadoop-jobtracker,2 hadoop-datanode+hadoop-tasktracker" } } """ mgr = ClusterMgr() c = mgr.alloc_new('my-clustername',ConfigSpec(s),'vagrant') w = WhirrConfigWriter(c) w.write_config(self._basedir) ref_file = '%s/testwhirr-props' % os.path.dirname(__file__) self.assertTrue( testutils.file_compare(ref_file, self._propcmp)) ref_file = '%s/testwhirr-nodes' % os.path.dirname(__file__) self.assertTrue( testutils.file_compare(ref_file, self._nodecmp)) mgr.destroy(c)
def run_install_recipe(self, cb=None): """Run the proper install recipe from the autooam cookbook.""" ret = 0 # skip whirr hadoop install if we are running in unittest mode if not common.props['vmi.vagrantvmi.unit-test']: if self._config['hadoop']: if cb: cb('Whirr Hadoop install Step') Log.info('Executing whirr launch-cluster for Hadoop') w = WhirrConfigWriter( self ) w.write_config( self._vmi._rundir ) owd = os.getcwd() os.chdir(self._vmi._rundir) cmd = '%s/whirr launch-cluster --config hadoop.properties --private-key-file %s/insecure_private_key' %\ (common.props['cluster.cluster.whirrdir'], common.props['vmi.vagrantvmi.vagrantroot']) ret = utils.syscall_log(cmd, self._vmi._outfile)[0] os.chdir(owd) # we also need to install libhdfs before moving on to the InfiniDB install if ret == 0: if cb: cb('Chef autooam::hadoop_postinstall Step') # must be done on every InfiniDB node! # TODO: consider moving this to an ansible playbook for m in self._machines.keys(): if not m == "em1": if ( vagboxes.get_os_family(self._config['boxtype']) == 'ubuntu' or\ vagboxes.get_os_family(self._config['boxtype']) == 'debian' ): cmd = 'sudo apt-get -y install libhdfs0' else: cmd = 'sudo yum -y install hadoop-libhdfs' ret = self.shell_command(m, cmd) if ret != 0: break if ret != 0: Log.error('There were errors during Hadoop installation, did not attempt InfiniDB install') return ret if cb: cb('InfiniDB install Step') Log.info('Performing InfiniDB install') recipe = 'autooam::binary_install' if self._config['binary'] else 'autooam::package_install' # Use EM to install Infinidb if self._emapi and common.props['cluster.cluster.use_em_for_dbinstall']: # Install EM (if applicable) ret = self._em_install(cb) if ret != 0: return ret # install db step ret = self._em_installdb(cb) # Install Infinidb through execution of ansible playbooks else: if self._chefmode: ret = self._run_chef_recipe(recipe) else: ret = self._run_ansible_playbook(recipe) if ret != 0: Log.error('There were errors installing InfiniDB') return ret if self._emapi: # Install and attach to EM (if applicable) ret = self._em_install(cb) if ret != 0: return ret ret = self._em_attach( cb=cb ) return ret