Skip to content

Commit

Permalink
modify to ignore testing/.cache/ files
Browse files Browse the repository at this point in the history
  • Loading branch information
vsemp authored and portante committed Apr 19, 2017
1 parent 79d7548 commit 9039822
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 43 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
*.pyc

*.cache
39 changes: 3 additions & 36 deletions bin/quads.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import argparse
import os
import sys
import json
import logging
import requests
from subprocess import call
Expand Down Expand Up @@ -39,7 +38,6 @@ def main(argv):
quads_config_file = os.path.dirname(__file__) + "/../conf/quads.yml"
quads_config = quads_load_config(quads_config_file)


if "data_dir" not in quads_config:
print "quads: Missing \"data_dir\" in " + quads_config_file
exit(1)
Expand All @@ -56,10 +54,6 @@ def main(argv):
defaultstatedir = quads_config["data_dir"] + "/state"
defaultmovecommand = "/bin/echo"


# added for EC528 HIL-QUADS integration project - not a good place for this variable - should be moved eventually
hil_url = 'http://127.0.0.1:5000'

parser = argparse.ArgumentParser(description='Query current cloud for a given host')
parser.add_argument('--host', dest='host', type=str, default=None, help='Specify the host to query')
parser.add_argument('--cloud-only', dest='cloudonly', type=str, default=None, help='Limit full report to hosts only in this cloud')
Expand Down Expand Up @@ -104,10 +98,6 @@ def main(argv):
parser.add_argument('--dry-run', dest='dryrun', action='store_true', default=None, help='Dont update state when used with --move-hosts')
parser.add_argument('--log-path', dest='logpath',type=str,default=None, help='Path to quads log file')

parser.add_argument('--hil-api-action', dest='hilapiaction', type=str, default=None, help='HIL API Action');
parser.add_argument('--hil-api-call', dest='hilapicall', type=str, default=None, help='HIL API Call');


args = parser.parse_args()

if args.logpath :
Expand Down Expand Up @@ -182,7 +172,6 @@ def main(argv):

if args.lsclouds:
quads.quads_list_clouds()
#quads.quads_rest_call('GET', hil_url, '/projects')
exit(0)

if args.lsowner:
Expand All @@ -206,18 +195,10 @@ def main(argv):
exit(1)

if args.rmhost:
print "Detaching HIL node " + args.rmhost + " from project " + args.hostcloud
quads.quads_rest_call('POST', hil_url, '/project/' + args.hostcloud + '/detach_node', json.dumps({'node': args.rmhost})) #EC528 addition)
print "removing QUADS host " + args.rmhost + " from " + args.hostcloud + " in QUADS data"
quads.quads_remove_host(args.rmhost)
exit(0)

if args.rmcloud:
print "Deleting network in HIL named " + args.rmcloud
quads.quads_rest_call('DELETE', hil_url, '/network/' + args.rmcloud) #EC528 addition
print "Deleting project in HIL named " + args.rmcloud
quads.quads_rest_call('DELETE', hil_url, '/project/' + args.rmcloud) #EC528 addition
print "Deleting " + args.rmcloud + " from QUADS data"
quads.quads_remove_cloud(args.rmcloud)
exit(0)

Expand All @@ -226,18 +207,10 @@ def main(argv):
exit(1)

if args.hostresource:
print "attaching HIL node " + args.hostresource + " to project " + args.hostcloud
quads.quads_rest_call('POST', hil_url, '/project/' + args.hostcloud + '/connect_node', json.dumps({'node': args.hostresource})) #EC528 addition
print "defining QUADS host " + args.hostresource + " and adding it to " + args.hostcloud + " in QUADS data"
quads.quads_update_host(args.hostresource, args.hostcloud, args.force)
exit(0)

if args.cloudresource:
print "creating project in HIL named " + args.cloudresource
quads.quads_rest_call('PUT', hil_url, '/project/' + args.cloudresource) #EC528 addition
print "adding network to HIL and attaching it to " + args.cloudresource
quads.quads_rest_call('PUT', hil_url, '/network/' + args.cloudresource, json.dumps({"owner": args.cloudresource, "access": args.cloudresource, "net_id": ""})) #EC528 addition
print "adding " + args.cloudresource + " to quads data"
quads.quads_update_cloud(args.cloudresource, args.description, args.force, args.cloudowner, args.ccusers, args.cloudticket, args.qinq)
exit(0)

Expand Down Expand Up @@ -293,18 +266,12 @@ def main(argv):
exit(0)

if args.movehosts:
if args.datearg is not None and not args.dryrun:
print "--move-hosts and --date are mutually exclusive unless using --dry-run."
exit(1)
# if args.datearg is not None and not args.dryrun:
# print "--move-hosts and --date are mutually exclusive unless using --dry-run."
# exit(1)
quads.quads_move_hosts(args.movecommand, args.dryrun, args.statedir, args.datearg)
exit(0)

#added for EC528 HIL-QUADS Demo
#hardcoded to work on localhost port 5000, but can be reconfigured to work on another server
if args.hilapiaction is not None and args.hilapicall is not None:
quads.quads_rest_call(args.hilapiaction, hil_url, args.hilapicall)
exit(0)

# finally, this part is just reporting ...
quads.quads_print_result(args.host, args.cloudonly, args.datearg, args.summary, args.fullsummary, args.lsschedule)

Expand Down
6 changes: 0 additions & 6 deletions lib/Quads.py
Original file line number Diff line number Diff line change
Expand Up @@ -672,9 +672,3 @@ def quads_print_result(self, host, cloudonly, datearg, summaryreport, fullsummar
",cloud=" + self.quads.hosts.data[host]["schedule"][override]["cloud"]
else:
print current_cloud

# add for EC528 HIL-QUADS integration project
def quads_rest_call(self, method, url, request, json_data=None):
r = requests.request(method, url + request, data=json_data)
if method == 'GET':
print r.text

0 comments on commit 9039822

Please sign in to comment.