Skip to content
This repository was archived by the owner on Jun 17, 2024. It is now read-only.

Commit f5ee551

Browse files
author
Stephen Tramer
committed
Updated Python content to comply with PEP8 (via autopep8)
1 parent 9851cb7 commit f5ee551

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

azure_deployment.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,12 @@
88
# AZURE_CLIENT_ID: with your Azure Active Directory Application Client ID
99
# AZURE_CLIENT_SECRET: with your Azure Active Directory Application Secret
1010

11-
my_subscription_id = os.environ.get('AZURE_SUBSCRIPTION_ID', '11111111-1111-1111-1111-111111111111') # your Azure Subscription Id
12-
my_resource_group = 'azure-python-deployment-sample' # the resource group for deployment
13-
my_pub_ssh_key_path = os.path.expanduser('~/.ssh/id_rsa.pub') # the path to your rsa public key file
11+
my_subscription_id = os.environ.get(
12+
'AZURE_SUBSCRIPTION_ID', '11111111-1111-1111-1111-111111111111') # your Azure Subscription Id
13+
# the resource group for deployment
14+
my_resource_group = 'azure-python-deployment-sample'
15+
# the path to your rsa public key file
16+
my_pub_ssh_key_path = os.path.expanduser('~/.ssh/id_rsa.pub')
1417

1518
msg = "\nInitializing the Deployer class with subscription id: {}, resource group: {}" \
1619
"\nand public key located at: {}...\n\n"
@@ -24,7 +27,9 @@
2427
# Deploy the template
2528
my_deployment = deployer.deploy()
2629

27-
print("Done deploying!!\n\nYou can connect via: `ssh azureSample@{}.westus.cloudapp.azure.com`".format(deployer.dns_label_prefix))
30+
print("Done deploying!!\n\nYou can connect via: `ssh azureSample@{}.westus.cloudapp.azure.com`".format(
31+
deployer.dns_label_prefix))
2832

2933
# Destroy the resource group which contains the deployment
30-
# deployer.destroy()
34+
# deployer.destroy()
35+
()

deployer.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from azure.mgmt.resource import ResourceManagementClient
77
from azure.mgmt.resource.resources.models import DeploymentMode
88

9+
910
class Deployer(object):
1011
""" Initialize the deployer class with subscription, resource group and public key.
1112
@@ -30,18 +31,20 @@ def __init__(self, subscription_id, resource_group, pub_ssh_key_path='~/.ssh/id_
3031
secret=os.environ['AZURE_CLIENT_SECRET'],
3132
tenant=os.environ['AZURE_TENANT_ID']
3233
)
33-
self.client = ResourceManagementClient(self.credentials, self.subscription_id)
34+
self.client = ResourceManagementClient(
35+
self.credentials, self.subscription_id)
3436

3537
def deploy(self):
3638
"""Deploy the template to a resource group."""
3739
self.client.resource_groups.create_or_update(
3840
self.resource_group,
3941
{
40-
'location':'westus'
42+
'location': 'westus'
4143
}
4244
)
4345

44-
template_path = os.path.join(os.path.dirname(__file__), 'templates', 'template.json')
46+
template_path = os.path.join(os.path.dirname(
47+
__file__), 'templates', 'template.json')
4548
with open(template_path, 'r') as template_file_fd:
4649
template = json.load(template_file_fd)
4750

0 commit comments

Comments
 (0)