#NEWLINE# @ operation #NEWLINE# def repo( state , host , name , baseurl , present = True , description = None , gpgcheck = True , enabled = True ) : #NEWLINE# #INDENT# '\n    Manage yum repositories.\n\n    + name: filename for the repo (in ``/etc/yum/repos.d/``)\n    + baseurl: the baseurl of the repo\n    + present: whether the ``.repo`` file should be present\n    + description: optional verbose description\n    + gpgcheck: whether set ``gpgcheck=1``\n    ' #NEWLINE# description = ( description or name ) #NEWLINE# filename = '/etc/yum.repos.d/{0}.repo' . format ( name ) #NEWLINE# if ( not present ) : #NEWLINE# #INDENT# return files . file ( state , host , filename , present = False ) #NEWLINE# #UNINDENT# repo = '\n[{name}]\nname={description}\nbaseurl={baseurl}\ngpgcheck={gpgcheck}\nenabled={enabled}\n' . format ( name = name , baseurl = baseurl , description = description , gpgcheck = ( 1 if gpgcheck else 0 ) , enabled = ( 1 if enabled else 0 ) ) #NEWLINE# repo = StringIO ( repo ) #NEWLINE# commands = files . put ( state , host , repo , filename ) #NEWLINE# return commands