planet.py
class PlanetChanger(rose.macro.MacroBase):
"""Switch between planets."""
change_text = '{0} to {1}'
opts_to_change = [("env", "WORLD")]
planets = ["Mercury", "Venus", "Earth", "Mars", "Jupiter", "Saturn",
"Uranus", "Neptune", "Eris"]
def transform(self, config, meta_config=None):
"""Transform configuration and return it with a list of changes."""
for section, option in self.opts_to_change:
node = config.get([section, option])
# Do something to the configuration.
return config, self.reports