EMGR Module Overview
EMGR Overview
EMGR refers to the interim fix manager used to manage system interim fixes on AIX systems. It installs packages created with the epkg
Supported Actions
The module supports actions like install, commit, check, mount, unmount, remove, view_package
display_ifix
7.1
TL3
3.6
aix.system.install
How to Use EMGR
To use EMGR, specify the action to be performed (e.g., install, commit, check) and provide the necessary parameters such as ifix_package
ifix_label
list_file
Example Usage of EMGR
An example usage of the EMGR module is to install an ifix package from a file generated with epkg
ifix_package
from_epkg
- name: Install ifix package from file generated with epkg
emgr:
action: install
ifix_package: /usr/sys/inst.images/IJ22714s1a.200212.AIX72TL04SP00-01.epkg.Z
working_dir: /usr/sys/inst.images
from_epkg: true
extend_fs: true
Main Functions
The EMGR module includes several main functions that facilitate its operations.
param_one_of
param_one_of
The param_one_of
def param_one_of(one_of_list, required=True, exclusive=True):
"""
Check at parameter of one_of_list is defined in module.params dictionary.
arguments:
one_of_list (list) list of parameter to check
required (bool) at least one parameter has to be defined.
exclusive (bool) only one parameter can be defined.
note:
Ansible might have this embedded in some version: require_if 4th parameter.
Exits with fail_json in case of error
"""
count = 0
action = module.params['action']
for param in one_of_list:
if module.params[param] is not None and module.params[param]:
count += 1
break
if count == 0 and required:
results['msg'] = f'Missing parameter: action is { action } but\
parse_ifix_details
parse_ifix_details
The parse_ifix_details
emgr -l
def parse_ifix_details(output):
"""
Parses the output of "emgr -l" command to return the ifixes as a list instead of str.
argument:
stdout (str) standard output of the command.
return:
List of dictionaries containing information about the iFixes.
"""
ifix_name = []
info_list = ["ID", "STATE", "LABEL", "INSTALL TIME", "UPDATED BY", "ABSTRACT"]
position_dict = {}
def get_value(line, field):
field_index = info_list.index(field)
next_field_index = field_index + 1
start_position = position_dict[field]
# End-of-line
is_ifix_installed
is_ifix_installed
The is_ifix_installed
emgr -c -L
def is_ifix_installed(module, ifix_package):
# Utility function to check if the ifix is installed in the system.
ifix_label = ifix_package.split('/')[-1].split('.')[0]
cmd = 'emgr -c -L' + ifix_label
rc = module.run_command(cmd)[0]
if rc == 0:
return True
else:
return False
main
The main
emgr
view_package
display_ifix
def main():
global module
global results
module = AnsibleModule(
supports_check_mode=True,
argument_spec=dict(
action=dict(type='str', default='list', choices=['install', 'commit', 'check', 'mount', 'unmount',
'remove', 'view_package', 'display_ifix', 'list']),
ifix_package=dict(type='path'),
ifix_label=dict(type='str'),
ifix_number=dict(type='str'),
ifix_vuid=dict(type='str'),
package=dict(type='str'),
alternate_dir=dict(type='path'),
list_file=dict(type='path'),
working_dir=dict(type='path'),
from_epkg=dict(type='bool', default=False),
mount_install=dict(type='bool', default=False),
commit=dict(type='bool', default=False),
extend_fs=dict(type='bool', default=False),
This is an auto-generated document by Swimm 🌊 and has not yet been verified by a human