<commit_before>require 'vagrant-simplecloud/helpers/client'

module VagrantPlugins
  module SimpleCloud
    module Actions
      class PowerOn
        include Helpers::Client

        def initialize(app, env)
          @app = app
          @machine = env[:machine]
          @client = client
          @simple_client = simple_client
          @logger = Log4r::Logger.new('vagrant::simplecloud::power_on')
        end

        def call(env)
          # submit power on droplet request
          result = JSON.parse(@simple_client.droplet_actions.power_on(droplet_id: @machine.id.to_s))
          #result = @client.post("/v2/droplets/#{@machine.id}/actions", {
            #:type => 'power_on'
          #})

          # wait for request to complete
          env[:ui].info I18n.t('vagrant_simple_cloud.info.powering_on')
          @client.wait_for_event(env, result['action']['id'])

          # refresh droplet state with provider
          Provider.droplet(@machine, :refresh => true)

          @app.call(env)
        end
      end<commit_msg>fix power_on<commit_after>require 'vagrant-simplecloud/helpers/client'

module VagrantPlugins
  module SimpleCloud
    module Actions
      class PowerOn
        include Helpers::Client

        def initialize(app, env)
          @app = app
          @machine = env[:machine]
          @client = client
          @simple_client = simple_client
          @logger = Log4r::Logger.new('vagrant::simplecloud::power_on')
        end

        def call(env)
          # submit power on droplet request
          result = @simple_client.post("/v2/droplets/#{@machine.id}/actions", {:type => 'power_on'})

          # wait for request to complete
          env[:ui].info I18n.t('vagrant_simple_cloud.info.powering_on')
          @client.wait_for_event(env, result['action']['id'])

          # refresh droplet state with provider
          Provider.droplet(@machine, :refresh => true)

          @app.call(env)
        end
      end
{'fraction_non_alphanumeric': 0.11178861788617886, 'fraction_numerical': 0.0040650406504065045, 'mean_word_length': 2.2762063227953413, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '5314691', 'n_tokens_mistral': 584, 'n_tokens_neox': 561, 'n_words': 117}