Trigger re-enrollment

 === Return
 true:: Always return true
978877
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
1219904
def renew?
      logger.debug("Watching Consul #{prefix} for changes")
      options = { recurse: true }
      changes = Diplomat::Kv.get(prefix, options, :wait, :wait)
      logger.info("Changes on #{prefix} detected") if changes
      changes
    rescue StandardError => e
      logger.error(e)
    end
687321
def reload(force=false)
      raise ArgumentError, 'Argument must be true or false.' unless [true, false].include?(force)
      if force || reload?
        flush_cache
        return true
      end
      false
    end
685046
def reload_interval=(interval)
      raise ArgumentError, 'Argument must be Integer.' unless interval.kind_of?(Integer)
      self.enable_reload = false if interval == 0  # Sett
      self.reload_interval = interval
    end
358987
private static void fireDefaultSREChanged(ISREInstall previous, ISREInstall current) {
		for (final Object listener : SRE_LISTENERS.getListeners()) {
			((ISREInstallChangedListener) listener).defaultSREInstallChanged(previous, current);
		}
	}
1198579
def trigger!(event, *args)
      event = event.to_sym

      if @listeners && @listeners[event]
        # TODO: We have to dup here because one trigger might remove another
        @listeners[event].dup.each do |listener|
          # Call the event on each listener
          listener.call(*args)
        end
      end
    end
499592
def change(self, event):
        """"""

        uuid = event.data['uuid']
        status = event.data['status']

        if status not in ['Open', 'Pending', 'Accepted', 'Denied', 'Resend']:
            self.log('Erroneous status for enrollment requested!', lvl=warn)
            return

        self.log('Changing status of an enrollment', uuid, 'to', status)

        enrollment = objectmodels['enrollment'].find_one({'uuid': uuid})
        if enrollment is not None:
            self.log('Enrollment found', lvl=debug)
        else:
            return

        if status == 'Resend':
            enrollment.timestamp = std_now()
            enrollment.save()
            self._send_invitation(enrollment, event)
            reply = {True: 'Resent'}
        else:
            enrollment.status = status
            enrollment.save()
            reply = {True: enrollment.serializablefields()}

        if status == 'Accepted' and enrollment.method == 'Enrolled':
            self._create_user(enrollment.name, enrollment.password, enrollment.email, 'Invited', event.client.uuid)
            self._send_acceptance(enrollment, None, event)

        packet = {
            'component': 'hfos.enrol.enrolmanager',
            'action': 'change',
            'data': reply
        }
        self.log('packet:', packet, lvl=verbose)
        self.fireEvent(send(event.client.uuid, packet))
        self.log('Enrollment changed', lvl=debug)
28345
def is_launch?(msg, exp_class)

      if exp_class != Ruote::Exp::DefineExpression
        false
      elsif %w[ launch regenerate ].include?(msg['action'])
        true
      else
        (msg['trigger'] == 'on_re_apply')
          # let re-apply "define" blocks, as in Ruote.define {}
      end
    end
603163
def reload(self):
        
        config = self._default_configuration()
        if self._file_path:
            config.update(self._load_config_file())
        if config != self._values:
            self._values = config
            return True
        return False
258297
def autorenew_activate(cls, fqdn):
        """"""
        fqdn = fqdn.lower()

        result = cls.call('domain.autorenew.activate', fqdn)

        return result
784880
def is_forced_retry(self, method, status_code):
        
        if self.method_whitelist and method.upper() not in self.method_whitelist:
            return False

        return self.status_forcelist and status_code in self.status_forcelist
1225508
def ensure_started(self):
        """"""
        if self.active:
            return self
        self._observer = self._observer_class(**self._observer_params)
        self.start()
        self._active = True
        return self
699569
def should_trigger(self, dt):
        
        return self.composer(
            self.first.should_trigger,
            self.second.should_trigger,
            dt
        )
929829
function Trigger (opts) {
  opts = opts || {}
  if (!this.start || !this.stop) {
    throw new Error('start, stop are required members')
  }
  this.startDate = opts.startDate || new Date()
  this.endDate = opts.endDate || null
  this.stream = Observable.create(function (observer) { this.observer = observer }.bind(this))
}
1106655
private boolean entryInRefreshProbationAccessed(final Entry<K, V> e, final long now) {
    long  nrt = e.getRefreshProbationNextRefreshTime();
    if (nrt > now) {
      reviveRefreshedEntry(e, nrt);
      return true;
    }
    return false;
  }
838703
def no_going_back(confirmation):
    
    if not confirmation:
        confirmation = 'yes'

    prompt = ('This action cannot be undone! Type "%s" or press Enter '
              'to abort' % confirmation)

    ans = click.prompt(prompt, default='', show_default=False)
    if ans.lower() == str(confirmation):
        return True

    return False
1056262
function lastRefreshInsertionPoint() {
                    var slotNext = refreshEnd;
                    while (!slotNext.firstInSequence) {
                        slotNext = slotNext.prev;

                        if (slotNext === refreshStart) {
                            return null;
                        }
                    }

                    return slotNext;
                }