diff --git a/deploy-agent/deployd/__init__.py b/deploy-agent/deployd/__init__.py index 0f0ac668bb..cf42a605a5 100644 --- a/deploy-agent/deployd/__init__.py +++ b/deploy-agent/deployd/__init__.py @@ -27,4 +27,4 @@ # 2: puppet applied successfully with changes PUPPET_SUCCESS_EXIT_CODES = [0, 2] -__version__ = '1.2.57' \ No newline at end of file +__version__ = '1.2.58' \ No newline at end of file diff --git a/deploy-agent/deployd/client/client.py b/deploy-agent/deployd/client/client.py index c25ac5ccf2..76eff87629 100644 --- a/deploy-agent/deployd/client/client.py +++ b/deploy-agent/deployd/client/client.py @@ -18,6 +18,7 @@ import socket import traceback import json +import boto3 from deployd.client.base_client import BaseClient from deployd.client.restfulclient import RestfulClient @@ -171,11 +172,22 @@ def _read_host_info(self): # so need to read ec2_tags from facter and parse Autoscaling tag to cover this case if not self._autoscaling_group: ec2_tags = facter_data.get(ec2_tags_key) - if ec2_tags: - ec2_tags['availability_zone'] = self._availability_zone - self._ec2_tags = json.dumps(ec2_tags) if ec2_tags else None self._autoscaling_group = ec2_tags.get(asg_tag_key) if ec2_tags else None + # Obtain all EC2 tags, inclusive of those that are outside the scope of the 'facter' command. + self._ec2_tags = None + try: + ec2 = boto3.resource('ec2', region_name='us-east-1') + ec2instance = ec2.Instance(self._id) + all_tags = {} + for tag in ec2instance.tags: + all_tags[tag["Key"]] = tag["Value"] + all_tags["availability_zone"] = self._availability_zone + self._ec2_tags = json.dumps(all_tags) + except Exception: + log.warn("Failed to get host {} tags.".format(self._id)) + pass + if not self._stage_type and not self._stage_type_fetched: self._stage_type = facter_data.get(stage_type_key, None) self._stage_type_fetched = True diff --git a/deploy-agent/setup.py b/deploy-agent/setup.py index b6fb9f4446..0bbd79635f 100644 --- a/deploy-agent/setup.py +++ b/deploy-agent/setup.py @@ -30,6 +30,8 @@ "gevent==20.12.0; python_version >= '3.8'", "lockfile==0.10.2", "boto>=2.39.0", + "botocore==1.5.34", + "boto3==1.4.4", "python-daemon==2.0.6", "future==0.18.2" ]