Remove it from the bike, remove all bulbs, screws, metal clips etc etc, put the headlight in a low oven for 20 mins. (Do not place it lens down on the wire rack!) This will soften the glue that holds the two sections together and enable you to pull it apart. Then do your repairs, place both pieces back in the oven & again do not place it lens down. 20 mins later the glue will be soft enough to push the two pieces back together.
Job done and you can strut around the garage in the knowledge that you are truly a man that fixes stuff.