vzcdn 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f8158f90675470e0fa95e4fe2654edfa790cd427
4
- data.tar.gz: 51696aaebe7b91c08887e95b4f4f25def070db16
3
+ metadata.gz: 1ab3dde228779094870d79d8794f4b40128a7910
4
+ data.tar.gz: 819e89b69b19dee444471a32227cf9652576b6a7
5
5
  SHA512:
6
- metadata.gz: f1cb6f03cf61ff1e97c73c131565ef741dfcdd6501e9b847fee3012221abd1fee4bef87b7389822a63aeb824768acdf525399a285233e3fe8ce5e52bd9bfe207
7
- data.tar.gz: 5b5246223ab965da2bc5bf757f26be0288f2eceb932ab9134f03a5972443ab4ce7334663232248bca69b7f62f899771d5ab61eb93963856671e4be70b774b068
6
+ metadata.gz: b0e14f296d6df37b7c8b0fe6c32516da978fbd00adcf3a9160df96829b558d655b386052a82fb5236deb00d8e3ffa320b1ff5cd3677b2ad03679a5a99721e79e
7
+ data.tar.gz: 09a23650f5a1cef68ae69868ab83ecd9d461df13676be3ad1b790ceb598ed8e652185008a0ad9704cd163a2abc66369b09e6187c3f5aca203bf4f75ba433909f
data/README.md CHANGED
@@ -4,12 +4,12 @@ Commandline UI for Edgecast API
4
4
 
5
5
  ##RELEASE NOTES
6
6
 
7
- 2014/04/17 0.1.6
7
+ 2014/04/17 0.1.7
8
8
  * Default action - print
9
9
  * Presentation changes for zone display ( <object> to "...", array elements to [num] etc)
10
10
  * Column customization in display
11
11
  * directory structure changes
12
- * improved help
12
+ * bash script demonstrating vzcdn usage
13
13
 
14
14
  2014/04/09 0.1.4
15
15
  * Bug fix for "ec zone <id> pull"
@@ -0,0 +1,51 @@
1
+ #!/bin/bash
2
+ set -o pipefail
3
+ if [ $# -ne 1 ]; then echo "Usage: $0 <zone name or id>"; exit 1; fi
4
+ zname=$1
5
+
6
+ #response=$(ec zone $zname pull)
7
+ if [ $? -eq 1 ]; then echo "Could not pull the zone."; exit 1; fi
8
+
9
+ filename=$(echo $response | sed -e "s?^\'??" -e "s?\'.*??")
10
+
11
+ domainname=$(ec zone $zname print | awk '{if (NR == 3) print $2}')
12
+ if [ $? -eq 1 ]; then echo "Could not pull the zone."; exit 1; fi
13
+
14
+ echo -e "\$ORIGIN\t$domainname"
15
+ echo -e "@\tIN\tSOA\tns1.\tns2.("
16
+ echo -e "\t\t\t$(date +%Y%m%d%H)\t; Serial yyyymmddhh"
17
+ echo -e "\t\t\t3600\t; Refresh after 3 hours"
18
+ echo -e "\t\t\t600\t; Retry after 1 hour"
19
+ echo -e "\t\t\t604800\t; Expire after 1 week"
20
+ echo -e "\t\t\t600)\t; Minimum negative caching of 1 hour"
21
+
22
+ function print_records () {
23
+ for rtype in $rtypes
24
+ do
25
+ cmd=$(echo $records_subcommand | sed "s/xyxyxy/$rtype/")
26
+ records=$($cmd)
27
+ if [ ! -z "$records" ]
28
+ then
29
+ echo ""
30
+ echo "; $rtype Records"
31
+ awkprefix='BEGIN {OFS="\t"} { if (NR > 2) print $2,$4,"IN","'
32
+ awksuffix='",$3}'
33
+ awkcmd="${awkprefix}${rtype}$awksuffix"
34
+ # ec zone $zname Record $rtype | awk "$awkcmd"
35
+ echo "$records" | awk "$awkcmd"
36
+ fi
37
+ done
38
+ }
39
+
40
+ rtypes=$(ec zone $zname record | awk '{if (NR == 1) print}')
41
+ records_subcommand="ec zone $zname Record xyxyxy"
42
+ print_records
43
+ lbgroup=1
44
+ while rtypes=$(ec zone $zname LoadBalancingGroups $lbgroup group | awk '{if (NR == 1) print}')
45
+ do
46
+ echo ""
47
+ echo ";-------------Load Balancing Group $lbgroup------------------"
48
+ records_subcommand="ec zone $zname LoadBalancingGroups $lbgroup group xyxyxy Record"
49
+ print_records
50
+ let "lbgroup = lbgroup + 1"
51
+ done
@@ -1,3 +1,3 @@
1
1
  module Vzcdn
2
- VERSION = "0.1.6"
2
+ VERSION = "0.1.7"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vzcdn
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steve Preston
@@ -79,9 +79,9 @@ files:
79
79
  - lib/common.rb
80
80
  - lib/config_handler.rb
81
81
  - lib/config_reader.rb
82
- - lib/makeBind.sh
83
82
  - lib/mediaManagment.rb
84
83
  - lib/method.rb
84
+ - lib/mkbind.sh
85
85
  - lib/print.rb
86
86
  - lib/realTimeStats.rb
87
87
  - lib/reporting.rb
@@ -1,90 +0,0 @@
1
- #!/bin/bash
2
- usage(){
3
- echo "requires 2 arguments"
4
- echo "Usage: $0 Input_filename[as argument] Output_Filename[as argument]"
5
- exit 1
6
- }
7
-
8
-
9
- osarch(){
10
- case $(uname -m) in
11
- x86_64) echo 64bit;;
12
- *) echo 32bit;;
13
- esac
14
- }
15
-
16
- ostype(){
17
- case $(uname -s) in
18
- Linux)
19
- if [[ "$(osarch)" == 64bit ]]; then
20
- `curl -O --silent http://stedolan.github.io/jq/download/linux64/jq`
21
- else
22
- `curl -O --silent http://stedolan.github.io/jq/download/linux32/jq`
23
- fi
24
- `chmod +x jq`
25
- ;;
26
- Darwin)
27
- if [[ "$(osarch)" == 64bit ]]; then
28
- `curl -O --silent http://stedolan.github.io/jq/download/osx64/jq`
29
- else
30
- `curl -O --silent http://stedolan.github.io/jq/download/osx32/jq`
31
- fi
32
- `chmod +x jq`
33
- ;;
34
- *) echo not supported;;
35
- esac
36
- }
37
-
38
-
39
- overwrite_yes_or_no(){
40
- read -p "$1 ([y]es or [N]o): "
41
- case $(echo $REPLY | tr '[A-Z]' '[a-z]') in
42
- y|yes) echo "yes";;
43
- *) echo "no";;
44
- esac
45
- }
46
-
47
- if [ -f $2 ]; then
48
- if [[ "yes" == $(overwrite_yes_or_no "$2 exists. Do you want to overwrite?") ]]; then
49
- `cat /dev/null > $2`
50
- else
51
- echo "exiting out"
52
- exit 1
53
- fi
54
- fi
55
-
56
- if [ ! -f jq ]; then
57
- ostype
58
- fi
59
-
60
- if [ "$#" -ne "2" ]
61
- then
62
- usage
63
- fi
64
- RECORDS=`cat $1 |./jq '.Records'`
65
- printf "%s\t%s\t%s\n" "\$TTL" "86400" "; 24 hours could have been written as 24h or 1d" >> $2
66
- printf "%s\t%s\n" "\$ORIGIN" `cat $1 |./jq '.DomainName'|tr -d '"'` >> $2
67
- printf "%s\t%s\t%s\t%s\t%s\t%s\n" "@" "IN" "SOA" "ns1.`cat $1 |./jq '.DomainName'|tr -d '"'`" "ns2.`cat $1 |./jq '.DomainName'|tr -d '"'`(" >> $2
68
- printf "%s\t%s\t%s\t%s\t%s\t%s\n" "" "" "" "2014041501" "; Serial yyyymmddnn" >> $2
69
- printf "%s\t%s\t%s\t%s\t%s\t%s\n" "" "" "" "3600" "; Refresh after 3 hours" >> $2
70
- printf "%s\t%s\t%s\t%s\t%s\t%s\n" "" "" "" "600" "; Retry after 1 hour" >> $2
71
- printf "%s\t%s\t%s\t%s\t%s\t%s\n" "" "" "" "604800" "; Expire after 1 week" >> $2
72
- printf "%s\t%s\t%s\t%s\t%s\t%s\n" "" "" "" "600)" "; Minimum negative caching of 1 hour" >> $2
73
-
74
- if [ `echo $RECORDS|./jq 'length'` -ne "0" ]
75
- then
76
- for record in A AAAA CNAME MX NS SPF SRV TXT
77
- do
78
- # echo `cat $1 |./jq '.Records.'$record''`
79
- if [ `echo $RECORDS |./jq '.'$record'|length'` -ne "0" ]
80
- then
81
- printf "\n" >> $2
82
- printf "; $record Records\n" >> $2
83
- for(( i=0; i <= `echo $RECORDS |./jq '.'$record'|length'` -1; i++ ))
84
- do
85
- printf "%s\t%s\t%s\t%s\t%s\n" `echo $RECORDS |./jq '.'$record'['$i'].Name'|tr -d '"'` `echo $RECORDS |./jq '.'$record'['$i'].TTL'|tr -d '"'` "IN" $record `echo $RECORDS |./jq '.'$record'['$i'].Rdata'|tr -d '"'` >> $2
86
- done
87
- fi
88
- done
89
- fi
90
-