Skip to content

Commit 0f8a9ae

Browse files
author
Prasanna Santhanam
committed
marvin_refactor: actions on entity object require id for performing the action
For eg: 1. nf = NetworkOffering.create(apiClient, NetworkOfferingFactory()) 2. nf.update(apiClient, state='Enabled') Operation #2 requires that nf's id be supplied to enable the network offering Signed-off-by: Prasanna Santhanam <[email protected]>
1 parent b4ecf77 commit 0f8a9ae

File tree

132 files changed

+1011
-390
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

132 files changed

+1011
-390
lines changed

tools/marvin/marvin/integration/lib/base/Account.py

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,20 @@ def __init__(self, items):
3232

3333
def enable(self, apiclient, **kwargs):
3434
cmd = enableAccount.enableAccountCmd()
35-
[setattr(cmd, key, value) for key,value in kwargs.items]
35+
cmd.id = self.id
36+
[setattr(cmd, key, value) for key,value in kwargs.iteritems()]
3637
account = apiclient.enableAccount(cmd)
38+
return account
3739

3840

3941
def lock(self, apiclient, account, domainid, **kwargs):
4042
cmd = lockAccount.lockAccountCmd()
43+
cmd.id = self.id
4144
cmd.account = account
4245
cmd.domainid = domainid
43-
[setattr(cmd, key, value) for key,value in kwargs.items]
46+
[setattr(cmd, key, value) for key,value in kwargs.iteritems()]
4447
account = apiclient.lockAccount(cmd)
48+
return account
4549

4650

4751
@classmethod
@@ -56,27 +60,33 @@ def create(cls, apiclient, AccountFactory, **kwargs):
5660
@classmethod
5761
def list(self, apiclient, **kwargs):
5862
cmd = listAccounts.listAccountsCmd()
59-
[setattr(cmd, key, value) for key,value in kwargs.items]
63+
[setattr(cmd, key, value) for key,value in kwargs.iteritems()]
6064
account = apiclient.listAccounts(cmd)
6165
return map(lambda e: Account(e.__dict__), account)
6266

6367

6468
def update(self, apiclient, newname, **kwargs):
6569
cmd = updateAccount.updateAccountCmd()
70+
cmd.id = self.id
6671
cmd.newname = newname
67-
[setattr(cmd, key, value) for key,value in kwargs.items]
72+
[setattr(cmd, key, value) for key,value in kwargs.iteritems()]
6873
account = apiclient.updateAccount(cmd)
74+
return account
6975

7076

7177
def disable(self, apiclient, lock, **kwargs):
7278
cmd = disableAccount.disableAccountCmd()
79+
cmd.id = self.id
7380
cmd.lock = lock
74-
[setattr(cmd, key, value) for key,value in kwargs.items]
81+
[setattr(cmd, key, value) for key,value in kwargs.iteritems()]
7582
account = apiclient.disableAccount(cmd)
83+
return account
7684

7785

7886
def delete(self, apiclient, id, **kwargs):
7987
cmd = deleteAccount.deleteAccountCmd()
88+
cmd.id = self.id
8089
cmd.id = id
81-
[setattr(cmd, key, value) for key,value in kwargs.items]
90+
[setattr(cmd, key, value) for key,value in kwargs.iteritems()]
8291
account = apiclient.deleteAccount(cmd)
92+
return account

tools/marvin/marvin/integration/lib/base/AccountFromProject.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,15 @@
2020
class AccountFromProject(CloudStackEntity.CloudStackEntity):
2121

2222

23-
def __init__(self, items):
24-
self.__dict__.update(items)
25-
26-
2723
def __init__(self, items):
2824
self.__dict__.update(items)
2925

3026

3127
def delete(self, apiclient, projectid, account, **kwargs):
3228
cmd = deleteAccountFromProject.deleteAccountFromProjectCmd()
29+
cmd.id = self.id
3330
cmd.account = account
3431
cmd.projectid = projectid
35-
[setattr(cmd, key, value) for key,value in kwargs.items]
32+
[setattr(cmd, key, value) for key,value in kwargs.iteritems()]
3633
accountfromproject = apiclient.deleteAccountFromProject(cmd)
34+
return accountfromproject

tools/marvin/marvin/integration/lib/base/AccountToProject.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,14 @@
2020
class AccountToProject(CloudStackEntity.CloudStackEntity):
2121

2222

23-
def __init__(self, items):
24-
self.__dict__.update(items)
25-
26-
2723
def __init__(self, items):
2824
self.__dict__.update(items)
2925

3026

3127
def add(self, apiclient, projectid, **kwargs):
3228
cmd = addAccountToProject.addAccountToProjectCmd()
29+
cmd.id = self.id
3330
cmd.projectid = projectid
34-
[setattr(cmd, key, value) for key,value in kwargs.items]
31+
[setattr(cmd, key, value) for key,value in kwargs.iteritems()]
3532
accounttoproject = apiclient.addAccountToProject(cmd)
33+
return accounttoproject

tools/marvin/marvin/integration/lib/base/Alerts.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,14 @@ def __init__(self, items):
2828
@classmethod
2929
def list(self, apiclient, **kwargs):
3030
cmd = listAlerts.listAlertsCmd()
31-
[setattr(cmd, key, value) for key,value in kwargs.items]
31+
[setattr(cmd, key, value) for key,value in kwargs.iteritems()]
3232
alerts = apiclient.listAlerts(cmd)
3333
return map(lambda e: Alerts(e.__dict__), alerts)
3434

3535

3636
def delete(self, apiclient, **kwargs):
3737
cmd = deleteAlerts.deleteAlertsCmd()
38-
[setattr(cmd, key, value) for key,value in kwargs.items]
38+
cmd.id = self.id
39+
[setattr(cmd, key, value) for key,value in kwargs.iteritems()]
3940
alerts = apiclient.deleteAlerts(cmd)
41+
return alerts

tools/marvin/marvin/integration/lib/base/ApiLimit.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,22 @@
2121
class ApiLimit(CloudStackEntity.CloudStackEntity):
2222

2323

24-
def __init__(self, items):
25-
self.__dict__.update(items)
26-
27-
2824
def __init__(self, items):
2925
self.__dict__.update(items)
3026

3127

3228
def reset(self, apiclient, **kwargs):
3329
cmd = resetApiLimit.resetApiLimitCmd()
34-
[setattr(cmd, key, value) for key,value in kwargs.items]
30+
cmd.id = self.id
31+
[setattr(cmd, key, value) for key,value in kwargs.iteritems()]
3532
apilimit = apiclient.resetApiLimit(cmd)
33+
return apilimit
3634

3735

3836
def get(self, apiclient, **kwargs):
3937
cmd = getApiLimit.getApiLimitCmd()
40-
[setattr(cmd, key, value) for key,value in kwargs.items]
38+
cmd.id = self.id
39+
[setattr(cmd, key, value) for key,value in kwargs.iteritems()]
4140
apilimit = apiclient.getApiLimit(cmd)
41+
return apilimit
4242

tools/marvin/marvin/integration/lib/base/Apis.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ def __init__(self, items):
2727
@classmethod
2828
def list(self, apiclient, **kwargs):
2929
cmd = listApis.listApisCmd()
30-
[setattr(cmd, key, value) for key,value in kwargs.items]
30+
[setattr(cmd, key, value) for key,value in kwargs.iteritems()]
3131
apis = apiclient.listApis(cmd)
3232
return map(lambda e: Apis(e.__dict__), apis)

tools/marvin/marvin/integration/lib/base/AsyncJobResult.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,14 @@
2020
class AsyncJobResult(CloudStackEntity.CloudStackEntity):
2121

2222

23-
def __init__(self, items):
24-
self.__dict__.update(items)
25-
26-
2723
def __init__(self, items):
2824
self.__dict__.update(items)
2925

3026

3127
def query(self, apiclient, jobid, **kwargs):
3228
cmd = queryAsyncJobResult.queryAsyncJobResultCmd()
29+
cmd.id = self.id
3330
cmd.jobid = jobid
34-
[setattr(cmd, key, value) for key,value in kwargs.items]
31+
[setattr(cmd, key, value) for key,value in kwargs.iteritems()]
3532
asyncjobresult = apiclient.queryAsyncJobResult(cmd)
33+
return asyncjobresult

tools/marvin/marvin/integration/lib/base/AsyncJobs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ def __init__(self, items):
2727
@classmethod
2828
def list(self, apiclient, **kwargs):
2929
cmd = listAsyncJobs.listAsyncJobsCmd()
30-
[setattr(cmd, key, value) for key,value in kwargs.items]
30+
[setattr(cmd, key, value) for key,value in kwargs.iteritems()]
3131
asyncjobs = apiclient.listAsyncJobs(cmd)
3232
return map(lambda e: AsyncJobs(e.__dict__), asyncjobs)

tools/marvin/marvin/integration/lib/base/AutoScalePolicies.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,6 @@ def __init__(self, items):
2727
@classmethod
2828
def list(self, apiclient, **kwargs):
2929
cmd = listAutoScalePolicies.listAutoScalePoliciesCmd()
30-
[setattr(cmd, key, value) for key,value in kwargs.items]
30+
[setattr(cmd, key, value) for key,value in kwargs.iteritems()]
3131
autoscalepolicies = apiclient.listAutoScalePolicies(cmd)
3232
return map(lambda e: AutoScalePolicies(e.__dict__), autoscalepolicies)

tools/marvin/marvin/integration/lib/base/AutoScalePolicy.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,17 @@ def create(cls, apiclient, AutoScalePolicyFactory, **kwargs):
3737

3838
def update(self, apiclient, id, **kwargs):
3939
cmd = updateAutoScalePolicy.updateAutoScalePolicyCmd()
40+
cmd.id = self.id
4041
cmd.id = id
41-
[setattr(cmd, key, value) for key,value in kwargs.items]
42+
[setattr(cmd, key, value) for key,value in kwargs.iteritems()]
4243
autoscalepolicy = apiclient.updateAutoScalePolicy(cmd)
44+
return autoscalepolicy
4345

4446

4547
def delete(self, apiclient, id, **kwargs):
4648
cmd = deleteAutoScalePolicy.deleteAutoScalePolicyCmd()
49+
cmd.id = self.id
4750
cmd.id = id
48-
[setattr(cmd, key, value) for key,value in kwargs.items]
51+
[setattr(cmd, key, value) for key,value in kwargs.iteritems()]
4952
autoscalepolicy = apiclient.deleteAutoScalePolicy(cmd)
53+
return autoscalepolicy

0 commit comments

Comments
 (0)