On 02/03/2014 10:01 PM, Chris Lumens wrote:
This is done without introducing any new kickstart syntax. We just
check all
the groups listed and if any is an environment, select it. This should work
for deselecting environments too.
I'm worried about overloading the group syntax instead of using the @^
environment group yum syntax uses, since we're going to end up with a
group and an environment with the same ID at some point. RHEL makes me
especially nervous, since they don't always follow the convention of
using -environment in the environment IDs there. Yum makes no attempt to
look up environments when you give it @whatever, so I think we should
stick with that.
---
pyanaconda/packaging/yumpayload.py | 38 ++++++++++++++++++++++++++++++++----
pyanaconda/ui/gui/spokes/software.py | 10 +++++++++-
2 files changed, 43 insertions(+), 5 deletions(-)
diff --git a/pyanaconda/packaging/yumpayload.py b/pyanaconda/packaging/yumpayload.py
index 4b4a226..0cf380b 100644
--- a/pyanaconda/packaging/yumpayload.py
+++ b/pyanaconda/packaging/yumpayload.py
@@ -1365,8 +1365,20 @@ reposdir=%s
"""
self._selectYumGroup("core")
- if self.data.packages.default and self.environments:
- self.selectEnvironment(self.environments[0])
+ foundEnv = None
+
+ if self.environments:
+ if self.data.packages.default:
+ self.selectEnvironment(self.environments[0])
+ else:
+ # Look through all groups listed in the kickstart file. If one
+ # is an environment, select it now and then mark which one it is
+ # so we don't later try to select it as a group, too.
+ for (ndx, grp) in enumerate(self.data.packages.groupList):
+ if grp.name in self.environments:
+ self.selectEnvironment(grp.name)
+ foundEnv = ndx
+ break
for package in self.data.packages.packageList:
try:
@@ -1374,7 +1386,11 @@ reposdir=%s
except NoSuchPackage as e:
self._handleMissing(e)
- for group in self.data.packages.groupList:
+ for (ndx, group) in enumerate(self.data.packages.groupList):
+ # Skip any previously selected environment.
+ if ndx == foundEnv:
+ continue
+
default = False
optional = False
if group.include == GROUP_DEFAULT:
@@ -1394,7 +1410,21 @@ reposdir=%s
except NoSuchPackage as e:
self._handleMissing(e)
- for group in self.data.packages.excludedGroupList:
+ # And then do the same thing for removing environments as we did for
+ # adding them earlier.
+ foundEnv = None
+ if self.environments:
+ for (ndx, grp) in enumerate(self.data.packages.excludedGroupList):
+ if grp.name in self.environments:
+ self.deselectEnvironment(grp.name)
+ foundEnv = ndx
+ break
+
+ for (ndx, group) in enumerate(self.data.packages.excludedGroupList):
+ # Skip any previously selected environment.
+ if ndx == foundEnv:
+ continue
+
try:
self._deselectYumGroup(group.name)
except NoSuchGroup as e:
diff --git a/pyanaconda/ui/gui/spokes/software.py b/pyanaconda/ui/gui/spokes/software.py
index 1f92e3d..b35c5a0 100644
--- a/pyanaconda/ui/gui/spokes/software.py
+++ b/pyanaconda/ui/gui/spokes/software.py
@@ -250,8 +250,16 @@ class SoftwareSelectionSpoke(NormalSpoke):
self._environmentStore = self.builder.get_object("environmentStore")
self._environmentStore.clear()
+
+ # If we don't know what the environment is, perhaps it's listed in the
+ # kickstart file. Look in there to see.
if self.environment not in self.payload.environments:
- self.environment = None
+ for grp in self.data.packages.groupList:
+ if grp.name in self.payload.environments:
+ self.environment = grp.name
+ break
+ else:
+ self.environment = None
clasess = []
firstEnvironment = True