def start_nodes(self): """ invoke cloudinitd to start nodes """ if self.state!=CONFIGURED: raise ApeException('cannot start nodes when troop state is ' + self.state) chdir(self.target_directory) try: cloudinitd(argv=['boot', 'troop-launch.conf', '-n', self.launch_name]) self.state=RUNNING except: self.state=FAILED
def stop_nodes(self): """ invoke cloudinitd to stop all nodes """ if self.state!=RUNNING and self.state!=FAILED: raise ApeException('cannot stop nodes when troop state is ' + self.state) chdir(self.target_directory) cloudinitd(argv=['terminate', self.launch_name])