Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate Azure to ARM #63

Merged
merged 12 commits into from Mar 20, 2018
Merged

Migrate Azure to ARM #63

merged 12 commits into from Mar 20, 2018

Conversation

smarlowucf
Copy link
Collaborator

@smarlowucf smarlowucf commented Feb 23, 2018

@rjschwei This is not ready for merge as tests have not been migrated.

However, code is ready for review. Does this seem like an okay route to allowing subnet arg?

I.e. subnet-id, vnet-name and vnet-resource-group can be supplied to launch the new instance in the provided subnet.

All resources that are created by IPA still go into their own group which makes cleanup very nice. And in testing this worked fine to have a NIC attached to a subnet in a different group.

This accepts the json cred fiel directly which includes the
proper resource management endpoint for each service principal.
Supplying subnet-id vnet-name and vnet-resource-group launches
instance into the given subnet.

All created resources will reside in a new resource group for
easy cleanup when testing is finished.
Required by all azure packages but explicitly imported for
client factory function.
@smarlowucf
Copy link
Collaborator Author

Unit tests updated.

ipa/ipa_azure.py Outdated
Attach NIC to the subnet and public IP provided.
"""
try:
nic_operation = self.network.network_interfaces.create_or_update(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nic_setup or nic_config, nic_operation is a weird name for what is happening here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it is although the return value from Azure is an operation type.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand but we do not name things by type, we don't usually use repo_list, but would call it repositories, for example

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😄 Right, had trouble thinking of a good name for them.

ipa/ipa_azure.py Outdated
'id': public_ip.id
},
}]
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this dict should be created outside the argument list to the create_or_update() method. It makes the call location more concise and it makes it easier to track the arguments

ipa/ipa_azure.py Outdated
Create dynamic public IP address in the resource group.
"""
try:
public_ip_operation = \
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

naming, see earlier comment

ipa/ipa_azure.py Outdated
{
'location': region,
'public_ip_allocation_method': 'Dynamic'
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pre-create the dict

ipa/ipa_azure.py Outdated
Attempt to create or update VM instance based on vm_parameters config.
"""
try:
vm_operation = self.compute.virtual_machines.create_or_update(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

naming

ipa/ipa_azure.py Outdated
Create a subnet in the provided vnet and resource group.
"""
try:
subnet_operation = self.network.subnets.create_or_update(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

naming

ipa/ipa_azure.py Outdated
'address_space': {
'address_prefixes': ['10.0.0.0/27']
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pre-create the dict and naming ;)

ipa/ipa_azure.py Outdated
'primary': True
}]
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's is really nothing wrong with creating temporary variables. This will make the composition of the information much more digestible.

ipa/ipa_azure.py Outdated
instance_name=self.running_instance_id
)
self._wait_on_instance('ReadyRole')
start_operation.wait()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

naming

@smarlowucf
Copy link
Collaborator Author

@rjschwei Look good?

@rjschwei rjschwei merged commit 97c5d38 into master Mar 20, 2018
@smarlowucf smarlowucf deleted the azure-arm branch March 20, 2018 22:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants