#NEWLINE# def item_create( item , item_id , item_type , create = 'create' , extra_args = None , cibfile = None ) : #NEWLINE# #INDENT# '\n    Create an item via pcs command\n    (mainly for use with the pcs state module)\n\n    item\n        config, property, resource, constraint etc.\n    item_id\n        id of the item\n    item_type\n        item type\n    create\n        create command (create or set f.e., default: create)\n    extra_args\n        additional options for the pcs command\n    cibfile\n        use cibfile instead of the live CIB\n    ' #NEWLINE# cmd = [ 'pcs' ] #NEWLINE# if isinstance ( cibfile , six . string_types ) : #NEWLINE# #INDENT# cmd += [ '-f' , cibfile ] #NEWLINE# #UNINDENT# if isinstance ( item , six . string_types ) : #NEWLINE# #INDENT# cmd += [ item ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if isinstance ( item , ( list , tuple ) ) : #NEWLINE# #INDENT# cmd += item #NEWLINE# #UNINDENT# #UNINDENT# if ( item in [ 'constraint' ] ) : #NEWLINE# #INDENT# if isinstance ( item_type , six . string_types ) : #NEWLINE# #INDENT# cmd += [ item_type ] #NEWLINE# #UNINDENT# #UNINDENT# if isinstance ( create , six . string_types ) : #NEWLINE# #INDENT# cmd += [ create ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if isinstance ( create , ( list , tuple ) ) : #NEWLINE# #INDENT# cmd += create #NEWLINE# #UNINDENT# #UNINDENT# if ( item not in [ 'constraint' ] ) : #NEWLINE# #INDENT# cmd += [ item_id ] #NEWLINE# if isinstance ( item_type , six . string_types ) : #NEWLINE# #INDENT# cmd += [ item_type ] #NEWLINE# #UNINDENT# #UNINDENT# if isinstance ( extra_args , ( list , tuple ) ) : #NEWLINE# #INDENT# if ( item in [ 'constraint' ] ) : #NEWLINE# #INDENT# extra_args = ( extra_args + [ 'id={0}' . format ( item_id ) ] ) #NEWLINE# #UNINDENT# cmd += extra_args #NEWLINE# #UNINDENT# return __salt__ [ 'cmd.run_all' ] ( cmd , output_loglevel = 'trace' , python_shell = False )