Exemple #1
0
    def testSuccess(self):
        p = PlaybookMgr( 'testbook' )
        p.write_inventory( 'testinv', { 'all' : ['foo.calpont.com', 'bar.calpont.com'] } )
        
        inv = p.read_inventory( 'testinv' )
        self.assertEquals(inv['all'][0], 'foo.calpont.com')
        self.assertEquals(inv['all'][1], 'bar.calpont.com')
        
        ref_file = '%s/test_testinv' % os.path.dirname(__file__)
        self.assertTrue( testutils.file_compare(ref_file, '%s/testinv' % p.get_rootdir()))
        
        p.config_ssh( 'root', 'some_key_data1234567890' )

        ref_file = '%s/test_ansible.cfg' % os.path.dirname(__file__)
        self.assertTrue( testutils.file_compare(ref_file, '%s/ansible.cfg' % p.get_rootdir()))

        ref_file = '%s/test_private_key' % os.path.dirname(__file__)
        self.assertTrue( testutils.file_compare(ref_file, '%s/.ssh/private_key' % p.get_rootdir()))
        
        
        shutil.rmtree( p.get_rootdir() )