From 96241b049bdb83ec048775a7094d1d114317c353 Mon Sep 17 00:00:00 2001 From: YaqinLi Date: Tue, 6 Feb 2024 22:30:57 +0000 Subject: [PATCH 1/7] fetch ec2 tags from aws instead of from facter command --- deploy-agent/deployd/client/client.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) 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 From 9520fb00d96ec2f7dc6ebb3cd3f377d2f1411feb Mon Sep 17 00:00:00 2001 From: YaqinLi Date: Tue, 6 Feb 2024 22:33:02 +0000 Subject: [PATCH 2/7] bump the version --- deploy-agent/deployd/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From c4447815c20f59dda0a4a49b214f4c073869a4ef Mon Sep 17 00:00:00 2001 From: YaqinLi Date: Tue, 6 Feb 2024 22:58:47 +0000 Subject: [PATCH 3/7] fix compile error --- deploy-agent/setup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/deploy-agent/setup.py b/deploy-agent/setup.py index b6fb9f4446..e508f2b552 100644 --- a/deploy-agent/setup.py +++ b/deploy-agent/setup.py @@ -30,6 +30,7 @@ "gevent==20.12.0; python_version >= '3.8'", "lockfile==0.10.2", "boto>=2.39.0", + "boto3>=1.12.6", "python-daemon==2.0.6", "future==0.18.2" ] From bacfba4eba89ae60a6863546ab02d3e773b19974 Mon Sep 17 00:00:00 2001 From: YaqinLi Date: Tue, 6 Feb 2024 23:29:10 +0000 Subject: [PATCH 4/7] resolve version issue --- deploy-agent/setup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/deploy-agent/setup.py b/deploy-agent/setup.py index e508f2b552..01b66930dc 100644 --- a/deploy-agent/setup.py +++ b/deploy-agent/setup.py @@ -31,6 +31,7 @@ "lockfile==0.10.2", "boto>=2.39.0", "boto3>=1.12.6", + "urllib3<1.27,>=1.25.4", "python-daemon==2.0.6", "future==0.18.2" ] From 63d35b7ee99eefff12ebb7cb37f8782134256777 Mon Sep 17 00:00:00 2001 From: YaqinLi Date: Tue, 6 Feb 2024 23:35:55 +0000 Subject: [PATCH 5/7] test --- deploy-agent/setup.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/deploy-agent/setup.py b/deploy-agent/setup.py index 01b66930dc..354f6a7888 100644 --- a/deploy-agent/setup.py +++ b/deploy-agent/setup.py @@ -30,8 +30,7 @@ "gevent==20.12.0; python_version >= '3.8'", "lockfile==0.10.2", "boto>=2.39.0", - "boto3>=1.12.6", - "urllib3<1.27,>=1.25.4", + "boto3", "python-daemon==2.0.6", "future==0.18.2" ] From 1a7da85b00e5fffd23a7050679424202dc174a2b Mon Sep 17 00:00:00 2001 From: YaqinLi Date: Tue, 6 Feb 2024 23:40:26 +0000 Subject: [PATCH 6/7] test --- deploy-agent/setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deploy-agent/setup.py b/deploy-agent/setup.py index 354f6a7888..f692365958 100644 --- a/deploy-agent/setup.py +++ b/deploy-agent/setup.py @@ -24,7 +24,7 @@ 'deploy-stager = deployd.staging.stager:main'] install_requires = [ - "requests==2.20.0", + "requests>=2.20.0", "gevent>=1.0.2,<=1.2.2; python_version < '3'", "gevent>=1.0.2,<=1.5.0; python_version < '3.8'", "gevent==20.12.0; python_version >= '3.8'", From 86162a7efe3a054520a917e0cdfc114e86844111 Mon Sep 17 00:00:00 2001 From: YaqinLi Date: Tue, 6 Feb 2024 23:50:05 +0000 Subject: [PATCH 7/7] test --- deploy-agent/setup.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/deploy-agent/setup.py b/deploy-agent/setup.py index f692365958..0bbd79635f 100644 --- a/deploy-agent/setup.py +++ b/deploy-agent/setup.py @@ -24,13 +24,14 @@ 'deploy-stager = deployd.staging.stager:main'] install_requires = [ - "requests>=2.20.0", + "requests==2.20.0", "gevent>=1.0.2,<=1.2.2; python_version < '3'", "gevent>=1.0.2,<=1.5.0; python_version < '3.8'", "gevent==20.12.0; python_version >= '3.8'", "lockfile==0.10.2", "boto>=2.39.0", - "boto3", + "botocore==1.5.34", + "boto3==1.4.4", "python-daemon==2.0.6", "future==0.18.2" ]