@@ -67,23 +67,34 @@ def modulefile(self):
67
67
def templatefile (self ):
68
68
return "%s.%s" % (self .container .templatefile , self .module_extension )
69
69
70
- def uninstall (self , name , view = None , force = False ):
70
+ def view_uninstall (self , view , name , force = False ):
71
71
"""
72
- Given a unique resource identifier, uninstall a module. If a view
73
- name is provided, assume we only want to uninstall from the view
72
+ Uninstall a module from a view.
74
73
"""
75
74
module = self .new_module (name )
76
75
77
- # We need to look for the module in all views and show to the user first
78
- views_with_module = set ()
76
+ # Ask before deleting anything!
77
+ if not force :
78
+ msg = name + "?"
79
+ if not utils .confirm_uninstall (msg , force ):
80
+ return
81
+
82
+ # Only uninstall from the view
83
+ if view not in self .views :
84
+ logger .exit ("View %s does not exist, cannot uninstall." % view )
85
+ return self .views [view ].uninstall (module .module_dir )
79
86
80
- # Only populate if the command is not directed to a view
81
- if not view :
87
+ def uninstall (self , name , force = False ):
88
+ """
89
+ Given a unique resource identifier, uninstall a module.
90
+ """
91
+ module = self .new_module (name )
82
92
83
- # If uninstalling the entire module, clean up symbolic links in all views
84
- for view_name , entry in self .views .items ():
85
- if entry .exists (module .module_dir ):
86
- views_with_module .add (view_name )
93
+ # We need to look for the module in all views and show to the user first
94
+ views_with_module = set ()
95
+ for view_name , entry in self .views .items ():
96
+ if entry .exists (module .module_dir ):
97
+ views_with_module .add (view_name )
87
98
88
99
# Ask before deleting anything!
89
100
if not force :
@@ -96,12 +107,6 @@ def uninstall(self, name, view=None, force=False):
96
107
if not utils .confirm_uninstall (msg , force ):
97
108
return
98
109
99
- # Only uninstall from the view
100
- if view :
101
- if view not in self .views :
102
- logger .exit ("View %s does not exist, cannot uninstall." % view )
103
- return self .views [view ].uninstall (module .module_dir )
104
-
105
110
# Podman needs image deletion
106
111
self .container .delete (module .name )
107
112
@@ -124,8 +129,8 @@ def uninstall(self, name, view=None, force=False):
124
129
)
125
130
126
131
# If uninstalling the entire module, clean up symbolic links in all views
127
- for view_name , view in self . views . items () :
128
- view .uninstall (module .module_dir )
132
+ for view_name in views_with_module :
133
+ self . views [ view_name ] .uninstall (module .module_dir )
129
134
130
135
# parent of versioned directory has module .version
131
136
module_dir = os .path .dirname (module .module_dir )
0 commit comments