Don't remove the source directories in uninstall
Make a new remove action that will uninstall everything and will also completly clean up whatever is installed. Don't do this in uninstall since then running install again can't find the source directories to use for configuration. Fixes bug: #1189710 Change-Id: Ic08e8e2d7e9688dd006965a4ba9ae14a688a8c96
This commit is contained in:
@@ -14,14 +14,15 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from anvil.actions import prepare
|
||||
from anvil.actions import coverage
|
||||
from anvil.actions import install
|
||||
from anvil.actions import prepare
|
||||
from anvil.actions import remove
|
||||
from anvil.actions import restart
|
||||
from anvil.actions import start
|
||||
from anvil.actions import status
|
||||
from anvil.actions import stop
|
||||
from anvil.actions import test
|
||||
from anvil.actions import coverage
|
||||
from anvil.actions import uninstall
|
||||
|
||||
|
||||
@@ -35,6 +36,7 @@ _NAMES_TO_RUNNER = {
|
||||
'test': test.TestAction,
|
||||
'coverage': coverage.CoverageAction,
|
||||
'uninstall': uninstall.UninstallAction,
|
||||
'remove': remove.RemoveAction,
|
||||
}
|
||||
_RUNNER_TO_NAMES = dict((v, k) for k, v in _NAMES_TO_RUNNER.items())
|
||||
|
||||
|
||||
75
anvil/actions/remove.py
Normal file
75
anvil/actions/remove.py
Normal file
@@ -0,0 +1,75 @@
|
||||
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
||||
|
||||
# Copyright (C) 2012 Yahoo! Inc. All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from anvil import colorizer
|
||||
from anvil import log
|
||||
|
||||
from anvil.actions import base as action
|
||||
|
||||
LOG = log.getLogger(__name__)
|
||||
|
||||
|
||||
class RemoveAction(action.Action):
|
||||
@property
|
||||
def lookup_name(self):
|
||||
return 'uninstall'
|
||||
|
||||
def _order_components(self, components):
|
||||
components = super(RemoveAction, self)._order_components(components)
|
||||
components.reverse()
|
||||
return components
|
||||
|
||||
def _run(self, persona, component_order, instances):
|
||||
removals = ['install']
|
||||
general_package = "general"
|
||||
dependency_handler = self.distro.dependency_handler_class(
|
||||
self.distro, self.root_dir, instances.values())
|
||||
self._run_phase(
|
||||
action.PhaseFunctors(
|
||||
start=lambda i: LOG.info("Uninstalling packages"),
|
||||
run=lambda i: dependency_handler.uninstall(),
|
||||
end=None,
|
||||
),
|
||||
[general_package],
|
||||
{general_package: instances[general_package]},
|
||||
"uninstall",
|
||||
*removals
|
||||
)
|
||||
|
||||
self._run_phase(
|
||||
action.PhaseFunctors(
|
||||
start=lambda i: LOG.info('Uninstalling %s.', colorizer.quote(i.name)),
|
||||
run=lambda i: i.uninstall(),
|
||||
end=None,
|
||||
),
|
||||
component_order,
|
||||
instances,
|
||||
'uninstall',
|
||||
*removals
|
||||
)
|
||||
|
||||
removals += ['pre-install']
|
||||
self._run_phase(
|
||||
action.PhaseFunctors(
|
||||
start=lambda i: LOG.info('Post-uninstalling %s.', colorizer.quote(i.name)),
|
||||
run=lambda i: i.post_uninstall(),
|
||||
end=None,
|
||||
),
|
||||
component_order,
|
||||
instances,
|
||||
'post-uninstall',
|
||||
*removals
|
||||
)
|
||||
@@ -72,16 +72,3 @@ class UninstallAction(action.Action):
|
||||
"uninstall",
|
||||
*removals
|
||||
)
|
||||
|
||||
removals += ['install', 'download', 'configure', "download-patch", 'pre-install', 'post-install']
|
||||
self._run_phase(
|
||||
action.PhaseFunctors(
|
||||
start=lambda i: LOG.info('Post-uninstalling %s.', colorizer.quote(i.name)),
|
||||
run=lambda i: i.post_uninstall(),
|
||||
end=None,
|
||||
),
|
||||
component_order,
|
||||
instances,
|
||||
'post-uninstall',
|
||||
*removals
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user