in order to avoid the duplication (here and in other code blocks) you could do 

    environment => $proxy_url ? { undef => undef, default => [ "http_proxy=${proxy_url}" , "https_proxy=${proxy_url}" ]},