summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZach Marano <zmarano@google.com>2019-11-15 10:19:58 -0800
committerZach Marano <zmarano@google.com>2019-11-15 10:19:58 -0800
commitac1ccb70222cce13365a36dc09d87212dc5ea780 (patch)
treea50714f24284b9198252850c9e913f2b73e2ba98
parentbe2c905a643f4c14340b8efa182cb47726d3026c (diff)
parent9d9a5f98871ee42459ac4648b7761824f12b3709 (diff)
downloadgoogle-compute-image-packages-ac1ccb70222cce13365a36dc09d87212dc5ea780.tar.gz
Merge branch 'development'v20191115
-rwxr-xr-xpackages/python-google-compute-engine/google_compute_engine/instance_setup/instance_setup.py17
-rw-r--r--packages/python-google-compute-engine/google_compute_engine/instance_setup/tests/instance_setup_test.py6
-rw-r--r--packages/python-google-compute-engine/packaging/debian/changelog8
-rwxr-xr-xpackages/python-google-compute-engine/packaging/setup_deb.sh2
-rwxr-xr-xpackages/python-google-compute-engine/packaging/setup_rpm.sh2
5 files changed, 16 insertions, 19 deletions
diff --git a/packages/python-google-compute-engine/google_compute_engine/instance_setup/instance_setup.py b/packages/python-google-compute-engine/google_compute_engine/instance_setup/instance_setup.py
index dbd3d8f..cb1a2a6 100755
--- a/packages/python-google-compute-engine/google_compute_engine/instance_setup/instance_setup.py
+++ b/packages/python-google-compute-engine/google_compute_engine/instance_setup/instance_setup.py
@@ -28,7 +28,7 @@ from google_compute_engine import file_utils
from google_compute_engine import logger
from google_compute_engine import metadata_watcher
from google_compute_engine.boto import boto_config
-from google_compute_engine.compat import distro_name, urlerror
+from google_compute_engine.compat import urlerror
from google_compute_engine.compat import urlrequest
from google_compute_engine.instance_setup import instance_config
@@ -65,27 +65,17 @@ class InstanceSetup(object):
instance_config_metadata = self._GetInstanceConfig()
self.instance_config = instance_config.InstanceConfig(
logger=self.logger, instance_config_metadata=instance_config_metadata)
-
if self.instance_config.GetOptionBool('InstanceSetup', 'set_host_keys'):
host_key_types = self.instance_config.GetOptionString(
'InstanceSetup', 'host_key_types')
self._SetSshHostKeys(host_key_types=host_key_types)
-
if self.instance_config.GetOptionBool('InstanceSetup', 'set_boto_config'):
self._SetupBotoConfig()
-
- # machineType is e.g. u'projects/00000000000000/machineTypes/n1-standard-1'
- machineType = self.metadata_dict['instance']['machineType'].split('/')[-1]
- if machineType.startswith("e2-") and 'bsd' not in distro_name: # Not yet supported on BSD.
- subprocess.call(["sysctl", "vm.overcommit_memory=1"])
-
if self.instance_config.GetOptionBool(
'InstanceSetup', 'optimize_local_ssd'):
self._RunScript('google_optimize_local_ssd')
-
if self.instance_config.GetOptionBool('InstanceSetup', 'set_multiqueue'):
self._RunScript('google_set_multiqueue')
-
try:
self.instance_config.WriteConfig()
except (IOError, OSError) as e:
@@ -215,9 +205,10 @@ class InstanceSetup(object):
Args:
host_key_types: string, a comma separated list of host key types.
"""
+ section = 'Instance'
instance_id = self._GetInstanceId()
if instance_id != self.instance_config.GetOptionString(
- 'instance', 'instance_id'):
+ section, 'instance_id'):
self.logger.info('Generating SSH host keys for instance %s.', instance_id)
file_regex = re.compile(r'ssh_host_(?P<type>[a-z0-9]*)_key\Z')
key_dir = '/etc/ssh'
@@ -231,7 +222,7 @@ class InstanceSetup(object):
if key_data:
self._WriteHostKeyToGuestAttributes(key_data[0], key_data[1])
self._StartSshd()
- self.instance_config.SetOption('Instance', 'instance_id', str(instance_id))
+ self.instance_config.SetOption(section, 'instance_id', str(instance_id))
def _GetNumericProjectId(self):
"""Get the numeric project ID.
diff --git a/packages/python-google-compute-engine/google_compute_engine/instance_setup/tests/instance_setup_test.py b/packages/python-google-compute-engine/google_compute_engine/instance_setup/tests/instance_setup_test.py
index e255f86..a418219 100644
--- a/packages/python-google-compute-engine/google_compute_engine/instance_setup/tests/instance_setup_test.py
+++ b/packages/python-google-compute-engine/google_compute_engine/instance_setup/tests/instance_setup_test.py
@@ -46,7 +46,7 @@ class InstanceSetupTest(unittest.TestCase):
mock_logger_instance = mock.Mock()
mock_logger.Logger.return_value = mock_logger_instance
mock_watcher_instance = mock.Mock()
- mock_watcher_instance.GetMetadata.return_value = {'hello': 'world', 'instance': {'machineType': 'fake'}}
+ mock_watcher_instance.GetMetadata.return_value = {'hello': 'world'}
mock_watcher.MetadataWatcher.return_value = mock_watcher_instance
mock_config_instance = mock.Mock()
mock_config_instance.GetOptionBool.return_value = True
@@ -91,7 +91,7 @@ class InstanceSetupTest(unittest.TestCase):
mock.call.config.InstanceConfig().WriteConfig(),
]
self.assertEqual(mocks.mock_calls, expected_calls)
- self.assertEqual(mock_setup.metadata_dict, {'hello': 'world', 'instance': {'machineType': 'fake'}})
+ self.assertEqual(mock_setup.metadata_dict, {'hello': 'world'})
@mock.patch('google_compute_engine.instance_setup.instance_setup.instance_config')
@mock.patch('google_compute_engine.instance_setup.instance_setup.metadata_watcher')
@@ -386,7 +386,7 @@ class InstanceSetupTest(unittest.TestCase):
]
self.assertEqual(sorted(mock_generate_key.mock_calls), expected_calls)
- self.mock_instance_config.SetOption.assert_called_with(
+ self.mock_instance_config.SetOption.assert_called_once_with(
'Instance', 'instance_id', '123')
def testGetNumericProjectId(self):
diff --git a/packages/python-google-compute-engine/packaging/debian/changelog b/packages/python-google-compute-engine/packaging/debian/changelog
index 3a79721..513dafe 100644
--- a/packages/python-google-compute-engine/packaging/debian/changelog
+++ b/packages/python-google-compute-engine/packaging/debian/changelog
@@ -1,10 +1,16 @@
+python-google-compute-engine (1:20191115.00-g1) stable; urgency=medium
+
+ * REVERT: Enable sysctl change for E2 platform.
+
+ -- Google Cloud Team <gc-team@google.com> Fri, 15 Sep 2019 10:08:24 -0700
+
python-google-compute-engine (1:20191112.00-g1) stable; urgency=medium
* Enable sysctl change for E2 platform.
* Retry metadata lookups in agent.
* Wait for link-local IPv6 addresses to resolve.
- -- Google Cloud Team <gc-team@google.com> Mon, 16 Sep 2019 15:52:24 -0700
+ -- Google Cloud Team <gc-team@google.com> Mon, 11 Nov 2019 15:52:24 -0700
python-google-compute-engine (1:20190916.00-g1) stable; urgency=medium
diff --git a/packages/python-google-compute-engine/packaging/setup_deb.sh b/packages/python-google-compute-engine/packaging/setup_deb.sh
index fc4feac..6494e66 100755
--- a/packages/python-google-compute-engine/packaging/setup_deb.sh
+++ b/packages/python-google-compute-engine/packaging/setup_deb.sh
@@ -14,7 +14,7 @@
# limitations under the License.
NAME="python-google-compute-engine"
-VERSION="20191112.00"
+VERSION="20191115.00"
working_dir=${PWD}
if [[ $(basename "$working_dir") != $NAME ]]; then
diff --git a/packages/python-google-compute-engine/packaging/setup_rpm.sh b/packages/python-google-compute-engine/packaging/setup_rpm.sh
index d3c0d22..a2f40f4 100755
--- a/packages/python-google-compute-engine/packaging/setup_rpm.sh
+++ b/packages/python-google-compute-engine/packaging/setup_rpm.sh
@@ -14,7 +14,7 @@
# limitations under the License.
NAME="python-google-compute-engine"
-VERSION="20191112.00"
+VERSION="20191115.00"
rpm_working_dir=/tmp/rpmpackage/${NAME}-${VERSION}
working_dir=${PWD}