def _change_state(name, action, expected, *args, **kwargs):
 pre = state(name)
 if ((action != 'restart') and (pre == expected)):
  return {'result': False, 'state': {'old': expected, 'new': expected}, 'comment': "Container '{0}' already {1}".format(name, expected)}
 _client_wrapper(action, name, *args, **kwargs)
 _clear_context()
 try:
  post = state(name)
 except CommandExecutionError:
  post = None
 ret = {'result': (post == expected), 'state': {'old': pre, 'new': post}}
 return ret

def _change_state ( name , action , expected , * args , ** kwargs ) : pre = state ( name ) if ( ( action != 'restart' ) and ( pre == expected ) ) : return { 'result' : False , 'state' : { 'old' : expected , 'new' : expected } , 'comment' : "Container '{0}' already {1}" . format ( name , expected ) } _client_wrapper ( action , name , * args , ** kwargs ) _clear_context ( ) try : post = state ( name ) except CommandExecutionError : post = None ret = { 'result' : ( post == expected ) , 'state' : { 'old' : pre , 'new' : post } } return ret
change the state of a container .