summaryrefslogtreecommitdiff
path: root/azurelinuxagent/ga/env.py
diff options
context:
space:
mode:
authorƁukasz 'sil2100' Zemczak <lukasz.zemczak@ubuntu.com>2017-09-04 10:27:07 +0200
committerusd-importer <ubuntu-server@lists.ubuntu.com>2017-09-04 09:38:24 +0000
commite919bdd14e48919244da9e499070fb64377993e5 (patch)
tree33c260c7c99410ac94d5f265fc506cc0b40bb6e4 /azurelinuxagent/ga/env.py
parent70c0ea1ac879b2e1cba0a8edb1f3fbe82652413b (diff)
parent3a1d96a77ccaf023256d16183428e3d895f8a051 (diff)
downloadvyos-walinuxagent-e919bdd14e48919244da9e499070fb64377993e5.tar.gz
vyos-walinuxagent-e919bdd14e48919244da9e499070fb64377993e5.zip
Import patches-applied version 2.2.16-0ubuntu1 to applied/ubuntu/artful-proposed
Imported using git-ubuntu import. Changelog parent: 70c0ea1ac879b2e1cba0a8edb1f3fbe82652413b Unapplied parent: 3a1d96a77ccaf023256d16183428e3d895f8a051 New changelog entries: * New upstream release (LP: #1714299).
Diffstat (limited to 'azurelinuxagent/ga/env.py')
-rw-r--r--azurelinuxagent/ga/env.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/azurelinuxagent/ga/env.py b/azurelinuxagent/ga/env.py
index c81eed7..0456cb0 100644
--- a/azurelinuxagent/ga/env.py
+++ b/azurelinuxagent/ga/env.py
@@ -26,7 +26,10 @@ import azurelinuxagent.common.conf as conf
import azurelinuxagent.common.logger as logger
from azurelinuxagent.common.dhcp import get_dhcp_handler
+from azurelinuxagent.common.event import add_periodic, WALAEventOperation
from azurelinuxagent.common.osutil import get_osutil
+from azurelinuxagent.common.protocol import get_protocol_util
+from azurelinuxagent.common.version import AGENT_NAME, CURRENT_VERSION
def get_env_handler():
return EnvHandler()
@@ -42,6 +45,7 @@ class EnvHandler(object):
def __init__(self):
self.osutil = get_osutil()
self.dhcp_handler = get_dhcp_handler()
+ self.protocol_util = get_protocol_util()
self.stopped = True
self.hostname = None
self.dhcpid = None
@@ -64,17 +68,35 @@ class EnvHandler(object):
def monitor(self):
"""
+ Monitor firewall rules
Monitor dhcp client pid and hostname.
If dhcp clinet process re-start has occurred, reset routes.
"""
+ protocol = self.protocol_util.get_protocol()
while not self.stopped:
self.osutil.remove_rules_files()
+
+ if conf.enable_firewall():
+ success = self.osutil.enable_firewall(
+ dst_ip=protocol.endpoint,
+ uid=os.getuid())
+ add_periodic(
+ logger.EVERY_HOUR,
+ AGENT_NAME,
+ version=CURRENT_VERSION,
+ op=WALAEventOperation.Firewall,
+ is_success=success,
+ log_event=True)
+
timeout = conf.get_root_device_scsi_timeout()
if timeout is not None:
self.osutil.set_scsi_disks_timeout(timeout)
+
if conf.get_monitor_hostname():
self.handle_hostname_update()
+
self.handle_dhclient_restart()
+
time.sleep(5)
def handle_hostname_update(self):