Merge onion::service absent support from tor
[mirror/dsa-puppet.git] / modules / onion / manifests / service.pp
index f4c39b3..330add7 100644 (file)
@@ -26,12 +26,6 @@ define onion::service (
                $onion_hn = onion_tor_service_hostname($name)
                if $onion_hn {
                        $hostname_without_onion = regsubst($onion_hn, '\.onion$', '')
-                       @@concat::fragment { "onion::balance::instance::$name::$fqdn":
-                               target  => "/etc/onionbalance/config.yaml",
-                               content => "      - address: ${hostname_without_onion}\n        name: ${hostname}-${name}\n",
-                               order   => "50-${name}-20",
-                               tag     => "onion::balance::$name",
-                       }
 
                        if ($direct) {
                                @@concat::fragment { "onion::balance::onionbalance-services.yaml::${name}":
@@ -47,5 +41,12 @@ define onion::service (
                                }
                        }
                }
+       } elsif ($my_ensure == "absent") {
+               file { "/var/lib/tor/onion/${name}":
+                       ensure => absent,
+                       force  => true,
+               }
+       } else {
+               fail("Invalid ensure value ${my_ensure}")
        }
 }