setup¶
After initial setup, configure autopilot: create an autopilot directory and a prefs.json file
Classes:
|
Base class for Autopilot setup forms |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Functions:
Unfold nested values from the SetupForm. |
|
|
Make a directory if it doesn’t exist and set its permissions to 0777 |
|
Make an alias so that calling |
-
class
Autopilot_Form
(*args, **kwargs)[source]¶ Bases:
npyscreen.fmForm.Form
Base class for Autopilot setup forms
Each subclass needs to override the
create()
method to add the graphical elements for the form, typically by usingpopulate_form()
with a standardized description fromautopilot.prefs
, and the NAME attribute. The DESCRIPTION attribute provides title text for the formAttributes:
Methods:
populate_dependencies
(params)populate_form
(params)update_depends
(param_name)-
NAME
= ''¶
-
DESCRIPTION
= ''¶
-
-
class
Hardware_Form
(*args, **kwargs)[source]¶ Bases:
npyscreen.fmFormWithMenus.FormWithMenus
,autopilot.setup.setup_autopilot.Autopilot_Form
Attributes:
Methods:
create
()Programmers should over-ride this in derived classes, creating widgets here
add_hardware
(module, class_name)-
NAME
= 'HARDWARE'¶
-
DESCRIPTION
= 'Configure Hardware Objects'¶
-
-
class
Agent_Form
(name=None, parentApp=None, framed=None, help=None, color='FORMDEFAULT', widget_list=None, cycle_widgets=False, *args, **keywords)[source]¶ Bases:
npyscreen.fmForm.Form
Attributes:
Methods:
create
()Programmers should over-ride this in derived classes, creating widgets here
-
NAME
= 'AGENT'¶
-
DESCRIPTION
= 'Select an Agent'¶
-
-
class
Directory_Form
(*args, **kwargs)[source]¶ Bases:
autopilot.setup.setup_autopilot.Autopilot_Form
Attributes:
Methods:
create
()Programmers should over-ride this in derived classes, creating widgets here
-
NAME
= 'DIRECTORIES'¶
-
DESCRIPTION
= 'Configure directory structure'¶
-
-
class
Common_Form
(*args, **kwargs)[source]¶ Bases:
autopilot.setup.setup_autopilot.Autopilot_Form
Attributes:
Methods:
create
()Programmers should over-ride this in derived classes, creating widgets here
-
NAME
= 'COMMON'¶
-
DESCRIPTION
= 'Configure common prefs'¶
-
-
class
Scripts_Form
(*args, **kwargs)[source]¶ Bases:
autopilot.setup.setup_autopilot.Autopilot_Form
Attributes:
Methods:
create
()Programmers should over-ride this in derived classes, creating widgets here
-
NAME
= 'SCRIPTS'¶
-
DESCRIPTION
= 'Choose environment configuration scripts to run'¶
-
-
class
Pilot_Config_Form_1
(*args, **kwargs)[source]¶ Bases:
autopilot.setup.setup_autopilot.Autopilot_Form
Attributes:
Methods:
create
()Programmers should over-ride this in derived classes, creating widgets here
-
NAME
= 'PILOT'¶
-
DESCRIPTION
= 'Configure Pilot-specific prefs'¶
-
-
class
Terminal_Form
(*args, **kwargs)[source]¶ Bases:
autopilot.setup.setup_autopilot.Autopilot_Form
Attributes:
Methods:
create
()Programmers should over-ride this in derived classes, creating widgets here
-
NAME
= 'TERMINAL'¶
-
DESCRIPTION
= 'Configure Terminal-specific prefs'¶
-
-
class
Autopilot_Setup
(prefs)[source]¶ Bases:
npyscreen.apNPSApplicationManaged.NPSAppManaged
Attributes:
Allow different agents to have different paths through setup
Get dict of active scripts
Methods:
onStart
()Add forms by gathering subclasses of
Autopilot_Form
next_form_in_path
(calling_form)Unpack the prefs from the forms and return them complete
-
PATHS
= { 'PILOT': ['AGENT', 'DIRECTORIES', 'COMMON', 'PILOT', 'HARDWARE', 'SCRIPTS'], 'TERMINAL': ['AGENT', 'DIRECTORIES', 'COMMON', 'TERMINAL', 'SCRIPTS']}¶ Allow different agents to have different paths through setup
-
onStart
()[source]¶ Add forms by gathering subclasses of
Autopilot_Form
-
next_form_in_path
(calling_form: autopilot.setup.setup_autopilot.Autopilot_Form)[source]¶
-
unpack_prefs
()[source]¶ Unpack the prefs from the forms and return them complete
- Returns
dict - your prefs!
-
property
active_scripts
¶ Get dict of active scripts
- Returns
script_commands
- Return type
dict - script_name
-
-
unfold_values
(v)[source]¶ Unfold nested values from the SetupForm. Called recursively.
- Parameters
v (dict) – unfolded values
-
make_dir
(adir, permissions: int = 511)[source]¶ Make a directory if it doesn’t exist and set its permissions to 0777
- Parameters
adir (str) – Path to the directory
permissions (int) – an octal integer used to set directory permissions (default
0o777
)
-
make_alias
(launch_script: str, bash_profile: Optional[str] = None)[source]¶ Make an alias so that calling
autopilot
callsautopilot_dir/launch_autopilot.sh
- Parameters
launch_script (str) – the path to the autopilot launch script to be aliased
bash_profile (str, None) – Optional, location of shell profile to edit. if None, use
.bashrc
then.bash_profile
if they exist