Add
Create a new group.
GroupAdmin.add()
def add(self, group: str, traits: dict = {}) -> Union[dict, bytes]:
📄 Description
Only a subset of available Segments and Traits are considered Stable. See Segments and Traits for more details.
Create a new group.
📥 Parameters
-
group
The group being created. -
traits
A dictionary of traits/attributes that should be given to the group on creation. See Traits to see what all of the valid Group Traits are.
📤 Returns
Union[dict, bytes]
Returns a Security Result dictionary or Security Request XML bytes if theGroupAdmin.generate_requests_only
class attribute is set toTrue
.
❌ Raises
SecurityRequestError
RaisesSecurityRequestError
when the SAF Return Code of a Security Result is equal to4
.DownstreamFatalError
RaisesDownstreamFatalError
when the SAF Return Code of a Security Result is greater than4
.AddOperationError
RaisesAddOperationError
when the group cannot be added because it already exists.SegmentTraitError
RaisesSegmentTraitError
when the dictionary of traits/attributes provided contains one or more unknown traits.
💻 Example
The following example creates a new group called testgrp0
with two traits/attributes as defined in the traits
dictionary.
Python Script
from pyracf import GroupAdmin
group_admin = GroupAdmin()
traits = {
"ovms:gid": 1024,
"ovm:gid": 512,
}
group_admin.add("testgrp0", traits=traits)
Security Result Dictionary as JSON
{
"securityResult": {
"group": {
"name": "TESTGRP0",
"operation": "set",
"requestId": "GroupRequest",
"commands": [
{
"safReturnCode": 0,
"returnCode": 0,
"reasonCode": 0,
"image": "ADDGROUP TESTGRP0 "
},
{
"safReturnCode": 0,
"returnCode": 0,
"reasonCode": 0,
"image": "ALTGROUP TESTGRP0 OMVS (GID (1024)) OVM (GID (512))"
}
]
},
"returnCode": 0,
"reasonCode": 0,
"runningUserid": "testuser"
}
}