The .deploy() function is working for FundMe.sol contract but not for MockV3Interface.sol Contract.
Here's my deploy.py code below:
from brownie import FundMe, MockV3Aggregator, accounts, config, network
from scripts.helpful_scripts import get_account
def deploy_fund_me():
account = get_account()
# Passing Price Feed to our Solidity contract.
# If we are on a persistent network like rinkeby, use its price feed address.
# Otherwise use Mocks.
# print(account)
if network.show_active() != "development":
price_feed_address = config["networks"][network.show_active()][
"eth_usd_price_feed"
]
else:
print(f"The current Network is: {network.show_active()}")
print("Deploying Mock....")
mock_aggregator = MockV3Aggregator.deploy(
18, 2000000000000000000, {"from": accounts}
)
price_feed_address = mock_aggregator.address
print("Mock Deployed!!")
fund_me = FundMe.deploy(
price_feed_address,
{"from": account},
publish_source=True,
)
print(f"It is deployed to {fund_me.address}")
def main():
deploy_fund_me()
And Here's the error Window::
Running '\Users\HP\Development\demos\brownie_fund_me\scripts\deploy.py::main'...
The current Network is: development
Deploying Mock....
File "c:\users\hp\development\demos\brownie_simple_storage\venv\lib\site-packages\brownie\_cli\run.py", line 50, in main
return_value, frame = run(
File "c:\users\hp\development\demos\brownie_simple_storage\venv\lib\site-packages\brownie\project\scripts.py", line 103, in run
return_value = f_locals[method_name](*args, **kwargs)
File "\Users\HP\Development\demos\brownie_fund_me\scripts\deploy.py", line 34, in main
deploy_fund_me()
File "\Users\HP\Development\demos\brownie_fund_me\scripts\deploy.py", line 19, in deploy_fund_me
mock_aggregator = MockV3Aggregator.deploy(
File "c:\users\hp\development\demos\brownie_simple_storage\venv\lib\site-packages\brownie\network\contract.py", line 528, in __call__
return tx["from"].deploy(
AttributeError: 'Accounts' object has no attribute 'deploy'
Terminating local RPC client...
Everyone's Help would be appreciated.
THANKS IN ADVANCE
This is a solution to your problem...use account instead of accounts
from brownie import accounts, config, MyContract
def deploy_my_contract():
account = accounts[0]
my_contract = MyContract.deploy({"from": account})
some_return_value = my_contract.some_func()
print(some_return_value)
I'm doing the same course..
My problem was that accounts[0] was in a function and not returning anything due to missing () in the call
This is now working for me.
def get_account():
if network.show_active == "development":
return accounts[0]
else:
return accounts.add(config["wallets"]["from_key"])
def deploy_fund_me():
account = get_account()
fund_me = FundMe.deploy({"from": account})
Related
So I am working on a coding project for my internship in DC. My project involves using python and microsoft graph api to build a program that checks the email addresses of employees obtained at my company to see if another authorization method has been added to the email address. If another authorization method is detected for an email address, it could mean that someone/a bad actor is trying to access information.
I have been referring to the video Getting Started With Microsoft Graph API For Python Development (Set Up & Authentication) by Jie Jenn. So far, I'm able to get a device code and link from the program, but I cannot obtain the authorization code. Aside from that, I am also getting a traceback error in line 31 of demo2.py, another 2 traceback errors in line 12 and 100 of main.py, and TypeError: 'dict' object is not callable in demo2.py.
Here is my code.
Thank You,
Sairam
Errors:
'''
Traceback (most recent call last):
File "C:\Users\S.Soundararajan\Documents\PE Project for Azure\demo2.py", line 31, in
webbrowser.open(flow('verification_uri'))
TypeError: 'dict' object is not callable
'''
'''
Traceback (most recent call last):
File "C:\Users\S.Soundararajan\Documents\PE Project for Azure\main.py", line 100, in
main()
File "C:\Users\S.Soundararajan\Documents\PE Project for Azure\main.py", line 12, in main
graph: Graph = Graph(azure_settings)
TypeError: Graph() takes no arguments
Python Graph Tutorial
'''
demo2.py:
`
#import account as account
import webbrowser
from xmlrpc.client import APPLICATION_ERROR
import requests
import msal
from msal import PublicClientApplication
CLIENT_ID = ''
CLIENT_SECRET = ''
authority_url = ''
base_url = 'https://graph.microsoft.com/v1.0/'
endpoint = base_url + 'me'
SCOPES = ['User.Read', 'Mail.Read', 'Mail.Send']
# Method 2. Login to acquire access_token
app = PublicClientApplication(
CLIENT_ID,
authority = authority_url
)
#accounts = app.get_accounts()
#if accounts:
#app.acquire_token_silent(scopes=SCOPES, account=account[0])
flow = app.initiate_device_flow(scopes=SCOPES)
print(flow)
print(flow['message'])
#app_code = flow['message']
webbrowser.open(flow('verification_uri'))
result = app.acquire_token_by_device_flow(flow)
access_token_id = result['access_token']
headers = {'Authorization': 'Bearer' + access_token_id}
response = requests.get(endpoint, headers=headers)
print(response)
print(response.json())
`
main.py:
import configparser
from graph import Graph
from msal import PublicClientApplication
def main():
print('Python Graph Tutorial\n')
# Load settings
config = configparser.ConfigParser()
config.read(['config.cfg', 'config.dev.cfg'])
azure_settings = config['azure']
graph: Graph = Graph(azure_settings)
greet_user(graph)
choice = -1
while choice != 0:
print('Please choose one of the following options:')
print('0. Exit')
print('1. Display access token')
print('2. List my inbox')
print('3. Send mail')
print('4. List users (requires app-only)')
print('5. Make a Graph call')
try:
choice = int(input())
except ValueError:
choice = -1
if choice == 0:
print('Goodbye...')
elif choice == 1:
display_access_token(graph)
elif choice == 2:
list_inbox(graph)
elif choice == 3:
send_mail(graph)
elif choice == 4:
list_users(graph)
elif choice == 5:
make_graph_call(graph)
else:
print('Invalid choice!\n')
def greet_user(graph: Graph):
user = graph.get_user()
print('Hello,', user['displayName'])
# For Work/school accounts, email is in mail property
# Personal accounts, email is in userPrincipalName
print('Email:', user['mail'] or user['userPrincipalName'], '\n')
def display_access_token(graph: Graph):
token = graph.get_user_token()
print('User token:', token, '\n')
return 1
def list_users(graph: Graph):
users_page = graph.get_users()
# Output each users's details
for user in users_page['value']:
print('User:', user['displayName'])
print(' ID:', user['id'])
print(' Email:', user['mail'])
# If #odata.nextLink is present
more_available = '#odata.nextLink' in users_page
print('\nMore users available?', more_available, '\n')
def list_inbox(graph: Graph):
message_page = graph.get_inbox()
# Output each message's details
for message in message_page['value']:
print('Message:', message['subject'])
print(' From:', message['from']['emailAddress']['name'])
print(' Status:', 'Read' if message['isRead'] else 'Unread')
print(' Received:', message['receivedDateTime'])
# If #odata.nextLink is present
more_available = '#odata.nextLink' in message_page
print('\nMore messages available?', more_available, '\n')
def send_mail(graph: Graph):
# Send mail to the signed-in user
# Get the user for their email address
user = graph.get_user()
user_email = user['mail'] or user['userPrincipalName']
graph.send_mail('Testing Microsoft Graph', 'Hello world!', user_email)
print('Mail sent.\n')
def make_graph_call(graph: Graph):
graph.make_graph_call()
# Run main
main()
`
Issue1:
On the code base, the mentioned url is not declared yet, and flow was not able to find it to be executed.
Usually, the key-value pair should always use square brackets to access the value inside. One of the codes mentioned in the thread is needed to use [] to access elements of a dictionary. Not () else will get the TypeError: The "dict" object is not callable error.
Solution:
authority_url= 'https://docs.python.org/'
webbrowser.open_new(authority_url) // same window
webbrowser.open_new_tab(authority_url) // will open in new tab
Issue 2:
refer this official tutorial.
I am trying to read log analytics in python.
Here is my code:
AZURE_CLIENT_ID = ''
AZURE_CLIENT_SECRET = ''
AZURE_TENANT_ID = ''
workspace_id = ''
from azure.identity import ClientSecretCredential
from datetime import datetime
from azure.monitor.query import LogsQueryClient, LogsQueryStatus
start_time = datetime(2022, 1, 1)
end_time = datetime(2023, 1, 2)
credential = ClientSecretCredential(
client_id = AZURE_CLIENT_ID,
client_secret = AZURE_CLIENT_SECRET,
tenant_id = AZURE_TENANT_ID
)
client = LogsQueryClient(credential)
query = "ContainerLog"
response = client.query_workspace(workspace_id=workspace_id,
query=query, timespan=(start_time, end_time - start_time))
if response.status == LogsQueryStatus.PARTIAL:
error = response.partial_error
print('Results are partial', error.message)
elif response.status == LogsQueryStatus.SUCCESS:
results = []
for table in response.tables:
for row in table.rows:
results.append(dict(zip(table.columns, row)))
print(convert_azure_table_to_dict(results))
and it is failing:
Traceback (most recent call last):
File "c:\temp\x.py", line 24, in <module>
response = client.query_workspace(workspace_id=workspace_id,
File "C:\kourosh\venv\lib\site-packages\azure\core\tracing\decorator.py", line 78, in wrapper_use_tracer
return func(*args, **kwargs)
File "C:\kourosh\venv\lib\site-packages\azure\monitor\query\_logs_query_client.py", line 136, in query_workspace
process_error(err, LogsQueryError)
File "C:\kourosh\venv\lib\site-packages\azure\monitor\query\_helpers.py", line 141, in process_error
raise HttpResponseError(message=error.message, response=error.response, model=model)
azure.core.exceptions.HttpResponseError: (InsufficientAccessError) The provided credentials have insufficient access to perform the requested operation
Code: InsufficientAccessError
Message: The provided credentials have insufficient access to perform the requested operation
I have added Log Analytics API -> Data.Read permission to the registered app that I'm using.
Any idea what is causing this?
Data.Read provides permissions to use the API and grant your app access to your Log Analytics Workspace. However, for accessing data within log analytics workspace, you need to provide permissions as per the data you need access to.
References:
https://learn.microsoft.com/en-us/azure/azure-monitor/logs/api/access-api
https://learn.microsoft.com/en-us/azure/azure-monitor/logs/manage-access?tabs=portal
When I am trying to run my python code in lambda passing the handler to the function.module getting the below error, any suggestions how i could resolve this?
the below file test_client_visitor is triggered to call the client_visitor and send an email to the clients accordingly, when i run thd python file test_client_visitor in my local i get the email triggered successfully but in lambda facing the issue.
file_name: test_client_visitor
function = __import__('client_visitor')
handler = function.scan_clients
class TestFunction(unittest.TestCase):
def test_function(self):
file = open('event.json', 'rb')
try:
ba = bytearray(file.read())
event = jsonpickle.decode(ba)
print('## EVENT')
print(jsonpickle.encode(event))
context = {'requestid': '1234'}
result = handler(event, context)
print(result)
self.assertTrue(result, 'Emails could not be sent!')
finally:
file.close()
file.close()
if __name__ == '__main__':
unittest.main()
file_name: client_visitor.py
import datetime
import boto3
from aws_ses import send_bulk_templated_email
# boto3.set_stream_logger('botocore', level='DEBUG')
from mongodb import get_mongo_db
def process_clients(clients, developers, clients_to_be_notified, days):
if not clients:
pass
check_date = datetime.datetime.now() + datetime.timedelta(days)
for client in clients:
client_id_ = client['client_id']
if 'developer_id' in client:
developers[client_id_] = client['developer_id']
else:
if 'secrets' in client:
secrets = client['secrets']
for secret in secrets:
if 'not_on_or_after' in secret and secret['not_on_or_after'] < check_date.timestamp():
clients_to_be_notified.append({'client_id': client_id_,
'expiration_date': datetime.datetime.fromtimestamp(
secret['not_on_or_after']).strftime('%m/%d/%Y')})
print("adding client to notify List", client_id_, ":", client['sort'])
def notify_clients(clients_to_be_notified, developers):
developer_id_list = []
for client_secret in clients_to_be_notified:
developer_id_list.append(developers[client_secret['client_id']])
if developer_id_list:
db = get_mongo_db()
if db:
users = list(db.users.find({'guid': {'$in': developer_id_list}}, {'email', 'guid'}))
need_to_send_email = False
for user in users:
for client_secret in clients_to_be_notified:
if developers[client_secret['client_id']] == user['guid']:
client_secret['email'] = user['email']
need_to_send_email = True
break
if need_to_send_email:
return send_bulk_templated_email(clients_to_be_notified)
else:
return False
return True
def scan_clients(event, context):
local = False
if 'local' in event:
local = event['local'] == 'True'
if local:
dynamodb = boto3.resource('dynamodb', endpoint_url="http://localhost:8000")
else:
dynamodb = boto3.resource('dynamodb')
days = 30
if 'days' in event:
days = int(event['days'])
print(f"Scanning Clients with {days} or less to secret expiration")
table = dynamodb.Table('****')
scan_kwargs = {
'ProjectionExpression': 'client_id, sort, developer_id, secrets, approved'
}
test = False
if 'test' in event:
test = event['test'] == 'True'
done = False
start_key = None
developers = {}
clients_to_be_notified = []
if test:
developers['idm-portal1'] = '***'
clients_to_be_notified = [{'client_id': 'idm-portal1', 'expiration_date': '04/17/2021'}]
while not done:
if start_key:
scan_kwargs['ExclusiveStartKey'] = start_key
response = table.scan(**scan_kwargs)
process_clients(response.get('Items', []), developers, clients_to_be_notified, days)
start_key = response.get('LastEvaluatedKey', None)
done = start_key is None
print("total developers ", len(developers), " total clients_to_be_notified ", len(clients_to_be_notified))
return notify_clients(clients_to_be_notified, developers)
if __name__ == '__main__':
scan_clients(event={'days': 30, 'local': False, 'test': True}, context=None)
Response
{
"errorMessage": "Unable to import module 'test_client_visitor': No module named 'test_client_visitor'",
"errorType": "Runtime.ImportModuleError",
"stackTrace": []
}
Your file must be named test_client_visitor.py. The way lambda runs the code is by trying to import the main file and call the handler function. See the AWS docs to set up a handler for Python.
The reason you didn't run into this issue locally is because I assume you are calling python directly on the command line — python test_client_visitor. When you import a module in Python, the file has to end in the .py extension.
Able to fix this issue with right packaging of the contents to zip, avoided the creation of extra folder with the below command.
Command:
cd folder; zip -r ../filename.zip *
Thankyou everyone for your inputs.
I use pycharm to write a python3 web app project using tornado web framework,
The listing service has been built already. I need to build the remaining two components: the user service and the public API layer. The implementation of the listing service can serve as a good starting point to learn more about how to structure a web application using the Tornado web framework.
I am required to use tornado's built in framework for HTTP request.
error occurs at listening ( app.listen(options.port)) when I tried to run the program:
Traceback (most recent call last):
File "D:/Bill/python/Tornado/99-python-exercise-master/listing_service.py", line 203, in <module>
app.listen(options.port)
File "C:\Program Files\Python38\lib\site-packages\tornado\web.py", line 2116, in listen
server.listen(port, address)
File "C:\Program Files\Python38\lib\site-packages\tornado\tcpserver.py", line 152, in listen
self.add_sockets(sockets)
File "C:\Program Files\Python38\lib\site-packages\tornado\tcpserver.py", line 165, in add_sockets
self._handlers[sock.fileno()] = add_accept_handler(
File "C:\Program Files\Python38\lib\site-packages\tornado\netutil.py", line 279, in add_accept_handler
io_loop.add_handler(sock, accept_handler, IOLoop.READ)
File "C:\Program Files\Python38\lib\site-packages\tornado\platform\asyncio.py", line 100, in add_handler
self.asyncio_loop.add_reader(fd, self._handle_events, fd, IOLoop.READ)
File "C:\Program Files\Python38\lib\asyncio\events.py", line 501, in add_reader
raise NotImplementedError
NotImplementedError
code:
import tornado.web
import tornado.log
import tornado.options
import sqlite3
import logging
import json
import time
class App(tornado.web.Application):
def __init__(self, handlers, **kwargs):
super().__init__(handlers, **kwargs)
# Initialising db connection
self.db = sqlite3.connect("listings.db")
self.db.row_factory = sqlite3.Row
self.init_db()
def init_db(self):
cursor = self.db.cursor()
# Create table
cursor.execute(
"CREATE TABLE IF NOT EXISTS 'listings' ("
+ "id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,"
+ "user_id INTEGER NOT NULL,"
+ "listing_type TEXT NOT NULL,"
+ "price INTEGER NOT NULL,"
+ "created_at INTEGER NOT NULL,"
+ "updated_at INTEGER NOT NULL"
+ ");"
)
self.db.commit()
class BaseHandler(tornado.web.RequestHandler):
def write_json(self, obj, status_code=200):
self.set_header("Content-Type", "application/json")
self.set_status(status_code)
self.write(json.dumps(obj))
# /listings
class ListingsHandler(BaseHandler):
#tornado.gen.coroutine
def get(self):
# Parsing pagination params
page_num = self.get_argument("page_num", 1)
page_size = self.get_argument("page_size", 10)
try:
page_num = int(page_num)
except:
logging.exception("Error while parsing page_num: {}".format(page_num))
self.write_json({"result": False, "errors": "invalid page_num"}, status_code=400)
return
try:
page_size = int(page_size)
except:
logging.exception("Error while parsing page_size: {}".format(page_size))
self.write_json({"result": False, "errors": "invalid page_size"}, status_code=400)
return
# Parsing user_id param
user_id = self.get_argument("user_id", None)
if user_id is not None:
try:
user_id = int(user_id)
except:
self.write_json({"result": False, "errors": "invalid user_id"}, status_code=400)
return
# Building select statement
select_stmt = "SELECT * FROM listings"
# Adding user_id filter clause if param is specified
if user_id is not None:
select_stmt += " WHERE user_id=?"
# Order by and pagination
limit = page_size
offset = (page_num - 1) * page_size
select_stmt += " ORDER BY created_at DESC LIMIT ? OFFSET ?"
# Fetching listings from db
if user_id is not None:
args = (user_id, limit, offset)
else:
args = (limit, offset)
cursor = self.application.db.cursor()
results = cursor.execute(select_stmt, args)
listings = []
for row in results:
fields = ["id", "user_id", "listing_type", "price", "created_at", "updated_at"]
listing = {
field: row[field] for field in fields
}
listings.append(listing)
self.write_json({"result": True, "listings": listings})
#tornado.gen.coroutine
def post(self):
# Collecting required params
user_id = self.get_argument("user_id")
listing_type = self.get_argument("listing_type")
price = self.get_argument("price")
# Validating inputs
errors = []
user_id_val = self._validate_user_id(user_id, errors)
listing_type_val = self._validate_listing_type(listing_type, errors)
price_val = self._validate_price(price, errors)
time_now = int(time.time() * 1e6) # Converting current time to microseconds
# End if we have any validation errors
if len(errors) > 0:
self.write_json({"result": False, "errors": errors}, status_code=400)
return
# Proceed to store the listing in our db
cursor = self.application.db.cursor()
cursor.execute(
"INSERT INTO 'listings' "
+ "('user_id', 'listing_type', 'price', 'created_at', 'updated_at') "
+ "VALUES (?, ?, ?, ?, ?)",
(user_id_val, listing_type_val, price_val, time_now, time_now)
)
self.application.db.commit()
# Error out if we fail to retrieve the newly created listing
if cursor.lastrowid is None:
self.write_json({"result": False, "errors": ["Error while adding listing to db"]}, status_code=500)
return
listing = dict(
id=cursor.lastrowid,
user_id=user_id_val,
listing_type=listing_type_val,
price=price_val,
created_at=time_now,
updated_at=time_now
)
self.write_json({"result": True, "listing": listing})
def _validate_user_id(self, user_id, errors):
try:
user_id = int(user_id)
return user_id
except Exception as e:
logging.exception("Error while converting user_id to int: {}".format(user_id))
errors.append("invalid user_id")
return None
def _validate_listing_type(self, listing_type, errors):
if listing_type not in {"rent", "sale"}:
errors.append("invalid listing_type. Supported values: 'rent', 'sale'")
return None
else:
return listing_type
def _validate_price(self, price, errors):
# Convert string to int
try:
price = int(price)
except Exception as e:
logging.exception("Error while converting price to int: {}".format(price))
errors.append("invalid price. Must be an integer")
return None
if price < 1:
errors.append("price must be greater than 0")
return None
else:
return price
# /listings/ping
class PingHandler(tornado.web.RequestHandler):
#tornado.gen.coroutine
def get(self):
self.write("pong!")
def make_app(options):
return App([
(r"/listings/ping", PingHandler),
(r"/listings", ListingsHandler),
], debug=options.debug)
if __name__ == "__main__":
# Define settings/options for the web app
# Specify the port number to start the web app on (default value is port 6000)
tornado.options.define("port", default=6000)
# Specify whether the app should run in debug mode
# Debug mode restarts the app automatically on file changes
tornado.options.define("debug", default=True)
# Read settings/options from command line
tornado.options.parse_command_line()
# Access the settings defined
options = tornado.options.options
# Create web app
app = make_app(options)
app.listen(options.port)
logging.info("Starting listing service. PORT: {}, DEBUG: {}".format(options.port, options.debug))
# Start event loop
tornado.ioloop.IOLoop.instance().start()
How to fix this problem?
Python 3.8 made a backwards-incompatible change to the asyncio package used by Tornado. Applications that use Tornado on Windows with Python 3.8 must call asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy()) at the beginning of their main file/function. (as documented on the home page of tornadoweb.org)
I am trying to create an instance from a bootable volume in openstack using python-novaclient.
The steps I am taking are following:
Step1: create a volume with an Image "Centos" with 100GB.
Step2: create an instance with the volume that I created in step1.
However, I must be doing something wrong or missing some information that it is not able to complete the task.
Here are my commands in python shell.
import time, getpass
from cinderclient import client
from novaclient.client import Client
project_name = 'project'
region_name = 'region'
keystone_link = 'https://keystone.net:5000/v2.0'
network_zone = "Public"
key_name = 'key_pair'
user = 'user'
pswd = getpass.getpass('Password: ')
# create a connection
cinder = client.Client('1', user, pswd, project_name, keystone_link, region_name = region_name)
# get the volume id that we will attach
print(cinder.volumes.list())
[<Volume: 1d36203e-b90d-458f-99db-8690148b9600>, <Volume: d734f5fc-87f2-41dd-887e-c586bf76d116>]
vol1 = cinder.volumes.list()[1]
vol1.id
block_device_mapping = {'device_name': vol1.id, 'mapping': '/dev/vda'}
### +++++++++++++++++++++++++++++++++++++++++++++++++++++ ###
# now create a connection with nova and create then instance object
nova = Client(2, user, pswd, project_name, keystone_link, region_name = region_name)
# find the image
image = nova.images.find(name="NETO CentOS 6.4 x86_64 v2.2")
# get the flavor
flavor = nova.flavors.find(name="m1.large")
#get the network and attach
network = nova.networks.find(label=network_zone)
nics = [{'net-id': network.id}]
# get the keyname and attach
key_pair = nova.keypairs.get(key_name)
s1 = 'nova-vol-test'
server = nova.servers.create(name = s1, image = image.id, block_device_mapping = block_device_mapping, flavor = flavor.id, nics = nics, key_name = key_pair.name)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.6/site-packages/novaclient/v1_1/servers.py", line 902, in create
**boot_kwargs)
File "/usr/lib/python2.6/site-packages/novaclient/v1_1/servers.py", line 554, in _boot
return_raw=return_raw, **kwargs)
File "/usr/lib/python2.6/site-packages/novaclient/base.py", line 100, in _create
_resp, body = self.api.client.post(url, body=body)
File "/usr/lib/python2.6/site-packages/novaclient/client.py", line 490, in post
return self._cs_request(url, 'POST', **kwargs)
File "/usr/lib/python2.6/site-packages/novaclient/client.py", line 465, in _cs_request
resp, body = self._time_request(url, method, **kwargs)
File "/usr/lib/python2.6/site-packages/novaclient/client.py", line 439, in _time_request
resp, body = self.request(url, method, **kwargs)
File "/usr/lib/python2.6/site-packages/novaclient/client.py", line 433, in request
raise exceptions.from_response(resp, body, url, method)
novaclient.exceptions.BadRequest: Block Device Mapping is Invalid: failed to get volume /dev/vda. (HTTP 400) (Request-ID: req-2b9db4e1-f24f-48c6-8660-822741ca52ad)
>>>
I tried to find any documentation so that I can solve this on my own, however, I was not able to.
If anyone has tried this before, I would appreciate there help on this.
Thanks,
Murtaza
I was able to get it to work by using this dictionary:
block_dev_mapping = {'vda':'uuid of the volume you want to use'}
I then called it in the create method like this:
instance = nova.servers.create(name="python-test3", image='', block_device_mapping=block_dev_mapping,
flavor=flavor, key_name="my-keypair", nics=nics)