本文整理汇总了Golang中github.com/aws/amazon-ssm-agent/agent/log.T.Info方法的典型用法代码示例。如果您正苦于以下问题:Golang T.Info方法的具体用法?Golang T.Info怎么用?Golang T.Info使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/aws/amazon-ssm-agent/agent/log.T
的用法示例。
在下文中一共展示了T.Info方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: initializeBookkeepingLocations
// initializeBookkeepingLocations - initializes all folder locations required for bookkeeping
func initializeBookkeepingLocations(log logger.T, instanceID string) bool {
//Create folders pending, current, completed, corrupt under the location DefaultLogDirPath/<instanceId>
log.Info("Initializing bookkeeping folders")
initStatus := true
folders := []string{
appconfig.DefaultLocationOfPending,
appconfig.DefaultLocationOfCurrent,
appconfig.DefaultLocationOfCompleted,
appconfig.DefaultLocationOfCorrupt}
for _, folder := range folders {
directoryName := path.Join(appconfig.DefaultDataStorePath,
instanceID,
appconfig.DefaultCommandRootDirName,
appconfig.DefaultLocationOfState,
folder)
err := fileutil.MakeDirs(directoryName)
if err != nil {
log.Errorf("Encountered error while creating folders for internal state management. %v", err)
initStatus = false
break
}
}
return initStatus
}
示例2: processRegistration
// processRegistration handles flags related to the registration category
func processRegistration(log logger.T) (exitCode int) {
if activationCode == "" || activationID == "" || region == "" {
// clear registration
if clear {
return clearRegistration(log)
}
flagUsage()
return 1
}
// check if previously registered
if !force && registration.InstanceID() != "" {
confirmation, err := askForConfirmation()
if err != nil {
log.Errorf("Registration failed due to %v", err)
return 1
}
if !confirmation {
log.Info("Registration canceled by user")
return 1
}
}
managedInstanceID, err := registerManagedInstance()
if err != nil {
log.Errorf("Registration failed due to %v", err)
return 1
}
log.Infof("Successfully registered the instance with AWS SSM using Managed instance-id: %s", managedInstanceID)
return 0
}
示例3: stop
func stop(log logger.T, cpm *coremanager.CoreManager) {
log.Info("Stopping agent")
log.Flush()
cpm.Stop()
log.Info("Bye.")
log.Flush()
}
示例4: clearRegistration
// clearRegistration clears any existing registration data
func clearRegistration(log logger.T) (exitCode int) {
err := registration.UpdateServerInfo("", "", "", "")
if err == nil {
log.Info("Registration information has been removed from the instance.")
return 0
}
log.Errorf("error clearing the instance registration information. %v\nTry running as sudo/administrator.", err)
return 1
}
示例5: blockUntilSignaled
func blockUntilSignaled(log logger.T) {
// Below channel will handle all machine initiated shutdown/reboot requests.
// Set up channel on which to receive signal notifications.
// We must use a buffered channel or risk missing the signal
// if we're not ready to receive when the signal is sent.
c := make(chan os.Signal, 1)
// Listening for OS signals is a blocking call.
// Only listen to signals that require us to exit.
// Otherwise we will continue execution and exit the program.
signal.Notify(c, os.Interrupt, os.Kill, syscall.SIGTERM)
s := <-c
log.Info("Got signal:", s, " value:", s.Signal)
}
示例6: processSendReply
func processSendReply(log log.T, messageID string, mdsService service.Service, payloadDoc messageContracts.SendReplyPayload, processorStopPolicy *sdkutil.StopPolicy) {
payloadB, err := json.Marshal(payloadDoc)
if err != nil {
log.Error("could not marshal reply payload!", err)
}
payload := string(payloadB)
log.Info("Sending reply ", jsonutil.Indent(payload))
err = mdsService.SendReply(log, messageID, payload)
if err != nil {
sdkutil.HandleAwsError(log, err, processorStopPolicy)
}
}
示例7: RebootMachine
// RebootMachine reboots the machine
func RebootMachine(log log.T) {
log.Info("Executing reboot request...")
if RebootInitiated() {
return
}
syncObject.Lock()
defer syncObject.Unlock()
if err := reboot(log); err != nil {
log.Error("error in rebooting the machine", err)
return
}
rebootInitiated = true
}
示例8: SendReply
// SendReply calls the SendReply MDS API.
func (mds *sdkService) SendReply(log log.T, messageID string, payload string) (err error) {
uuid.SwitchFormat(uuid.CleanHyphen)
replyID := uuid.NewV4().String()
params := &ssmmds.SendReplyInput{
MessageId: aws.String(messageID), // Required
Payload: aws.String(payload), // Required
ReplyId: aws.String(replyID), // Required
}
log.Debug("Calling SendReply with params", params)
req, resp := mds.sdk.SendReplyRequest(params)
if err = mds.sendRequest(req); err != nil {
err = fmt.Errorf("SendReply Error: %v", err)
log.Debug(err)
} else {
log.Info("SendReply Response", resp)
}
return
}
示例9: AppendInfo
// AppendInfo adds info to UpdateContext StandardOut
func (out *UpdatePluginOutput) AppendInfo(log log.T, format string, params ...interface{}) {
message := fmt.Sprintf(format, params...)
log.Info(message)
out.Stdout = fmt.Sprintf("%v\n%v", out.Stdout, message)
}