Changed get_monkey_env logic to return as soon as a results is found and added docs
This commit is contained in:
parent
ab330219d5
commit
db5c0f4786
|
@ -5,11 +5,15 @@ from infection_monkey.system_info.system_info_collector import SystemInfoCollect
|
||||||
|
|
||||||
|
|
||||||
def get_monkey_environment() -> str:
|
def get_monkey_environment() -> str:
|
||||||
env = ON_PREMISE
|
"""
|
||||||
|
Get the Monkey's running environment.
|
||||||
|
:return: One of the cloud providers if on cloud; otherwise, assumes "on premise".
|
||||||
|
"""
|
||||||
for instance in get_all_cloud_instances():
|
for instance in get_all_cloud_instances():
|
||||||
if instance.is_instance():
|
if instance.is_instance():
|
||||||
env = instance.get_cloud_provider_name()
|
return instance.get_cloud_provider_name()
|
||||||
return env
|
|
||||||
|
return ON_PREMISE
|
||||||
|
|
||||||
|
|
||||||
class EnvironmentCollector(SystemInfoCollector):
|
class EnvironmentCollector(SystemInfoCollector):
|
||||||
|
|
Loading…
Reference in New Issue