<commit_before>desc "Imports cron jobs from tomcats' csv files"
namespace :import do
  task :facter => :environment do
    Dir.glob("data/system/*.yml").each do |file|
      #server
      server_name = file.split("/").last.gsub(/\.yml$/,"")
      puts "Updating facts for #{server_name}" if ENV['DEBUG'].present?
      server = Server.find_or_generate(server_name)
      puts "Successfully created Server: #{server.name}" if server.just_created
      #facts
      facts = YAML.load_file(file)
      #update facts in server
      %w(rubyversion facterversion puppetversion).each do |key|
        server.send("#{key}=", facts[key]) if facts.has_key?(key)
      end
      os = "#{facts["operatingsystem"]} #{facts["operatingsystemrelease"]}"
      server.operatingsystemrelease = os if os.present?<commit_msg>Import Server#virtual boolean from facts when possible<commit_after>desc "Imports cron jobs from tomcats' csv files"
namespace :import do
  task :facter => :environment do
    Dir.glob("data/system/*.yml").each do |file|
      #server
      server_name = file.split("/").last.gsub(/\.yml$/,"")
      puts "Updating facts for #{server_name}" if ENV['DEBUG'].present?
      server = Server.find_or_generate(server_name)
      puts "Successfully created Server: #{server.name}" if server.just_created
      #facts
      facts = YAML.load_file(file)
      #update version facts in server
      %w(rubyversion facterversion puppetversion).each do |key|
        server.send("#{key}=", facts[key]) if facts.has_key?(key)
      end
      os = "#{facts["operatingsystem"]} #{facts["operatingsystemrelease"]}"
      server.operatingsystemrelease = os if os.present?
      #virtual or not ?
      server.virtual = (facts["virtual"] != "physical")
      #save server
{'fraction_non_alphanumeric': 0.13977272727272727, 'fraction_numerical': 0.0, 'mean_word_length': 3.538659793814433, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6512090', 'n_tokens_mistral': 553, 'n_tokens_neox': 534, 'n_words': 136}