Skip to content

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
  • Loading branch information
zmarano committed Aug 1, 2019
2 parents fa80cdb + 17e2c6e commit 688bcbd
Show file tree
Hide file tree
Showing 18 changed files with 43 additions and 29 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
google-compute-engine-oslogin (1:20190801.00-g1) stable; urgency=medium

* Correct JSON refcount decrementing.

-- Google Cloud Team <gc-team@google.com> Thu, 01 Aug 2019 13:57:16 -0700

google-compute-engine-oslogin (1:20190729.00-g1) stable; urgency=medium

* Remove unnecessary binary search logic.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# limitations under the License.

NAME="google-compute-engine-oslogin"
VERSION="20190729.00"
VERSION="20190801.00"

DEB=$(cut -d. -f1 </etc/debian_version)
if [[ -z $DEB ]]; then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@


NAME="google-compute-engine-oslogin"
VERSION="20190729.00"
VERSION="20190801.00"

rpm_working_dir=/tmp/rpmpackage/${NAME}-${VERSION}
working_dir=${PWD}
Expand Down
2 changes: 1 addition & 1 deletion packages/google-compute-engine-oslogin/src/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
SHELL = /bin/sh
TOPDIR = $(realpath ..)

VERSION = 20190729.00
VERSION = 20190801.00

CPPFLAGS = -Iinclude -I/usr/include/json-c
FLAGS = -fPIC -Wall -g
Expand Down
9 changes: 2 additions & 7 deletions packages/google-compute-engine-oslogin/src/utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -800,7 +800,7 @@ bool StartSession(const string& email, string* response) {

jobj = json_object_new_object();
json_object_object_add(jobj, "email", json_object_new_string(email.c_str()));
json_object_object_add(jobj, "supportedChallengeTypes", jarr);
json_object_object_add(jobj, "supportedChallengeTypes", jarr); // Ownership transferred to jobj.

const char* data;
data = json_object_to_json_string_ext(jobj, JSON_C_TO_STRING_PLAIN);
Expand All @@ -814,7 +814,6 @@ bool StartSession(const string& email, string* response) {
ret = false;
}

json_object_put(jarr);
json_object_put(jobj);

return ret;
Expand Down Expand Up @@ -843,7 +842,7 @@ bool ContinueSession(bool alt, const string& email, const string& user_token,
jresp = json_object_new_object();
json_object_object_add(jresp, "credential",
json_object_new_string(user_token.c_str()));
json_object_object_add(jobj, "proposalResponse", jresp);
json_object_object_add(jobj, "proposalResponse", jresp); // Ownership transferred to jobj.
}

const char* data = NULL;
Expand All @@ -859,10 +858,6 @@ bool ContinueSession(bool alt, const string& email, const string& user_token,
}

json_object_put(jobj);
// Match condition where we created this to avoid double-free.
if (challenge.type != AUTHZEN && !alt) {
json_object_put(jresp);
}

return ret;
}
Expand Down
7 changes: 7 additions & 0 deletions packages/google-compute-engine/packaging/debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
google-compute-engine (1:20190801.00-g1) stable; urgency=medium

* Re-enable boto config and drop writing plugin directory.
* Fix metadata script retrieval.

-- Google Cloud Team <gc-team@google.com> Thu, 01 Aug 2019 14:06:02 -0700

google-compute-engine (1:20190729.00-g1) stable; urgency=medium

* Suport Google Private Access over IPv6.
Expand Down
2 changes: 1 addition & 1 deletion packages/google-compute-engine/packaging/setup_deb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# limitations under the License.

NAME="google-compute-engine"
VERSION="20190729.00"
VERSION="20190801.00"

working_dir=${PWD}
if [[ $(basename "$working_dir") != $NAME ]]; then
Expand Down
2 changes: 1 addition & 1 deletion packages/google-compute-engine/packaging/setup_rpm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# limitations under the License.

NAME="google-compute-engine"
VERSION="20190729.00"
VERSION="20190801.00"

rpm_working_dir=/tmp/rpmpackage/${NAME}-${VERSION}
working_dir=${PWD}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@
class BotoConfig(object):
"""Creates a boto config file for standalone GSUtil."""

# WARNING: The path should remain as /etc/boto.cfg in order to not break
# tools, such as gsutil, that rely on loading well-known Boto config paths.
# If you want to change this, please consult the gsutil team
# (GoogleCloudPlatform/gsutil) first.
boto_config = constants.BOTOCONFDIR + '/etc/boto.cfg'
boto_config_template = constants.BOTOCONFDIR + '/etc/boto.cfg.template'
boto_config_script = os.path.abspath(__file__)
Expand Down Expand Up @@ -80,10 +84,10 @@ def _CreateConfig(self, project_id):
config = config_manager.ConfigManager(
config_file=self.boto_config_template,
config_header=self.boto_config_header)
boto_dir = os.path.dirname(self.boto_config_script)

# WARNING: If you want to change the contents of this config file, please
# consult the gsutil team (GoogleCloudPlatform/gsutil) first.
config.SetOption('GSUtil', 'default_project_id', project_id)
config.SetOption('GSUtil', 'default_api_version', '2')
config.SetOption('GoogleCompute', 'service_account', 'default')
config.SetOption('Plugin', 'plugin_directory', boto_dir)
config.WriteConfig(config_file=self.boto_config)
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ def testCreateConfig(self, mock_config, mock_logger, mock_watcher):
mock.call.set('GSUtil', 'default_project_id', self.project_id),
mock.call.set('GSUtil', 'default_api_version', '2'),
mock.call.set('GoogleCompute', 'service_account', 'default'),
mock.call.set('Plugin', 'plugin_directory', '/tmp'),
mock.call.write(config_file='config'),
]
self.assertEqual(mocks.mock_calls, expected_calls)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
"""A module for global constants."""

import platform
import sys

OSLOGIN_CONTROL_SCRIPT = 'google_oslogin_control'
OSLOGIN_NSS_CACHE_SCRIPT = 'google_oslogin_nss_cache'
Expand All @@ -42,8 +41,3 @@
OSLOGIN_NSS_CACHE = '/etc/oslogin_passwd.cache'
SYSCONFDIR = '/etc/default'
SYSLOG_SOCKET = '/dev/log'

if sys.version_info >= (3, 0):
SET_BOTO_CONFIG = 'false'
else:
SET_BOTO_CONFIG = 'true'
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,9 @@ class InstanceConfig(config_manager.ConfigManager):
'host_key_types': 'ecdsa,ed25519,rsa',
'optimize_local_ssd': 'true',
'network_enabled': 'true',
'set_boto_config': constants.SET_BOTO_CONFIG,
# WARNING: Do not change the value of 'set_boto_config' without first
# consulting the gsutil team (GoogleCloudPlatform/gsutil).
'set_boto_config': 'true',
'set_host_keys': 'true',
'set_multiqueue': 'true',
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,12 +112,12 @@ def _DownloadAuthUrl(self, url, dest_dir):
request = urlrequest.Request(url)
request.add_unredirected_header('Metadata-Flavor', 'Google')
request.add_unredirected_header('Authorization', self.token)
content = _UrlOpenWithRetry(request).read().decode('utf-8')
content = _UrlOpenWithRetry(request).read()
except Exception as e:
self.logger.warning('Could not download %s. %s.', url, str(e))
return None

with open(dest, 'w') as f:
with open(dest, 'wb') as f:
f.write(content)

return dest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ def testDownloadAuthUrl(self, mock_urlopen, mock_request, mock_tempfile):
mocked_request.add_unredirected_header.assert_called_with(
'Authorization', 'bar')
mock_urlopen.assert_called_with(mocked_request)
urlopen_read = mock_urlopen().read(return_value=b'foo').decode()
urlopen_read = mock_urlopen().read(return_value=b'foo')
self.mock_logger.warning.assert_not_called()

mock_open.assert_called_once_with(self.dest, 'w')
mock_open.assert_called_once_with(self.dest, 'wb')
handle = mock_open()
handle.write.assert_called_once_with(urlopen_read)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
python-google-compute-engine (1:20190801.00-g1) stable; urgency=medium

* Re-enable boto config and drop writing plugin directory.
* Fix metadata script retrieval.

-- Google Cloud Team <gc-team@google.com> Thu, 01 Aug 2019 13:55:46 -0700

python-google-compute-engine (1:20190729.00-g1) stable; urgency=medium

* Support for Google Private Access over IPv6.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# limitations under the License.

NAME="python-google-compute-engine"
VERSION="20190729.00"
VERSION="20190801.00"

working_dir=${PWD}
if [[ $(basename "$working_dir") != $NAME ]]; then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# limitations under the License.

NAME="python-google-compute-engine"
VERSION="20190729.00"
VERSION="20190801.00"

rpm_working_dir=/tmp/rpmpackage/${NAME}-${VERSION}
working_dir=${PWD}
Expand Down
2 changes: 1 addition & 1 deletion packages/python-google-compute-engine/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
name='google-compute-engine',
packages=setuptools.find_packages(),
url='https://github.com/GoogleCloudPlatform/compute-image-packages',
version='20190729.00',
version='20190801.00',
# Entry points create scripts in /usr/bin that call a function.
entry_points={
'console_scripts': [
Expand Down

0 comments on commit 688bcbd

Please sign in to comment.