Move split_command to utils

This patch moves _split_command from IronicPythoAgent class to
utils module. Also fixes import looping.

Change-Id: Ibf2b0b3885286b9ad78db64cf9e195de4ad627ad
This commit is contained in:
Alexander Gordeev
2014-04-07 17:44:37 +04:00
parent cae81837ce
commit 9171ce659d
2 changed files with 12 additions and 9 deletions
ironic_python_agent

@ -40,3 +40,14 @@ def execute(*cmd, **kwargs):
LOG.debug(gtu._('Command stdout is: "%s"') % result[0])
LOG.debug(gtu._('Command stderr is: "%s"') % result[1])
return result
def split_command(command_name):
command_parts = command_name.split('.', 1)
if len(command_parts) != 2:
#NOTE(agordeev): fix to avoid import looping
from ironic_python_agent import errors
raise errors.InvalidCommandError(
'Command name must be of the form <extension>.<name>')
return (command_parts[0], command_parts[1])