Merge ~smoser/ubuntu/+source/ssh-import-id:fix/xenial-1570997-no-home-environ into ubuntu/+source/ssh-import-id:ubuntu/xenial-devel

Proposed by Scott Moser
Status: Rejected
Rejected by: Scott Moser
Proposed branch: ~smoser/ubuntu/+source/ssh-import-id:fix/xenial-1570997-no-home-environ
Merge into: ubuntu/+source/ssh-import-id:ubuntu/xenial-devel
Diff against target: 43 lines (+16/-1)
2 files modified
debian/changelog (+6/-0)
ssh_import_id/__init__.py (+10/-1)
Reviewer Review Type Date Requested Status
Robie Basak Needs Information
Review via email: mp+342231@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Robie Basak (racb) :
review: Needs Information
Revision history for this message
Scott Moser (smoser) :
Revision history for this message
Scott Moser (smoser) wrote :

uploaded. http://paste.ubuntu.com/p/bFZ3p9kzfH/
bc76249f0af9e4c155238064d30b901061caf75c

Revision history for this message
Scott Moser (smoser) wrote :

this specific change actually failed.
ssh-import-id has been correctly fixed upstream and is SRU'd to bionic now.

Unmerged commits

bc76249... by Scott Moser

update changelog.

098d48c... by Scott Moser

Fix failure if HOME not set in environment.

LP: #1570997

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/changelog b/debian/changelog
2index da9a63a..746737f 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,9 @@
6+ssh-import-id (5.5-0ubuntu1.1) xenial; urgency=medium
7+
8+ * Fix failure when HOME is not set in environment. (LP: #1570997)
9+
10+ -- Scott Moser <smoser@ubuntu.com> Tue, 27 Mar 2018 14:28:28 -0400
11+
12 ssh-import-id (5.5-0ubuntu1) xenial; urgency=medium
13
14 * debian/control, debian/rules, setup.py, ssh_import_id/__init__.py:
15diff --git a/ssh_import_id/__init__.py b/ssh_import_id/__init__.py
16index 9296295..0730db0 100644
17--- a/ssh_import_id/__init__.py
18+++ b/ssh_import_id/__init__.py
19@@ -18,6 +18,7 @@
20 # along with ssh-import-id. If not, see <http://www.gnu.org/licenses/>.
21
22 import argparse
23+import getpass
24 import json
25 import logging
26 import os
27@@ -132,7 +133,15 @@ def read_keyfile():
28 Locate key file, read the current state, return lines in a list
29 """
30 lines = []
31- output_file = parser.options.output or os.path.join(os.getenv("HOME"), ".ssh", "authorized_keys")
32+ if parser.options.output:
33+ output_file = parser.options.output
34+ else:
35+ if os.environ.get("HOME"):
36+ home = os.environ["HOME"]
37+ else:
38+ home = os.path.expanduser("~" + getpass.getuser())
39+ output_file = os.path.join(home, ".ssh", "authorized_keys")
40+
41 if os.path.exists(output_file):
42 try:
43 with open(output_file, "r") as f:

Subscribers

People subscribed via source and target branches