def run(options)
      check_privileges
      AgentConfig.root_dir = AgentConfig.right_link_root_dirs

      if RightScale::Platform.windows?
        cleanup_certificates(options)
        # Write state file to indicate to RightScaleService that it should not
        # enter the rebooting state (which is the default behavior when the
        # RightScaleService starts).
        reenroller_state = {:reenroll => true}
        File.open(STATE_FILE, "w") { |f| f.write reenroller_state.to_json }
        print 'Restarting RightScale service...' if options[:verbose]
        res = system('net start RightScale')
        puts to_ok(res) if options[:verbose]
      else
        print 'Stopping RightLink daemon...' if options[:verbose]
        pid_file = AgentConfig.pid_file('instance')
        pid = pid_file ? pid_file.read_pid[:pid] : nil
        system('/opt/rightscale/bin/rchk --stop')
        # Wait for agent process to terminate
        retries = 0
        while process_running?(pid) && retries < 40
          sleep(0.5)
          retries += 1
          print '.' if options[:verbose]
        end
        puts to_ok(!process_running?(pid)) if options[:verbose]
        # Kill it if it's still alive after ~ 20 sec
        if process_running?(pid)
          print 'Forcing RightLink daemon to exit...' if options[:verbose]
          res = Process.kill('KILL', pid) rescue nil
          puts to_ok(res) if options[:verbose]
        end
        cleanup_certificates(options)

        # Resume option bypasses cloud state initialization so that we can
        # override the user data
        puts((options[:resume] ? 'Resuming' : 'Restarting') + ' RightLink daemon...') if options[:verbose]
        action = (options[:resume] ? 'resume' : 'start')
        res = system("/etc/init.d/rightlink #{action} > /dev/null")
      end
      true
    end
def run(options)
      check_privileges
      AgentConfig.root_dir = AgentConfig.right_link_root_dirs

      if RightScale::Platform.windows?
        cleanup_certificates(options)
        # Write state file to indicate to RightScaleService that it should not
        # enter the rebooting state (which is the default behavior when the
        # RightScaleService starts).
        reenroller_state = {:reenroll => true}
        File.open(STATE_FILE, "w") { |f| f.write reenroller_state.to_json }
        print 'Restarting RightScale service...' if options[:verbose]
        res = system('net start RightScale')
        puts to_ok(res) if options[:verbose]
      else
        print 'Stopping RightLink daemon...' if options[:verbose]
        pid_file = AgentConfig.pid_file('instance')
        pid = pid_file ? pid_file.read_pid[:pid] : nil
        system('/opt/rightscale/bin/rchk --stop')
        # Wait for agent process to terminate
        retries = 0
        while process_running?(pid) && retries < 40
          sleep(0.5)
          retries += 1
          print '.' if options[:verbose]
        end
        puts to_ok(!process_running?(pid)) if options[:verbose]
        # Kill it if it's still alive after ~ 20 sec
        if process_running?(pid)
          print 'Forcing RightLink daemon to exit...' if options[:verbose]
          res = Process.kill('KILL', pid) rescue nil
          puts to_ok(res) if options[:verbose]
        end
        cleanup_certificates(options)

        # Resume option bypasses cloud state initialization so that we can
        # override the user data
        puts((options[:resume] ? 'Resuming' : 'Restarting') + ' RightLink daemon...') if options[:verbose]
        action = (options[:resume] ? 'resume' : 'start')
        res = system("/etc/init.d/rightlink #{action} > /dev/null")
      end
      true
    end
Trigger re-enrollment

 === Return
 true:: Always return true