The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

FusionInventory::Agent::Task::Deploy::UserCheck - Deploy task user checks

DESCRIPTION

This module provides object class to interact with logged users during a deploy task.

It can be used for any job managed during one deploy task. It can be used before the downloading step and/or after the actions processing. This may give a chance for user to stop the current job or to be alerted of done job.

The object is intended to show a modal windows or a notification to any logged user.

OBJECTS STRUCTURE

While instanciated, the

Methods

PACKAGE->new(%params)

Returns a newly created FusionInventory::Agent::Task::Deploy::UserCheck object.

Availables parameters:

logger a logger object
check a hash ref containing supported values to import

Supported values for check hasf ref:

title Title to be used in a modal window
text Text of the window or notification
icon Icon to be used in window or notification
buttons Buttons to expose to user. The button caption is static and the used text should be coherent with buttons caption.
timeout The time-out in second to wait for a user response
wait Should we have to wait the user response. If set to 0, "no" or "false", it will immediatly generate an "on_async" event.
platform Platform or list of platforms on which we are expecting user interaction. User interaction will be skipped if the agent is not on any expected platform.
type Type of user check to select when it should happen: - "before": for checking user before downloading and processing the deploy job - "after" : for checking or notify the user after the deploy job has been processed. - "after_download_failure": for checking or notify the user after a download failed. - "after_download": for checking or notify the user after all downloads was done. - "after_failure": for checking or notify the user after the deploy task failed.

Following values may to be used to define what should be done while buttons are clicked or related event occurs:

on_ok To be done after user has clicked "OK" button.
on_cancel To be done after user has clicked "Cancel" button.
on_yes To be done after user has clicked "Yes" button.
on_no To be done after user has clicked "No" button.
on_retry To be done after user has clicked "Retry" button.
on_tryagain To be done after user has clicked "Try again" button.
on_abort To be done after user has clicked "Abort" button.
on_ignore To be done after user has clicked "Ignore" button.
on_async To be done after user has clicked "Ignore" button.
on_timeout To be done if user hasn't clicked any button and after the defined time-out.
on_nouser To be done if no user is logged
on_multiusers To be done if multiple users are logged

Each event should be a string with the following format: "<local_policy>:<server_policy>:<message to send back>"

<local_policy> must be one of the following string:

continue So the job processing will continue
stop To stop the job processing

<server_policy> should be a string send back to server as status. <message to send back> should be a string send back to server as status message.

Remark: as semi-colon is used as delimiter, server should not use it in sent policy.

$OBJ->tell_users()

Start the user interaction and wait until all expected events occurred.

Be careful, this may block the caller as long as the defined time-out, and even more on server handling a lot of user sessions.

$OBJ->stopped($condition)

Without $condition, returns true if the user interaction matched and event telling the current job has to be skipped while the user check is a 'before' type check.

For 'after' type check, it has only the meaning to not process any following 'after' user check in a list context, until only one 'after' check is really expected, this call could be avoided in that case.

If $condition is given, set _stopped private value accordingly: - 0 or 'no' : has the same effect than calling $OBJ->continue() - 1 or 'yes': defines the _stopped private value to be true. - any text: log the text as error and set _stopped private value to be true.

$OBJ->continue() Set _stopped private value so calling stopped() method will return false.

$OBJ->stop() Set _stopped private value so calling stopped() method will return true.