mirror of
https://github.com/microsoft/onefuzz.git
synced 2025-06-17 04:18:07 +00:00
NSG Updated After CLI Update to Instance_Config (#1375)
* Creating InstanceConfig Attributes for NSG Refactor (#1331) * Updating instance_config * Updating attribute names. * Updating list factory. * Updating config attributes. Co-authored-by: nharper285 <nharper285@gmail.com> * NSG deployment on a creation of new debug/repro proxy. (#1340) Co-authored-by: stas <statis@microsoft.com> * Code for updating NSGs when instance_config updated. * Updating argument to set_allowed_rules * Temporarily ignore non-actionable `cargo audit` errors (#1365) * Updating model to no longer be optional. * Fixing args for set_allowed_rules * trying to fix calls to get_nsg * Updating calls to nsg lib * Fixing imports. * Updating calls to set_allowed and creating constructor for NSGConfig type. * Removing constructor and manually setting default ip * Fixing models. * Hopefully fixing docs. * Fix set_allowed call * Adding error handling for update config. * Changing to error check. * Fixing error call. * Fixing imports. * Updating instanceconfig retrieval. * Fixing imports. * Adding empty() function on request. * Fixing name of function. * Removing empty function. Co-authored-by: nharper285 <nharper285@gmail.com> Co-authored-by: Stas <stishkin@live.com> Co-authored-by: stas <statis@microsoft.com> Co-authored-by: Joe Ranweiler <joranwei@microsoft.com>
This commit is contained in:
committed by
GitHub
parent
97a3a67b3e
commit
357bc4fcad
@ -18,8 +18,10 @@ from .azure.auth import build_auth
|
||||
from .azure.containers import save_blob
|
||||
from .azure.creds import get_base_region
|
||||
from .azure.ip import get_public_ip
|
||||
from .azure.nsg import NSG
|
||||
from .azure.storage import StorageType
|
||||
from .azure.vm import VM
|
||||
from .config import InstanceConfig
|
||||
from .extension import repro_extensions
|
||||
from .orm import ORMMixin, QueryFilter
|
||||
from .reports import get_report
|
||||
@ -85,6 +87,23 @@ class Repro(BASE_REPRO, ORMMixin):
|
||||
|
||||
self.state = VmState.extensions_launch
|
||||
else:
|
||||
nsg = NSG(
|
||||
name=vm.region,
|
||||
region=vm.region,
|
||||
)
|
||||
result = nsg.create()
|
||||
if isinstance(result, Error):
|
||||
self.set_failed(result)
|
||||
return
|
||||
|
||||
config = InstanceConfig.fetch()
|
||||
nsg_config = config.proxy_nsg_config
|
||||
result = nsg.set_allowed_sources(nsg_config)
|
||||
if isinstance(result, Error):
|
||||
self.set_failed(result)
|
||||
return
|
||||
|
||||
vm.nsg = nsg
|
||||
result = vm.create()
|
||||
if isinstance(result, Error):
|
||||
self.set_error(result)
|
||||
|
Reference in New Issue
Block a user