func (agent *ecsAgent) initializeTaskENIDependencies(state dockerstate.TaskEngineState, taskEngine engine.TaskEngine) (error, bool) {
	// Check if the Agent process's pid  == 1, which means it's running without an init system
	if agent.os.Getpid() == initPID {
		// This is a terminal error. Bad things happen with invoking the
		// the ENI plugin when there's no init process in the pid namesapce.
		// Specifically, the DHClient processes that are started as children
		// of the Agent will not be reaped leading to the ENI device
		// disappearing until the Agent is killed.
		return errors.New("agent is not started with an init system"), true
	}

	// Set VPC and Subnet IDs for the instance
	if err, ok := agent.setVPCSubnet(); err != nil {
		return err, ok
	}

	// Validate that the CNI plugins exist in the expected path and that
	// they possess the right capabilities
	if err := agent.verifyCNIPluginsCapabilities(); err != nil {
		// An error here is terminal as it means that the plugins
		// do not support the ENI capability
		return err, true
	}

	// Load the pause container's image from the 'disk'
	if _, err := agent.pauseLoader.LoadImage(agent.ctx, agent.cfg, agent.dockerClient); err != nil {
		if pause.IsNoSuchFileError(err) || pause.UnsupportedPlatform(err) {
			// If the pause container's image tarball doesn't exist or if the
			// invocation is done for an unsupported platform, we cannot recover.
			// Return the error as terminal for these cases
			return err, true
		}
		return err, false
	}

	if err := agent.startUdevWatcher(state, taskEngine.StateChangeEvents()); err != nil {
		// If udev watcher was not initialized in this run because of the udev socket
		// file not being available etc, the Agent might be able to retry and succeed
		// on the next run. Hence, returning a false here for terminal bool
		return err, false
	}

	return nil, false
}
func (agent *ecsAgent) initializeTaskENIDependencies(state dockerstate.TaskEngineState, taskEngine engine.TaskEngine) (error, bool) {
	
	if agent.os.Getpid() == initPID {
		
		
		
		
		
		return errors.New("agent is not started with an init system"), true
	}

	
	if err, ok := agent.setVPCSubnet(); err != nil {
		return err, ok
	}

	
	
	if err := agent.verifyCNIPluginsCapabilities(); err != nil {
		
		
		return err, true
	}

	
	if _, err := agent.pauseLoader.LoadImage(agent.ctx, agent.cfg, agent.dockerClient); err != nil {
		if pause.IsNoSuchFileError(err) || pause.UnsupportedPlatform(err) {
			
			
			
			return err, true
		}
		return err, false
	}

	if err := agent.startUdevWatcher(state, taskEngine.StateChangeEvents()); err != nil {
		
		
		
		return err, false
	}

	return nil, false
}
func ( agent * ecsAgent ) initializeTaskENIDependencies ( state dockerstate . TaskEngineState , taskEngine engine . TaskEngine ) ( error , bool ) { // Check if the Agent process's pid  == 1, which means it's running without an init system if agent . os . Getpid ( ) == initPID { // This is a terminal error. Bad things happen with invoking the // the ENI plugin when there's no init process in the pid namesapce. // Specifically, the DHClient processes that are started as children // of the Agent will not be reaped leading to the ENI device // disappearing until the Agent is killed. return errors . New ( " " ) , true } // Set VPC and Subnet IDs for the instance if err , ok := agent . setVPCSubnet ( ) ; err != nil { return err , ok } // Validate that the CNI plugins exist in the expected path and that // they possess the right capabilities if err := agent . verifyCNIPluginsCapabilities ( ) ; err != nil { // An error here is terminal as it means that the plugins // do not support the ENI capability return err , true } // Load the pause container's image from the 'disk' if _ , err := agent . pauseLoader . LoadImage ( agent . ctx , agent . cfg , agent . dockerClient ) ; err != nil { if pause . IsNoSuchFileError ( err ) || pause . UnsupportedPlatform ( err ) { // If the pause container's image tarball doesn't exist or if the // invocation is done for an unsupported platform, we cannot recover. // Return the error as terminal for these cases return err , true } return err , false } if err := agent . startUdevWatcher ( state , taskEngine . StateChangeEvents ( ) ) ; err != nil { // If udev watcher was not initialized in this run because of the udev socket // file not being available etc, the Agent might be able to retry and succeed // on the next run. Hence, returning a false here for terminal bool return err , false } return nil , false }
// initializeTaskENIDependencies initializes all of the dependencies required by
// the Agent to support the 'awsvpc' networking mode. A non nil error is returned
// if an error is encountered during this process. An additional boolean flag to
// indicate if this error is considered terminal is also returned
initializeTaskENIDependencies initializes all of the dependencies required by the Agent to support the awsvpc networking mode . A non nil error is returned if an error is encountered during this process . An additional boolean flag to indicate if this error is considered terminal is also returned