Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

powerman: support new --diag option #163

Closed
wants to merge 8 commits into from

Commits on Mar 5, 2024

  1. powerman: create PlugList from list of Plugs

    Problem: in the near future we would like to create a PlugList
    from a List of Plugs.  It is currently inconvenient to create
    such a list given the current PlugList API.
    
    Add a function pluglist_copy_from_list() function to create a PlugList
    from a List of Plugs.
    chu11 committed Mar 5, 2024
    Configuration menu
    Copy the full SHA
    fa28d74 View commit details
    Browse the repository at this point in the history

Commits on Mar 7, 2024

  1. powerman: rename "interp" to "state interp"

    Problem: In powerman device files the only "interpretation" that
    is done is the output of a power status query via the
    "setplugstate" statement.  Other interpretations may be done
    in the future against other power operations.  Internally anything
    associated with "setplugstate" is called "interpretation" (or
    "interp" or "interps", etc.).  This will get confusing with future
    interpretations.
    
    Solution:  Rename any "interpreations" related code associated
    with "setplugstate" to "state interp" (i.e. "StateInterp" or
    "state_interp", etc.).
    chu11 committed Mar 7, 2024
    Configuration menu
    Copy the full SHA
    fbda998 View commit details
    Browse the repository at this point in the history
  2. powerman: support new setresult directive

    Problem: In many cases, there is no way for a power operation (i.e.
    power on, but not power status) to inform powerman that an error has
    occurred in the operation.  The user will always get a
    "Command completed successfully" output and exit status 0 after
    issuing a power operation.
    
    Solution: Support a new "setresult" statement that can inform powerman
    that a power operation did not succeed.  A regex can be used to determine
    what output is expected of a successful power operation.  If any are not
    successful, powerman can subsequently inform the user an error has occurred,
    leading to a "Command completed with errors" message and exit status 1.
    
    Some example uses:
    
    script on_all {
    	send "on\n"
    	foreachnode {
    		expect "([^\n:]+): ([^\n]+\n)"
    		setresult $1 $2 success="^ok\n"
    	}
    	expect "redfishpower> "
    }
    
    script on {
    	send "on %s\n"
    	expect "([^\n:]+): ([^\n]+\n)"
    	setresult $1 $2 success="^ok\n"
    	expect "redfishpower> "
    }
    
    Fixes chaos#79
    chu11 committed Mar 7, 2024
    Configuration menu
    Copy the full SHA
    218f5f3 View commit details
    Browse the repository at this point in the history
  3. man: document setresult in powerman.dev(5)

    Problem: The new setresult statement is not documented ni powerman.dev(5)
    
    Add information about the new device statement.
    chu11 committed Mar 7, 2024
    Configuration menu
    Copy the full SHA
    b8efc77 View commit details
    Browse the repository at this point in the history
  4. t: cover new setresult device statement

    Problem: The new setresult statement is not covered in the testsuite.
    
    Add tests in a new t0034-power-result.t.  Add new test device files
    etc/redfishpower-setresult-all.dev, etc/redfishpower-setresult-range.dev,
    and etc/redfishpower-setresult-singlet.dev which cover the "all", "range",
    and "singlet" versions of various power operations (i.e. on_all, vs
    on_range, vs on).
    chu11 committed Mar 7, 2024
    Configuration menu
    Copy the full SHA
    8425e96 View commit details
    Browse the repository at this point in the history

Commits on Mar 15, 2024

  1. powerman: support new --diag option

    Problem: When power control/query to a target fails, there is no way for
    a user to know why it failed.
    
    Add a new --diag to powerman that will inform powermand to send
    diagnostic information about why a power operation failed.
    This only works with setplugstate and the new setresult statement.
    chu11 committed Mar 15, 2024
    Configuration menu
    Copy the full SHA
    2fdbf67 View commit details
    Browse the repository at this point in the history
  2. t: add coverage for new --diag option

    Problem: There is no coverage for the new --diag option.
    
    Add tests in new t0035-diag.t tests.
    chu11 committed Mar 15, 2024
    Configuration menu
    Copy the full SHA
    a04a494 View commit details
    Browse the repository at this point in the history
  3. man: document --diag in powerman(1)

    Problem: The new --diag option is not documented.
    
    Add it in powerman(1).
    chu11 committed Mar 15, 2024
    Configuration menu
    Copy the full SHA
    5317943 View commit details
    Browse the repository at this point in the history