def analysis_profile(): ap = AnalysisProfile( name="default", description="ap-desc", profile_type=AnalysisProfile.VM_TYPE, categories=["Services", "User Accounts", "Software", "VM Configuration", "System"] ) if ap.exists: ap.delete() ap.create() yield ap ap.delete()
def analysis_profile(): ap = AnalysisProfile(name="default", description="ap-desc", profile_type=AnalysisProfile.VM_TYPE, categories=[ "check_services", "check_accounts", "check_software", "check_vmconfig", "check_system" ]) if ap.exists: ap.delete() ap.create() yield ap ap.delete()
def ssa_analysis_profile(): collected_files = [] for file in ssa_expect_files: collected_files.append({"Name": file, "Collect Contents?": True}) analysis_profile_name = 'ssa_analysis_{}'.format(fauxfactory.gen_alphanumeric()) analysis_profile = AnalysisProfile(name=analysis_profile_name, description=analysis_profile_name, profile_type=AnalysisProfile.VM_TYPE, categories=["System"], files=collected_files) analysis_profile.create() yield analysis_profile analysis_profile.delete()
def policy_profile(request, instance): collected_files = [{ "Name": "/etc/redhat-access-insights/machine-id", "Collect Contents?": True }, { "Name": ssa_expect_file, "Collect Contents?": True }] analysis_profile_name = 'ssa_analysis_{}'.format( fauxfactory.gen_alphanumeric()) analysis_profile = AnalysisProfile(name=analysis_profile_name, description=analysis_profile_name, profile_type=AnalysisProfile.VM_TYPE, categories=["System"], files=collected_files) if analysis_profile.exists: analysis_profile.delete() analysis_profile.create() request.addfinalizer(analysis_profile.delete) action = Action('ssa_action_{}'.format(fauxfactory.gen_alpha()), "Assign Profile to Analysis Task", dict(analysis_profile=analysis_profile_name)) if action.exists: action.delete() action.create() request.addfinalizer(action.delete) policy = VMControlPolicy('ssa_policy_{}'.format(fauxfactory.gen_alpha())) if policy.exists: policy.delete() policy.create() request.addfinalizer(policy.delete) policy.assign_events("VM Analysis Start") request.addfinalizer(policy.assign_events) policy.assign_actions_to_event("VM Analysis Start", action) profile = PolicyProfile('ssa_policy_profile_{}'.format( fauxfactory.gen_alpha()), policies=[policy]) if profile.exists: profile.delete() profile.create() request.addfinalizer(profile.delete) instance.assign_policy_profiles(profile.description) request.addfinalizer( lambda: instance.unassign_policy_profiles(profile.description))
def ssa_analysis_profile(): collected_files = [] for file in ssa_expect_files: collected_files.append({"Name": file, "Collect Contents?": True}) analysis_profile_name = 'default' analysis_profile = AnalysisProfile(name=analysis_profile_name, description=analysis_profile_name, profile_type=AnalysisProfile.VM_TYPE, categories=["System", "Software", "System", "User Accounts", "VM Configuration"], files=collected_files) analysis_profile.create() yield analysis_profile analysis_profile.delete()
def ssa_analysis_profile(): collected_files = [] for file in ssa_expect_files: collected_files.append({"Name": file, "Collect Contents?": True}) analysis_profile_name = 'default_{}'.format(fauxfactory.gen_alpha()) analysis_profile = AnalysisProfile(name=analysis_profile_name, description=analysis_profile_name, profile_type=AnalysisProfile.VM_TYPE, categories=[ "System", "Software", "System", "User Accounts", "VM Configuration" ], files=collected_files) analysis_profile.create() yield analysis_profile analysis_profile.delete()
def policy_profile(request, appliance, instance): collected_files = [ {"Name": "/etc/redhat-access-insights/machine-id", "Collect Contents?": True}, {"Name": ssa_expect_file, "Collect Contents?": True} ] analysis_profile_name = 'ssa_analysis_{}'.format(fauxfactory.gen_alphanumeric()) analysis_profile = AnalysisProfile(name=analysis_profile_name, description=analysis_profile_name, profile_type=AnalysisProfile.VM_TYPE, categories=["System"], files=collected_files) if analysis_profile.exists: analysis_profile.delete() analysis_profile.create() request.addfinalizer(analysis_profile.delete) action = appliance.collections.actions.create( 'ssa_action_{}'.format(fauxfactory.gen_alpha()), "Assign Profile to Analysis Task", dict(analysis_profile=analysis_profile_name)) if action.exists: action.delete() request.addfinalizer(action.delete) policy = appliance.collections.policies.create( VMControlPolicy, 'ssa_policy_{}'.format(fauxfactory.gen_alpha()) ) if policy.exists: policy.delete() request.addfinalizer(policy.delete) policy.assign_events("VM Analysis Start") request.addfinalizer(policy.assign_events) policy.assign_actions_to_event("VM Analysis Start", action) profile = appliance.collections.policy_profiles.create( 'ssa_policy_profile_{}'.format(fauxfactory.gen_alpha()), policies=[policy]) if profile.exists: profile.delete() request.addfinalizer(profile.delete) instance.assign_policy_profiles(profile.description) request.addfinalizer(lambda: instance.unassign_policy_profiles(profile.description))
def ssa_analysis_profile(): collected_files = [] for file in ssa_expect_files: collected_files.append({"Name": file, "Collect Contents?": True}) analysis_profile_name = 'default' analysis_profile = AnalysisProfile(name=analysis_profile_name, description=analysis_profile_name, profile_type=AnalysisProfile.VM_TYPE, categories=["System", "Software", "Services", "User Accounts", "VM Configuration"], files=collected_files) if analysis_profile.exists: analysis_profile.delete() analysis_profile.create() yield analysis_profile if analysis_profile.exists: analysis_profile.delete()