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

Teardowndebug #26

Merged
merged 38 commits into from
May 5, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
e4af557
import fix
jimbr70 Apr 24, 2017
a8bfa49
refactor fix
jimbr70 Apr 25, 2017
1a9829c
refactor fix
jimbr70 Apr 25, 2017
3b8733a
try/import correction to set var
jimbr70 Apr 25, 2017
6498acc
try/import correction to set var
jimbr70 Apr 25, 2017
35c71e5
refactor fix
jimbr70 Apr 25, 2017
487a17b
refactor fix
jimbr70 Apr 25, 2017
97fba27
removed a print
jimbr70 Apr 25, 2017
11585ba
sorted issue why this had to set env name previously. Now removed.
jimbr70 Apr 25, 2017
a002f36
Added test if blueprint name is empty - force error
jimbr70 Apr 25, 2017
1e63cec
message consistency and now uses self.sandbox.Blueprint_name to set n…
jimbr70 Apr 25, 2017
a4b0728
added test if pool = 0 then do not attempt to prpocess VMs
jimbr70 Apr 26, 2017
c0413a4
added test if pool = 0 then do not attempt to process network devices
jimbr70 Apr 26, 2017
e178657
just to help run debugging
jimbr70 Apr 26, 2017
30650ad
updated clear all resoruce live status to set the status to Info and …
jimbr70 Apr 26, 2017
43585fb
Added feature to email report_error conditions, using attributes in t…
jimbr70 Apr 26, 2017
56f6a10
created function to get the value of the attribute ending in ".Model"…
jimbr70 Apr 27, 2017
9e0d91c
edits, fixes to image_key and dict stuff relating to concrete name ve…
jimbr70 Apr 28, 2017
5a12d61
created function to get the value of the attribute ending in ".Model"…
jimbr70 Apr 28, 2017
62b03b7
fixes, updates for handling model attrib
jimbr70 Apr 28, 2017
3c3a210
change to
jimbr70 May 4, 2017
fa997dc
changes to fix isues with test config, adding environmentPath,
jimbr70 May 4, 2017
0312028
changes to fix isues with test config, adding environmentPath,
jimbr70 May 4, 2017
1c36302
cleaned appearance, added reporting info
jimbr70 May 4, 2017
c81fda8
added freeze_gun
jimbr70 May 4, 2017
50eeb9f
changes to init per yaniv
jimbr70 May 5, 2017
d1a20f2
Merged two ifs to one, per Yaniv
jimbr70 May 5, 2017
3bd9812
rename emailalert to _emailalert
jimbr70 May 5, 2017
fb30370
removed function for handling attribute or attribute ending in Model …
jimbr70 May 5, 2017
90860eb
Update .travis.yml
kalsky May 5, 2017
25ade05
Update Sandbox.py
kalsky May 5, 2017
1000180
Update Sandbox.py
kalsky May 5, 2017
3818b05
Update .travis.yml
kalsky May 5, 2017
3194c5a
Update test_requirements.txt
kalsky May 5, 2017
6eabbf1
Update Sandbox.py
kalsky May 5, 2017
32b9e6d
Revert "Update Sandbox.py"
kalsky May 5, 2017
4232efb
Reverted and removed the environment_path variable
kalsky May 5, 2017
b471401
Fixed code alignment
kalsky May 5, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
after_success: coveralls
install:
- pip install -r ./test_requirements.txt
- pip install "cloudshell-core>=2.0.0,<2.1.0"
- pip install "cloudshell-automation-api>=7.1,<7.3"
- pip install "cloudshell-shell-core>=2.3.0,<2.4.0"
- pip install pytest-cov
language: python
notifications:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import pip

try:
import gitlab
imported_gitlab = True
import gitlab
except:
try:
pip.main(["install","pyapi-gitlab"])
Expand Down Expand Up @@ -58,7 +58,6 @@ def download(self, source, destination):
try:
with open(destination,'w') as dest:
dest.write(filetext)
print "Downloaded: " + source
return 0, "Successfully retrieved file from repository and saved to destination"
except Exception as ex:
raise QualiError("GitLabClient","ERROR: Retrieved file from repository - failed to save to destination : " + str(ex.message))
22 changes: 13 additions & 9 deletions sandbox_scripts/QualiEnvironmentUtils/Resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,11 @@ def __init__(self, resource_name, resource_alias=''):
self.connected_commands = self.api_session.GetResourceConnectedCommands(resource_name).Commands

self.attributes = self.details.ResourceAttributes
# If there is an attribute named 'model' take its value (exist in shells), otherwise take the family's model
# If there is an attribute 'named' 'model' use its value, otherwise take the family's model
if self.attribute_exist('Model'):
self.model = self.get_attribute('Model')
else:
self.model = self.details.ResourceModelName

self.model = str(self.details.ResourceModelName)
self.alias = resource_alias

# -----------------------------------------
Expand All @@ -45,17 +44,16 @@ def has_command(self, command_name):
def attribute_exist(self, attribute_name):
attribute_name = attribute_name.lower()
for attribute in self.attributes:
if attribute.Name.lower() == attribute_name:
if attribute.Name.lower() == attribute_name or attribute.Name.lower().endswith('.' + attribute_name):
return True
return False


# -----------------------------------------
# -----------------------------------------
def get_attribute(self, attribute_name):
attribute_name = attribute_name.lower()
for attribute in self.attributes:
if attribute.Name.lower() == attribute_name:
if attribute.Name.lower() == attribute_name or attribute.Name.lower().endswith('.' + attribute_name):
if attribute.Type == 'Password':
decrypted = self.api_session.DecryptPassword(attribute.Value)
return decrypted.Value
Expand All @@ -66,11 +64,17 @@ def get_attribute(self, attribute_name):
# -----------------------------------------
# -----------------------------------------
def set_attribute_value(self, attribute_name, attribute_value):
# if caller passes ending string of name, need to handle not knowing prefix
try:
self.api_session.SetAttributeValue(resourceFullPath=self.name, attributeName=attribute_name,
attributeValue=attribute_value)
attribute_name = attribute_name.lower()
for attribute in self.attributes:
if attribute.Name.lower() == attribute_name or attribute.Name.lower().endswith('.' + attribute_name):
self.api_session.SetAttributeValue(resourceFullPath=self.name,
attributeName=attribute.Name,
attributeValue=attribute_value)
return
except CloudShellAPIError as error:
raise QualiError(self.name, "Attribute: " + attribute_name + " not found. " + error.message)
raise QualiError(self.name, "Attribute named or ending-with: " + attribute_name + " not found. " + error.message)

# -----------------------------------------
# implement the command to get the neighbors and their ports
Expand Down
Loading