af 0.3.22 → 0.5.0.beta.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +14 -6
- data/LICENSE +1277 -24
- data/Rakefile +24 -87
- data/bin/af +7 -2
- data/lib/af/version.rb +3 -0
- data/lib/vmc.rb +7 -2
- data/lib/vmc/cli.rb +475 -0
- data/lib/vmc/cli/app/app.rb +45 -0
- data/lib/vmc/cli/app/apps.rb +105 -0
- data/lib/vmc/cli/app/base.rb +82 -0
- data/lib/vmc/cli/app/crashes.rb +46 -0
- data/lib/vmc/cli/app/delete.rb +95 -0
- data/lib/vmc/cli/app/deprecated.rb +11 -0
- data/lib/vmc/cli/app/env.rb +78 -0
- data/lib/vmc/cli/app/files.rb +137 -0
- data/lib/vmc/cli/app/health.rb +26 -0
- data/lib/vmc/cli/app/instances.rb +53 -0
- data/lib/vmc/cli/app/logs.rb +76 -0
- data/lib/vmc/cli/app/push.rb +107 -0
- data/lib/vmc/cli/app/push/create.rb +150 -0
- data/lib/vmc/cli/app/push/interactions.rb +100 -0
- data/lib/vmc/cli/app/push/sync.rb +64 -0
- data/lib/vmc/cli/app/rename.rb +39 -0
- data/lib/vmc/cli/app/restart.rb +20 -0
- data/lib/vmc/cli/app/scale.rb +71 -0
- data/lib/vmc/cli/app/start.rb +93 -0
- data/lib/vmc/cli/app/stats.rb +67 -0
- data/lib/vmc/cli/app/stop.rb +27 -0
- data/lib/vmc/cli/domain/base.rb +12 -0
- data/lib/vmc/cli/domain/domains.rb +40 -0
- data/lib/vmc/cli/domain/map.rb +55 -0
- data/lib/vmc/cli/domain/unmap.rb +56 -0
- data/lib/vmc/cli/help.rb +16 -0
- data/lib/vmc/cli/interactive.rb +105 -0
- data/lib/vmc/cli/organization/base.rb +14 -0
- data/lib/vmc/cli/organization/create.rb +32 -0
- data/lib/vmc/cli/organization/delete.rb +73 -0
- data/lib/vmc/cli/organization/org.rb +45 -0
- data/lib/vmc/cli/organization/orgs.rb +35 -0
- data/lib/vmc/cli/organization/rename.rb +36 -0
- data/lib/vmc/cli/route/base.rb +12 -0
- data/lib/vmc/cli/route/map.rb +80 -0
- data/lib/vmc/cli/route/routes.rb +26 -0
- data/lib/vmc/cli/route/unmap.rb +94 -0
- data/lib/vmc/cli/service/base.rb +8 -0
- data/lib/vmc/cli/service/bind.rb +44 -0
- data/lib/vmc/cli/service/create.rb +126 -0
- data/lib/vmc/cli/service/delete.rb +86 -0
- data/lib/vmc/cli/service/rename.rb +35 -0
- data/lib/vmc/cli/service/service.rb +42 -0
- data/lib/vmc/cli/service/services.rb +115 -0
- data/lib/vmc/cli/service/unbind.rb +38 -0
- data/lib/vmc/cli/space/base.rb +21 -0
- data/lib/vmc/cli/space/create.rb +56 -0
- data/lib/vmc/cli/space/delete.rb +95 -0
- data/lib/vmc/cli/space/rename.rb +39 -0
- data/lib/vmc/cli/space/space.rb +64 -0
- data/lib/vmc/cli/space/spaces.rb +55 -0
- data/lib/vmc/cli/space/take.rb +16 -0
- data/lib/vmc/cli/start/base.rb +80 -0
- data/lib/vmc/cli/start/colors.rb +13 -0
- data/lib/vmc/cli/start/info.rb +122 -0
- data/lib/vmc/cli/start/login.rb +92 -0
- data/lib/vmc/cli/start/logout.rb +13 -0
- data/lib/vmc/cli/start/target.rb +64 -0
- data/lib/vmc/cli/start/target_interactions.rb +37 -0
- data/lib/vmc/cli/start/targets.rb +16 -0
- data/lib/vmc/cli/user/base.rb +29 -0
- data/lib/vmc/cli/user/create.rb +39 -0
- data/lib/vmc/cli/user/delete.rb +25 -0
- data/lib/vmc/cli/user/passwd.rb +50 -0
- data/lib/vmc/cli/user/register.rb +42 -0
- data/lib/vmc/cli/user/users.rb +32 -0
- data/lib/vmc/constants.rb +13 -0
- data/lib/vmc/detect.rb +134 -0
- data/lib/vmc/errors.rb +17 -0
- data/lib/vmc/plugin.rb +56 -0
- data/lib/vmc/spacing.rb +89 -0
- data/lib/vmc/spec_helper.rb +1 -0
- data/lib/vmc/test_support.rb +4 -0
- data/lib/vmc/test_support/command_helper.rb +32 -0
- data/lib/vmc/test_support/common_input_examples.rb +14 -0
- data/lib/vmc/test_support/fake_home_dir.rb +16 -0
- data/lib/vmc/test_support/interact_helper.rb +29 -0
- data/lib/vmc/version.rb +3 -0
- data/spec/assets/hello-sinatra/Gemfile +3 -0
- data/spec/assets/hello-sinatra/main.rb +6 -0
- data/spec/features/new_user_flow_spec.rb +71 -0
- data/spec/spec_helper.rb +63 -0
- data/spec/vmc/cli/app/base_spec.rb +17 -0
- data/spec/vmc/cli/app/delete_spec.rb +188 -0
- data/spec/vmc/cli/app/instances_spec.rb +65 -0
- data/spec/vmc/cli/app/push/create_spec.rb +571 -0
- data/spec/vmc/cli/app/push_spec.rb +369 -0
- data/spec/vmc/cli/app/rename_spec.rb +104 -0
- data/spec/vmc/cli/app/scale_spec.rb +81 -0
- data/spec/vmc/cli/app/stats_spec.rb +62 -0
- data/spec/vmc/cli/domain/map_spec.rb +140 -0
- data/spec/vmc/cli/domain/unmap_spec.rb +73 -0
- data/spec/vmc/cli/organization/orgs_spec.rb +108 -0
- data/spec/vmc/cli/organization/rename_spec.rb +113 -0
- data/spec/vmc/cli/route/map_spec.rb +138 -0
- data/spec/vmc/cli/route/unmap_spec.rb +215 -0
- data/spec/vmc/cli/service/bind_spec.rb +25 -0
- data/spec/vmc/cli/service/delete_spec.rb +22 -0
- data/spec/vmc/cli/service/rename_spec.rb +105 -0
- data/spec/vmc/cli/service/service_spec.rb +23 -0
- data/spec/vmc/cli/service/unbind_spec.rb +25 -0
- data/spec/vmc/cli/space/rename_spec.rb +102 -0
- data/spec/vmc/cli/space/spaces_spec.rb +104 -0
- data/spec/vmc/cli/start/info_spec.rb +153 -0
- data/spec/vmc/cli/start/login_spec.rb +71 -0
- data/spec/vmc/cli/user/create_spec.rb +54 -0
- data/spec/vmc/cli/user/passwd_spec.rb +102 -0
- data/spec/vmc/cli/user/register_spec.rb +148 -0
- data/spec/vmc/cli_spec.rb +448 -0
- data/spec/vmc/detect_spec.rb +54 -0
- metadata +231 -124
- data/README.md +0 -155
- data/caldecott_helper/Gemfile +0 -10
- data/caldecott_helper/Gemfile.lock +0 -48
- data/caldecott_helper/server.rb +0 -43
- data/config/clients.yml +0 -17
- data/config/micro/offline.conf +0 -2
- data/config/micro/paths.yml +0 -22
- data/config/micro/refresh_ip.rb +0 -20
- data/lib/cli.rb +0 -48
- data/lib/cli/commands/admin.rb +0 -81
- data/lib/cli/commands/apps.rb +0 -1358
- data/lib/cli/commands/base.rb +0 -233
- data/lib/cli/commands/manifest.rb +0 -56
- data/lib/cli/commands/micro.rb +0 -115
- data/lib/cli/commands/misc.rb +0 -147
- data/lib/cli/commands/services.rb +0 -217
- data/lib/cli/commands/user.rb +0 -70
- data/lib/cli/config.rb +0 -176
- data/lib/cli/console_helper.rb +0 -163
- data/lib/cli/core_ext.rb +0 -122
- data/lib/cli/errors.rb +0 -19
- data/lib/cli/file_helper.rb +0 -123
- data/lib/cli/frameworks.rb +0 -265
- data/lib/cli/manifest_helper.rb +0 -316
- data/lib/cli/runner.rb +0 -633
- data/lib/cli/services_helper.rb +0 -104
- data/lib/cli/tunnel_helper.rb +0 -336
- data/lib/cli/usage.rb +0 -129
- data/lib/cli/version.rb +0 -7
- data/lib/cli/zip_util.rb +0 -102
- data/lib/vmc/client.rb +0 -574
- data/lib/vmc/const.rb +0 -27
- data/lib/vmc/micro.rb +0 -56
- data/lib/vmc/micro/switcher/base.rb +0 -97
- data/lib/vmc/micro/switcher/darwin.rb +0 -19
- data/lib/vmc/micro/switcher/dummy.rb +0 -15
- data/lib/vmc/micro/switcher/linux.rb +0 -16
- data/lib/vmc/micro/switcher/windows.rb +0 -31
- data/lib/vmc/micro/vmrun.rb +0 -158
data/README.md
DELETED
@@ -1,155 +0,0 @@
|
|
1
|
-
# AF
|
2
|
-
|
3
|
-
The AppFog CLI. This is the command line interface to AppFog.com
|
4
|
-
|
5
|
-
af is based on vmc but will have features specific to the AppFog service as well as having the default target set to AppFog's service
|
6
|
-
|
7
|
-
## Installation
|
8
|
-
|
9
|
-
There are two ways to install af. Most users should install the RubyGem.
|
10
|
-
|
11
|
-
$ sudo gem install af
|
12
|
-
|
13
|
-
You can also check out the source for development. You will need [Bundler](http://gembundler.com/) to build af.
|
14
|
-
|
15
|
-
$ git clone https://github.com/appfog/af.git
|
16
|
-
$ cd af
|
17
|
-
$ bundle install
|
18
|
-
|
19
|
-
## Usage
|
20
|
-
|
21
|
-
_Copyright 2010-2012, VMware, Inc. Licensed under the
|
22
|
-
MIT license, please see the LICENSE file. All rights reserved._
|
23
|
-
|
24
|
-
Usage: af [options] command [<args>] [command_options]
|
25
|
-
Try 'af help [command]' or 'af help options' for more information.
|
26
|
-
|
27
|
-
Currently available af commands are:
|
28
|
-
|
29
|
-
Getting Started
|
30
|
-
target [url] Reports current target or sets a new target
|
31
|
-
login [email] [--email, --passwd] Login
|
32
|
-
info System and account information
|
33
|
-
|
34
|
-
Applications
|
35
|
-
apps List deployed applications
|
36
|
-
|
37
|
-
Application Creation
|
38
|
-
push [appname] Create, push, map, and start a new application
|
39
|
-
push [appname] --infra Push application to specified infrastructure
|
40
|
-
push [appname] --path Push application from specified path
|
41
|
-
push [appname] --url Set the url for the application
|
42
|
-
push [appname] --instances <N> Set the expected number <N> of instances
|
43
|
-
push [appname] --mem M Set the memory reservation for the application
|
44
|
-
push [appname] --no-start Do not auto-start the application
|
45
|
-
push [appname] --label Add specified label to app revision record
|
46
|
-
|
47
|
-
Application Download
|
48
|
-
pull <appname> [path] Downloads last pushed source to <appname> or [path]
|
49
|
-
|
50
|
-
Application Operations
|
51
|
-
start <appname> Start the application
|
52
|
-
stop <appname> Stop the application
|
53
|
-
restart <appname> Restart the application
|
54
|
-
delete <appname> Delete the application
|
55
|
-
|
56
|
-
Application Updates
|
57
|
-
update <appname> [--path] [--label] Update the application bits, with optional revision label
|
58
|
-
mem <appname> [memsize] Update the memory reservation for an application
|
59
|
-
map <appname> <url> Register the application to the url
|
60
|
-
unmap <appname> <url> Unregister the application from the url
|
61
|
-
instances <appname> <num|delta> Scale the application instances up or down
|
62
|
-
rename <curname> <newname> Change the application's name
|
63
|
-
|
64
|
-
Application Information
|
65
|
-
crashes <appname> List recent application crashes
|
66
|
-
crashlogs <appname> Display log information for crashed applications
|
67
|
-
logs <appname> [--all] Display log information for the application
|
68
|
-
files <appname> [path] [--all] Display directory listing or file download for path
|
69
|
-
stats <appname> Display resource usage for the application
|
70
|
-
instances <appname> List application instances
|
71
|
-
history <appname> Show version history of the application
|
72
|
-
diff <appname> Compare current directory with deployed application
|
73
|
-
hash [path] [--full] Compute hash of directory, defaults to current
|
74
|
-
|
75
|
-
Application Environment
|
76
|
-
env <appname> List application environment variables
|
77
|
-
env-add <appname> <variable[=]value> Add an environment variable to an application
|
78
|
-
env-del <appname> <variable> Delete an environment variable to an application
|
79
|
-
|
80
|
-
Services
|
81
|
-
services Lists of services available and provisioned
|
82
|
-
create-service <service> [--name,--bind] Create a provisioned service
|
83
|
-
create-service <service> --infra Create a provisioned service on a specified infrastructure
|
84
|
-
create-service <service> <name> Create a provisioned service and assign it <name>
|
85
|
-
create-service <service> <name> <app> Create a provisioned service and assign it <name>, and bind to <app>
|
86
|
-
delete-service [servicename] Delete a provisioned service
|
87
|
-
bind-service <servicename> <appname> Bind a service to an application
|
88
|
-
unbind-service <servicename> <appname> Unbind service from the application
|
89
|
-
clone-services <src-app> <dest-app> Clone service bindings from <src-app> application to <dest-app>
|
90
|
-
tunnel <servicename> [--port] Create a local tunnel to a service
|
91
|
-
tunnel <servicename> <clientcmd> Create a local tunnel to a service and start a local client
|
92
|
-
|
93
|
-
Administration
|
94
|
-
user Display user account information
|
95
|
-
passwd Change the password for the current user
|
96
|
-
logout Logs current user out of the target system
|
97
|
-
add-user [--email, --passwd] Register a new user (requires admin privileges)
|
98
|
-
delete-user <user> Delete a user and all apps and services (requires admin privileges)
|
99
|
-
|
100
|
-
System
|
101
|
-
runtimes Display the supported runtimes of the target system
|
102
|
-
frameworks Display the recognized frameworks of the target system
|
103
|
-
infras Display the available infrastructures
|
104
|
-
|
105
|
-
Micro Cloud Foundry
|
106
|
-
micro status Display Micro Cloud Foundry VM status
|
107
|
-
micro offline Configure Micro Cloud Foundry VM for offline mode
|
108
|
-
micro online Configure Micro Cloud Foundry VM for online mode
|
109
|
-
[--vmx file] Path to micro.vmx
|
110
|
-
[--vmrun executable] Path to vmrun executable
|
111
|
-
[--password cleartext] Cleartext password for guest VM vcap user
|
112
|
-
[--save] Save cleartext password in ~/.vmc_micro
|
113
|
-
|
114
|
-
Misc
|
115
|
-
aliases List aliases
|
116
|
-
alias <alias[=]command> Create an alias for a command
|
117
|
-
unalias <alias> Remove an alias
|
118
|
-
targets List known targets and associated authorization tokens
|
119
|
-
|
120
|
-
Help
|
121
|
-
help [command] Get general help or help on a specific command
|
122
|
-
help options Get help on available options
|
123
|
-
|
124
|
-
## Sample Usage (for PHP apps)
|
125
|
-
|
126
|
-
$ af login developer@example.com
|
127
|
-
Attempting login to [https://api.appfog.com]
|
128
|
-
Password: *********
|
129
|
-
Successfully logged into [https://api.appfog.com]
|
130
|
-
|
131
|
-
$ af push
|
132
|
-
Would you like to deploy from the current directory? [Yn]: Y
|
133
|
-
Application Name: myapp
|
134
|
-
Detected a PHP Application, is this correct? [Yn]:
|
135
|
-
1: AWS US East - Virginia
|
136
|
-
2: AWS EU West - Ireland
|
137
|
-
3: AWS Asia SE - Singapore
|
138
|
-
4: Rackspace AZ 1 - Dallas
|
139
|
-
5: HP AZ 2 - Las Vegas
|
140
|
-
Select Infrastructure: 1
|
141
|
-
Application Deployed URL [myapp.aws.af.cm]:
|
142
|
-
Memory reservation (128M, 256M, 512M, 1G, 2G) [128M]:
|
143
|
-
How many instances? [1]:
|
144
|
-
Bind existing services to 'myapp'? [yN]:
|
145
|
-
Create services to bind to 'myapp'? [yN]:
|
146
|
-
Would you like to save this configuration? [yN]:
|
147
|
-
Creating Application: OK
|
148
|
-
Uploading Application:
|
149
|
-
Checking for available resources: OK
|
150
|
-
Processing resources: OK
|
151
|
-
Packing application: OK
|
152
|
-
Uploading (6K): OK
|
153
|
-
Push Status: OK
|
154
|
-
Staging Application 'myapp': OK
|
155
|
-
Starting Application 'myapp': OK
|
data/caldecott_helper/Gemfile
DELETED
@@ -1,48 +0,0 @@
|
|
1
|
-
GEM
|
2
|
-
remote: http://rubygems.org/
|
3
|
-
specs:
|
4
|
-
addressable (2.2.6)
|
5
|
-
async_sinatra (0.5.0)
|
6
|
-
rack (>= 1.2.1)
|
7
|
-
sinatra (>= 1.0)
|
8
|
-
caldecott (0.0.3)
|
9
|
-
addressable (= 2.2.6)
|
10
|
-
async_sinatra (= 0.5.0)
|
11
|
-
em-http-request (= 0.3.0)
|
12
|
-
em-websocket (= 0.3.1)
|
13
|
-
json (= 1.6.1)
|
14
|
-
uuidtools (= 2.1.2)
|
15
|
-
daemons (1.1.4)
|
16
|
-
em-http-request (0.3.0)
|
17
|
-
addressable (>= 2.0.0)
|
18
|
-
escape_utils
|
19
|
-
eventmachine (>= 0.12.9)
|
20
|
-
em-websocket (0.3.1)
|
21
|
-
addressable (>= 2.1.1)
|
22
|
-
eventmachine (>= 0.12.9)
|
23
|
-
escape_utils (0.2.4)
|
24
|
-
eventmachine (0.12.10)
|
25
|
-
json (1.6.1)
|
26
|
-
rack (1.2.4)
|
27
|
-
sinatra (1.2.7)
|
28
|
-
rack (~> 1.1)
|
29
|
-
tilt (>= 1.2.2, < 2.0)
|
30
|
-
thin (1.2.11)
|
31
|
-
daemons (>= 1.0.9)
|
32
|
-
eventmachine (>= 0.12.6)
|
33
|
-
rack (>= 1.0.0)
|
34
|
-
tilt (1.3.3)
|
35
|
-
uuidtools (2.1.2)
|
36
|
-
|
37
|
-
PLATFORMS
|
38
|
-
ruby
|
39
|
-
|
40
|
-
DEPENDENCIES
|
41
|
-
async_sinatra
|
42
|
-
bundler
|
43
|
-
caldecott (= 0.0.3)
|
44
|
-
em-websocket
|
45
|
-
json
|
46
|
-
rack (~> 1.2.0)
|
47
|
-
thin
|
48
|
-
uuidtools
|
data/caldecott_helper/server.rb
DELETED
@@ -1,43 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# Copyright (c) 2009-2011 VMware, Inc.
|
3
|
-
$:.unshift(File.dirname(__FILE__) + '/lib')
|
4
|
-
|
5
|
-
require 'rubygems'
|
6
|
-
require 'bundler/setup'
|
7
|
-
|
8
|
-
require 'caldecott'
|
9
|
-
require 'sinatra'
|
10
|
-
require 'json'
|
11
|
-
require 'eventmachine'
|
12
|
-
|
13
|
-
port = ENV['VMC_APP_PORT']
|
14
|
-
port ||= 8081
|
15
|
-
|
16
|
-
# add vcap specific stuff to Caldecott
|
17
|
-
class VcapHttpTunnel < Caldecott::Server::HttpTunnel
|
18
|
-
get '/info' do
|
19
|
-
{ "version" => '0.0.4' }.to_json
|
20
|
-
end
|
21
|
-
|
22
|
-
def self.get_tunnels
|
23
|
-
super
|
24
|
-
end
|
25
|
-
|
26
|
-
get '/services' do
|
27
|
-
services_env = ENV['VMC_SERVICES']
|
28
|
-
return "no services env" if services_env.nil? or services_env.empty?
|
29
|
-
services_env
|
30
|
-
end
|
31
|
-
|
32
|
-
get '/services/:service' do |service_name|
|
33
|
-
services_env = ENV['VMC_SERVICES']
|
34
|
-
not_found if services_env.nil?
|
35
|
-
|
36
|
-
services = JSON.parse(services_env)
|
37
|
-
service = services.find { |s| s["name"] == service_name }
|
38
|
-
not_found if service.nil?
|
39
|
-
service["options"].to_json
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
VcapHttpTunnel.run!(:port => port, :auth_token => ENV["CALDECOTT_AUTH"])
|
data/config/clients.yml
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
redis:
|
2
|
-
redis-cli: -h ${host} -p ${port} -a ${password}
|
3
|
-
|
4
|
-
mysql:
|
5
|
-
mysql: --protocol=TCP --host=${host} --port=${port} --user=${user} --password=${password} ${name}
|
6
|
-
mysqldump: --protocol=TCP --host=${host} --port=${port} --user=${user} --password=${password} ${name} > ${Output file}
|
7
|
-
|
8
|
-
mongodb:
|
9
|
-
mongo: --host ${host} --port ${port} -u ${user} -p ${password} ${name}
|
10
|
-
mongodump: --host ${host} --port ${port} -u ${user} -p ${password} --db ${name}
|
11
|
-
mongorestore: --host ${host} --port ${port} -u ${user} -p ${password} --db ${name} ${Directory or filename to restore from}
|
12
|
-
|
13
|
-
postgresql:
|
14
|
-
psql:
|
15
|
-
command: -h ${host} -p ${port} -d ${name} -U ${user} -w
|
16
|
-
environment:
|
17
|
-
- PGPASSWORD='${password}'
|
data/config/micro/offline.conf
DELETED
data/config/micro/paths.yml
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
darwin:
|
2
|
-
vmrun:
|
3
|
-
- "/Applications/VMware Fusion.app/Contents/Library/"
|
4
|
-
- "/Applications/Fusion.app/Contents/Library/"
|
5
|
-
vmx:
|
6
|
-
- "~/Documents/Virtual Machines.localized/"
|
7
|
-
- "~/Documents/Virtual Machines/"
|
8
|
-
- "~/Desktop/"
|
9
|
-
|
10
|
-
linux:
|
11
|
-
vmrun:
|
12
|
-
- "/usr/bin/"
|
13
|
-
vmx:
|
14
|
-
- "~/"
|
15
|
-
|
16
|
-
windows:
|
17
|
-
vmrun:
|
18
|
-
- "c:\\Program Files (x86)\\"
|
19
|
-
- "c:\\Program Files\\"
|
20
|
-
vmx:
|
21
|
-
- "~\\Documents\\"
|
22
|
-
- "~\\Desktop\\"
|
data/config/micro/refresh_ip.rb
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
#!/var/vcap/bosh/bin/ruby
|
2
|
-
require 'socket'
|
3
|
-
|
4
|
-
A_ROOT_SERVER = '198.41.0.4'
|
5
|
-
|
6
|
-
begin
|
7
|
-
retries ||= 0
|
8
|
-
route ||= A_ROOT_SERVER
|
9
|
-
orig, Socket.do_not_reverse_lookup = Socket.do_not_reverse_lookup, true
|
10
|
-
ip_address = UDPSocket.open {|s| s.connect(route, 1); s.addr.last }
|
11
|
-
rescue Errno::ENETUNREACH
|
12
|
-
# happens on boot when dhcp hasn't completed when we get here
|
13
|
-
sleep 3
|
14
|
-
retries += 1
|
15
|
-
retry if retries < 10
|
16
|
-
ensure
|
17
|
-
Socket.do_not_reverse_lookup = orig
|
18
|
-
end
|
19
|
-
|
20
|
-
File.open("/tmp/ip.txt", 'w') { |file| file.write(ip_address) }
|
data/lib/cli.rb
DELETED
@@ -1,48 +0,0 @@
|
|
1
|
-
require "rbconfig"
|
2
|
-
|
3
|
-
ROOT = File.expand_path(File.dirname(__FILE__))
|
4
|
-
WINDOWS = !!(RbConfig::CONFIG['host_os'] =~ /mingw|mswin32|cygwin/)
|
5
|
-
|
6
|
-
module VMC
|
7
|
-
autoload :Client, "#{ROOT}/vmc/client"
|
8
|
-
autoload :Micro, "#{ROOT}/vmc/micro"
|
9
|
-
|
10
|
-
module Micro
|
11
|
-
module Switcher
|
12
|
-
autoload :Base, "#{ROOT}/vmc/micro/switcher/base"
|
13
|
-
autoload :Darwin, "#{ROOT}/vmc/micro/switcher/darwin"
|
14
|
-
autoload :Dummy, "#{ROOT}/vmc/micro/switcher/dummy"
|
15
|
-
autoload :Linux, "#{ROOT}/vmc/micro/switcher/linux"
|
16
|
-
autoload :Windows, "#{ROOT}/vmc/micro/switcher/windows"
|
17
|
-
end
|
18
|
-
autoload :VMrun, "#{ROOT}/vmc/micro/vmrun"
|
19
|
-
end
|
20
|
-
|
21
|
-
module Cli
|
22
|
-
autoload :Config, "#{ROOT}/cli/config"
|
23
|
-
autoload :Framework, "#{ROOT}/cli/frameworks"
|
24
|
-
autoload :Runner, "#{ROOT}/cli/runner"
|
25
|
-
autoload :ZipUtil, "#{ROOT}/cli/zip_util"
|
26
|
-
autoload :ServicesHelper, "#{ROOT}/cli/services_helper"
|
27
|
-
autoload :TunnelHelper, "#{ROOT}/cli/tunnel_helper"
|
28
|
-
autoload :ManifestHelper, "#{ROOT}/cli/manifest_helper"
|
29
|
-
autoload :ConsoleHelper, "#{ROOT}/cli/console_helper"
|
30
|
-
autoload :FileHelper, "#{ROOT}/cli/file_helper"
|
31
|
-
|
32
|
-
module Command
|
33
|
-
autoload :Base, "#{ROOT}/cli/commands/base"
|
34
|
-
autoload :Admin, "#{ROOT}/cli/commands/admin"
|
35
|
-
autoload :Apps, "#{ROOT}/cli/commands/apps"
|
36
|
-
autoload :Micro, "#{ROOT}/cli/commands/micro"
|
37
|
-
autoload :Misc, "#{ROOT}/cli/commands/misc"
|
38
|
-
autoload :Services, "#{ROOT}/cli/commands/services"
|
39
|
-
autoload :User, "#{ROOT}/cli/commands/user"
|
40
|
-
autoload :Manifest, "#{ROOT}/cli/commands/manifest"
|
41
|
-
end
|
42
|
-
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
require "#{ROOT}/cli/version"
|
47
|
-
require "#{ROOT}/cli/core_ext"
|
48
|
-
require "#{ROOT}/cli/errors"
|
data/lib/cli/commands/admin.rb
DELETED
@@ -1,81 +0,0 @@
|
|
1
|
-
module VMC::Cli::Command
|
2
|
-
|
3
|
-
class Admin < Base
|
4
|
-
|
5
|
-
def list_users
|
6
|
-
users = client.users
|
7
|
-
users.sort! {|a, b| a[:email] <=> b[:email] }
|
8
|
-
return display JSON.pretty_generate(users || []) if @options[:json]
|
9
|
-
|
10
|
-
display "\n"
|
11
|
-
return display "No Users" if users.nil? || users.empty?
|
12
|
-
|
13
|
-
users_table = table do |t|
|
14
|
-
t.headings = 'Email', 'Admin', 'Apps'
|
15
|
-
users.each do |user|
|
16
|
-
t << [user[:email], user[:admin], user[:apps].map {|x| x[:name]}.join(', ')]
|
17
|
-
end
|
18
|
-
end
|
19
|
-
display users_table
|
20
|
-
end
|
21
|
-
|
22
|
-
alias :users :list_users
|
23
|
-
|
24
|
-
def add_user(email=nil)
|
25
|
-
email ||= @options[:email]
|
26
|
-
email ||= ask("Email") unless no_prompt
|
27
|
-
password = @options[:password]
|
28
|
-
unless no_prompt || password
|
29
|
-
password = ask("Password", :echo => "*")
|
30
|
-
password2 = ask("Verify Password", :echo => "*")
|
31
|
-
err "Passwords did not match, try again" if password != password2
|
32
|
-
end
|
33
|
-
err "Need a valid email" unless email
|
34
|
-
err "Need a password" unless password
|
35
|
-
err "Passwords may not contain braces" if password =~ /[{}]/
|
36
|
-
display 'Creating New User: ', false
|
37
|
-
client.add_user(email, password)
|
38
|
-
display 'OK'.green
|
39
|
-
|
40
|
-
# if we are not logged in for the current target, log in as the new user
|
41
|
-
return unless VMC::Cli::Config.auth_token.nil?
|
42
|
-
@options[:password] = password
|
43
|
-
cmd = User.new(@options)
|
44
|
-
cmd.login(email)
|
45
|
-
end
|
46
|
-
|
47
|
-
def delete_user(user_email)
|
48
|
-
# Check to make sure all apps and services are deleted before deleting the user
|
49
|
-
# implicit proxying
|
50
|
-
|
51
|
-
client.proxy_for(user_email)
|
52
|
-
@options[:proxy] = user_email
|
53
|
-
apps = client.apps
|
54
|
-
|
55
|
-
if (apps && !apps.empty?)
|
56
|
-
unless no_prompt
|
57
|
-
proceed = ask(
|
58
|
-
"\nDeployed applications and associated services will be DELETED, continue?",
|
59
|
-
:default => false
|
60
|
-
)
|
61
|
-
err "Aborted" unless proceed
|
62
|
-
end
|
63
|
-
cmd = Apps.new(@options.merge({ :force => true }))
|
64
|
-
apps.each { |app| cmd.delete(app[:name]) }
|
65
|
-
end
|
66
|
-
|
67
|
-
services = client.services
|
68
|
-
if (services && !services.empty?)
|
69
|
-
cmd = Services.new(@options)
|
70
|
-
services.each { |s| cmd.delete_service(s[:name])}
|
71
|
-
end
|
72
|
-
|
73
|
-
display 'Deleting User: ', false
|
74
|
-
client.proxy = nil
|
75
|
-
client.delete_user(user_email)
|
76
|
-
display 'OK'.green
|
77
|
-
end
|
78
|
-
|
79
|
-
end
|
80
|
-
|
81
|
-
end
|