def update_codex(module):
 params = module.params
 changed = False
 codex = codex_list(module)
 fresh = codex_fresh(codex, module)
 if module.check_mode:
  if (not params['name']):
   if (not fresh):
    changed = True
   module.exit_json(changed=changed, msg='would have updated Codex')
 elif ((not fresh) or (params['name'] and (params['state'] == 'latest'))):
  module.run_command_environ_update.update(dict(SILENT='1'))
  cmd_scribe = ('%s update' % SORCERY['scribe'])
  (rc, stdout, stderr) = module.run_command(cmd_scribe)
  if (rc != 0):
   module.fail_json(msg=('unable to update Codex: ' + stdout))
  if (codex != codex_list(module)):
   changed = True
  if (not params['name']):
   module.exit_json(changed=changed, msg='successfully updated Codex')

def update_codex ( module ) : params = module . params changed = False codex = codex_list ( module ) fresh = codex_fresh ( codex , module ) if module . check_mode : if ( not params [ 'name' ] ) : if ( not fresh ) : changed = True module . exit_json ( changed = changed , msg = 'would have updated Codex' ) elif ( ( not fresh ) or ( params [ 'name' ] and ( params [ 'state' ] == 'latest' ) ) ) : module . run_command_environ_update . update ( dict ( SILENT = '1' ) ) cmd_scribe = ( '%s update' % SORCERY [ 'scribe' ] ) ( rc , stdout , stderr ) = module . run_command ( cmd_scribe ) if ( rc != 0 ) : module . fail_json ( msg = ( 'unable to update Codex: ' + stdout ) ) if ( codex != codex_list ( module ) ) : changed = True if ( not params [ 'name' ] ) : module . exit_json ( changed = changed , msg = 'successfully updated Codex' )
update grimoire collections .