Skip to content

Commit 25dce79

Browse files
chore(compute): delete region tags from 'api' and 'oslogin' folders (#13094)
* chore(gae): delete region tags from compute/api/startup-script.sh * chore(gae): delete region tags from compute/oslogin/service_account_ssh.py
1 parent 1ac476b commit 25dce79

File tree

2 files changed

+4
-29
lines changed

2 files changed

+4
-29
lines changed

compute/api/startup-script.sh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616

17-
# [START startup_script]
1817
apt-get update
1918
apt-get -y install imagemagick
2019

@@ -36,5 +35,3 @@ gsutil mb gs://$CS_BUCKET
3635
# Store the image in the Google Cloud Storage bucket and allow all users
3736
# to read it.
3837
gsutil cp -a public-read output.png gs://$CS_BUCKET/output.png
39-
40-
# [END startup_script]

compute/oslogin/service_account_ssh.py

Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
on the same internal VPC network.
2121
"""
2222

23-
# [START imports_and_variables]
2423
import argparse
2524
import logging
2625
import subprocess
@@ -38,19 +37,15 @@
3837
)
3938
HEADERS = {"Metadata-Flavor": "Google"}
4039

41-
# [END imports_and_variables]
4240

43-
44-
# [START run_command_local]
4541
def execute(
4642
cmd: List[str],
4743
cwd: Optional[str] = None,
4844
capture_output: bool = False,
4945
env: Optional[dict] = None,
5046
raise_errors: bool = True,
5147
) -> (int, str):
52-
"""
53-
Execute an external command (wrapper for Python subprocess).
48+
"""Execute an external command (wrapper for Python subprocess).
5449
5550
Args:
5651
cmd: command to be executed, presented as list of strings.
@@ -78,18 +73,13 @@ def execute(
7873
return returncode, output
7974

8075

81-
# [END run_command_local]
82-
83-
84-
# [START create_key]
8576
def create_ssh_key(
8677
oslogin: googleapiclient.discovery.Resource,
8778
account: str,
8879
private_key_file: Optional[str] = None,
8980
expire_time: int = 300,
9081
) -> str:
91-
"""
92-
Generate an SSH key pair and apply it to the specified account.
82+
"""Generate an SSH key pair and apply it to the specified account.
9383
9484
Args:
9585
oslogin: the OSLogin resource object, needed to communicate with API.
@@ -129,13 +119,8 @@ def create_ssh_key(
129119
return private_key_file
130120

131121

132-
# [END create_key]
133-
134-
135-
# [START run_command_remote]
136122
def run_ssh(cmd: str, private_key_file: str, username: str, hostname: str) -> List[str]:
137-
"""
138-
Run a command on a remote system.
123+
"""Run a command on a remote system.
139124
140125
Args:
141126
cmd: the command to be run on remote system.
@@ -166,10 +151,6 @@ def run_ssh(cmd: str, private_key_file: str, username: str, hostname: str) -> Li
166151
return result if result else ssh.stderr.readlines()
167152

168153

169-
# [END run_command_remote]
170-
171-
172-
# [START main]
173154
def main(
174155
cmd: str,
175156
project: str,
@@ -179,8 +160,7 @@ def main(
179160
account: Optional[str] = None,
180161
hostname: Optional[str] = None,
181162
) -> List[str]:
182-
"""
183-
Run a command on a remote system.
163+
"""Run a command on a remote system.
184164
185165
This method will first create a new SSH key and then use it to
186166
execute a specified command over SSH on remote machine.
@@ -273,5 +253,3 @@ def main(
273253
account=args.account,
274254
hostname=args.hostname,
275255
)
276-
277-
# [END main]

0 commit comments

Comments
 (0)