Peel, wash and chop the potatoes. Fry in hot oil for about 5 minutes, turning frequently. Peel onions and garlic. Halve onions and cut into rings, chop garlic very finely.
Put some rosemary aside for garnishing. Strip the rest of the rosemary needles from the stems and chop finely. Add rosemary, except for a little bit for sprinkling, onions and garlic to the potatoes and fry briefly.
Fill with tomatoes and stock. Cook for about 10 minutes. Season vigorously with salt and cayenne pepper. Add the beans and simmer again for about 10 minutes. Season to taste. Serve sprinkled with remaining rosemary and pepper.
It goes well with farmhouse bread.