<commit_before>
module CORL
module Vagrant
  
  #
  # Since we can execute CORL actions from within Vagrant on a combination of
  # Vagrant VMs and remote server instances we need a way to tap into the 
  # Vagrant environment and operate on CORL configured Vagrant machines.
  # 
  # This command is set in the CORL launcher Vagrant command plugin execute 
  # method.  It is then accessible anywhere within CORL if we have used that
  # Vagrant command as an execution gateway.  If not it will be nil, giving us
  # a convienient method for checking whether we are executing through Vagrant
  # which is used in the CORL Vagrant {Node} and {Machine} plugins.
  #  
  @@command = nil
  
  def self.command=command
    @@command = command
  end
  
  def self.command
    @@command
  end  
end
end

#-------------------------------------------------------------------------------

module Nucleon
module Plugin
class CloudAction < CORL.plugin_class(:nucleon, :action)
  
  #-----------------------------------------------------------------------------
  # Constuctor / Destructor
  
  def normalize(reload)
    super
    @network = init_network(extension_set(:network_provider, :corl)) unless reload 
  end
  
  #-----------------------------------------------------------------------------
  # Property accessor / modifiers
  
  def self.namespace
    :corl
  end
  
  #---
  
  def network=network
    @network = network
  end
  
  def network
    @network
  end
  
  #---
    
  def configure
    super do
      yield if block_given?
      node_config
    end
  end
          
  #-----------------------------------------------------------------------------
  # Settings
  
  def node_config
    node_plugins = CORL.loaded_plugins(:CORL, :node)
    
    register :parallel, :bool, true, 'corl.core.action.options.parallel'
    register :net_remote, :str, :edit, 'corl.core.action.options.net_remote'
    register :net_provider, :str, :corl, 'corl.core.action.options.net_provider' do |value|
      value           = value.to_sym
      network_plugins = CORL.loaded_plugins(:CORL, :network)
      
      unless network_plugins.keys.include?(value)
        warn('corl.core.action.errors.network_provider', { :value => value, :choices => network_plugins.keys.join(", ") })
        next false 
      end
      true
    end
    register :node_provider, :str, :local, 'corl.core.action.options.node_provider' do |value|
      value          = value.to_sym      
      node_providers = node_plugins.keys
      
      unless CORL.vagrant? || node_providers.include?(value)
        warn('corl.core.action.errors.node_provider', { :value => value, :choices => node_providers.join(", ") })
        next false
      end
      true  
    end
    register :nodes, :array, [], 'corl.core.action.options.nodes' do |values|
      success = true
      values.each do |value|
        if info = CORL.plugin_class(:CORL, :node).translate_reference(value)
          if ! node_plugins.keys.include?(info[:provider].to_sym) || info[:name].empty?
            warn('corl.core.action.errors.nodes', { :value => value, :provider => info[:provider],  :name => info[:name] })
            success = false
          end
        end
      end
      success
    end
  end
  
  #---
         
  def node_ignore
    [ :parallel, :net_remote, :net_provider, :node_provider, :nodes ]
  end
  
  #-----------------------------------------------------------------------------
  # Operations
  
  def validate(node = nil, network = nil)
    super(node, network)
  end
  
  #---
   
  def execute(use_network = true, &code)
    if use_network<commit_msg>Removing the network options in the node_ignore method of the cloud action provider.<commit_after>
module CORL
module Vagrant
  
  #
  # Since we can execute CORL actions from within Vagrant on a combination of
  # Vagrant VMs and remote server instances we need a way to tap into the 
  # Vagrant environment and operate on CORL configured Vagrant machines.
  # 
  # This command is set in the CORL launcher Vagrant command plugin execute 
  # method.  It is then accessible anywhere within CORL if we have used that
  # Vagrant command as an execution gateway.  If not it will be nil, giving us
  # a convienient method for checking whether we are executing through Vagrant
  # which is used in the CORL Vagrant {Node} and {Machine} plugins.
  #  
  @@command = nil
  
  def self.command=command
    @@command = command
  end
  
  def self.command
    @@command
  end  
end
end

#-------------------------------------------------------------------------------

module Nucleon
module Plugin
class CloudAction < CORL.plugin_class(:nucleon, :action)
  
  #-----------------------------------------------------------------------------
  # Constuctor / Destructor
  
  def normalize(reload)
    super
    @network = init_network(extension_set(:network_provider, :corl)) unless reload 
  end
  
  #-----------------------------------------------------------------------------
  # Property accessor / modifiers
  
  def self.namespace
    :corl
  end
  
  #---
  
  def network=network
    @network = network
  end
  
  def network
    @network
  end
  
  #---
    
  def configure
    super do
      yield if block_given?
      node_config
    end
  end
          
  #-----------------------------------------------------------------------------
  # Settings
  
  def node_config
    node_plugins = CORL.loaded_plugins(:CORL, :node)
    
    register :parallel, :bool, true, 'corl.core.action.options.parallel'
    register :net_remote, :str, :edit, 'corl.core.action.options.net_remote'
    register :net_provider, :str, :corl, 'corl.core.action.options.net_provider' do |value|
      value           = value.to_sym
      network_plugins = CORL.loaded_plugins(:CORL, :network)
      
      unless network_plugins.keys.include?(value)
        warn('corl.core.action.errors.network_provider', { :value => value, :choices => network_plugins.keys.join(", ") })
        next false 
      end
      true
    end
    register :node_provider, :str, :local, 'corl.core.action.options.node_provider' do |value|
      value          = value.to_sym      
      node_providers = node_plugins.keys
      
      unless CORL.vagrant? || node_providers.include?(value)
        warn('corl.core.action.errors.node_provider', { :value => value, :choices => node_providers.join(", ") })
        next false
      end
      true  
    end
    register :nodes, :array, [], 'corl.core.action.options.nodes' do |values|
      success = true
      values.each do |value|
        if info = CORL.plugin_class(:CORL, :node).translate_reference(value)
          if ! node_plugins.keys.include?(info[:provider].to_sym) || info[:name].empty?
            warn('corl.core.action.errors.nodes', { :value => value, :provider => info[:provider],  :name => info[:name] })
            success = false
          end
        end
      end
      success
    end
  end
  
  #---
         
  def node_ignore
    [ :parallel, :node_provider, :nodes ]
  end
  
  #-----------------------------------------------------------------------------
  # Operations
  
  def validate(node = nil, network = nil)
    super(node, network)
  end
  
  #---
   
  def execute(use_network = true, &code)
    if use_network
{'fraction_non_alphanumeric': 0.19356170037144035, 'fraction_numerical': 0.0, 'mean_word_length': 1.779051987767584, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 17, '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': '904004', 'n_tokens_mistral': 2104, 'n_tokens_neox': 2049, 'n_words': 569}