• Kirill Smelkov's avatar
    slapos/recipe/postgresql: Do not leave half-installed postgresql instance · b7f00def
    Kirill Smelkov authored
    In case there are errors when creating cluster / setting up its
    configuration files, currently we leave pgsql database left
    half-installed and next time instantiation runs do not do anything,
    because os.path.exists(pgdata) is already true.
    
    I've personally hit this situation via providing ipv4 and ipv6
    parameters as strings and the recipe wanted to do `ipv4.join(ipv6)` but this
    works only for sets and raises for strings.
    
    What is worse is that the above error becomes hidden in our default
    setup, because webrunner tries to do instantiation _several_ times, and
    on the second run instantiation succeeds, because pgdata directory
    already exists and recipe thinks there is nothing to do _and_ webrunner
    already removed instance.log from previous run.
    
    So do not hide errors, and if we see there are problems, remove the
    wholly created pgsql database directory.
    
    /cc @kazuhiko, @jerome
    /proposed-for-review on !29
    b7f00def
__init__.py 8.6 KB