polytrix 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +13 -0
- data/.groc.json +7 -0
- data/.rspec +11 -0
- data/.rspec_parallel +10 -0
- data/Gemfile +23 -0
- data/README.md +48 -0
- data/Rakefile +143 -0
- data/Vagrantfile +41 -0
- data/features/0_identity_spec.rb +40 -0
- data/features/1_cloud_files_spec.rb +48 -0
- data/features/2_servers_spec.rb +19 -0
- data/features/features_helper.rb +46 -0
- data/features/helpers/cloudfiles_helper.rb +31 -0
- data/features/helpers/pacto_helper.rb +33 -0
- data/features/helpers/teardown_helper.rb +49 -0
- data/features/pacto/extensions/loaders/api_blueprint_loader.rb +63 -0
- data/features/pacto/extensions/loaders/simple_loader.rb +55 -0
- data/features/pacto/extensions/loaders/yaml_or_json_loader.rb +17 -0
- data/features/pacto/extensions/matchers.rb +38 -0
- data/features/phase2/feature_coverage_report.rb +109 -0
- data/features/phase2/run_all_features.rb +14 -0
- data/features/static_site/fixtures/index.html +6 -0
- data/lib/polytrix/challenge.rb +27 -0
- data/lib/polytrix/challenge_builder.rb +16 -0
- data/lib/polytrix/challenge_runner.rb +87 -0
- data/lib/polytrix/configuration.rb +31 -0
- data/lib/polytrix/core/file_finder.rb +43 -0
- data/lib/polytrix/core/implementor.rb +17 -0
- data/lib/polytrix/core/result_tracker.rb +25 -0
- data/lib/polytrix/documentation_generator.rb +18 -0
- data/lib/polytrix/manifest.rb +46 -0
- data/lib/polytrix/result.rb +9 -0
- data/lib/polytrix/rspec/documentation_formatter.rb +41 -0
- data/lib/polytrix/rspec.rb +75 -0
- data/lib/polytrix/runners/linux_challenge_runner.rb +22 -0
- data/lib/polytrix/runners/middleware/change_directory.rb +20 -0
- data/lib/polytrix/runners/middleware/feature_executor.rb +23 -0
- data/lib/polytrix/runners/middleware/pacto.rb +59 -0
- data/lib/polytrix/runners/middleware/setup_env_vars.rb +38 -0
- data/lib/polytrix/runners/windows_challenge_runner.rb +25 -0
- data/lib/polytrix/version.rb +3 -0
- data/lib/polytrix.rb +56 -0
- data/packer/.gitignore +3 -0
- data/packer/Berksfile +15 -0
- data/packer/Gemfile +5 -0
- data/packer/Vagrantfile +128 -0
- data/packer/cookbooks/drg/metadata.rb +27 -0
- data/packer/cookbooks/drg/recipes/admins.rb +22 -0
- data/packer/cookbooks/drg/recipes/default.rb +9 -0
- data/packer/cookbooks/drg/recipes/dotnet.rb +4 -0
- data/packer/cookbooks/drg/recipes/golang.rb +4 -0
- data/packer/cookbooks/drg/recipes/java.rb +5 -0
- data/packer/cookbooks/drg/recipes/php.rb +10 -0
- data/packer/cookbooks/drg/recipes/ruby.rb +29 -0
- data/packer/cookbooks/drg/recipes/system.rb +13 -0
- data/packer/create_box.sh +10 -0
- data/packer/http/preseed.cfg +87 -0
- data/packer/packer.json +91 -0
- data/packer/scripts/root_setup.sh +37 -0
- data/packer/scripts/setup.sh +32 -0
- data/pacto/config/pacto_server.rb +40 -0
- data/pacto/contracts/dfw.servers.api.rackspacecloud.com/v2/account_id/extensions.json +64 -0
- data/pacto/contracts/dfw.servers.api.rackspacecloud.com/v2/account_id/flavors/id.json +100 -0
- data/pacto/contracts/dfw.servers.api.rackspacecloud.com/v2/account_id/images/id.json +176 -0
- data/pacto/contracts/dfw.servers.api.rackspacecloud.com/v2/account_id/servers/id.json +189 -0
- data/pacto/contracts/dfw.servers.api.rackspacecloud.com/v2/account_id/servers.json +63 -0
- data/pacto/contracts/dns.api.rackspacecloud.com/v1.0/_tenant_id/domains.json +62 -0
- data/pacto/contracts/identity.api.rackspacecloud.com/v2.0/tokens.json +192 -0
- data/pacto/contracts/monitoring.api.rackspacecloud.com/v1.0/_tenant_id/account.json +39 -0
- data/pacto/contracts/ord.autoscale.api.rackspacecloud.com/v1.0/_tenant_id/groups.json +38 -0
- data/pacto/contracts/ord.blockstorage.api.rackspacecloud.com/v1/_tenant_id/volumes.json +30 -0
- data/pacto/contracts/ord.databases.api.rackspacecloud.com/v1.0/_tenant_id/instances.json +30 -0
- data/pacto/contracts/ord.loadbalancers.api.rackspacecloud.com/v1.0/_tenant_id/loadbalancers.json +114 -0
- data/pacto/contracts/ord.queues.api.rackspacecloud.com/v1/_tenant_id/queues.json +13 -0
- data/pacto/contracts/ord.servers.api.rackspacecloud.com/v2/_tenant_id/os-networksv2.json +46 -0
- data/pacto/contracts/ord.servers.api.rackspacecloud.com/v2/_tenant_id/servers/detail.json +230 -0
- data/pacto/contracts/storage101.dfw1.clouddrive.com/v1/mosso_account/container/object.json +15 -0
- data/pacto/contracts/storage101.dfw1.clouddrive.com/v1/mosso_account.json +43 -0
- data/pacto/contracts/storage101.ord1.clouddrive.com/v1/_mosso_id.json +44 -0
- data/pacto/pacto_server.rb +100 -0
- data/pacto/rackspace_uri_map.yaml +229 -0
- data/polytrix.gemspec +27 -0
- data/scripts/bootstrap +10 -0
- data/scripts/cibuild +4 -0
- data/sdks/fog/.gitignore +1 -0
- data/sdks/fog/Gemfile +5 -0
- data/sdks/fog/challenges/all_connections.rb +45 -0
- data/sdks/fog/challenges/authenticate_token.rb +15 -0
- data/sdks/fog/challenges/cdn_enable_container.rb +20 -0
- data/sdks/fog/challenges/create_a_container.rb +17 -0
- data/sdks/fog/challenges/create_server.rb +36 -0
- data/sdks/fog/challenges/get_object_metadata.rb +13 -0
- data/sdks/fog/challenges/list_containers.rb +10 -0
- data/sdks/fog/challenges/provision_scalable_webapp.rb +30 -0
- data/sdks/fog/challenges/upload_folder.rb +25 -0
- data/sdks/fog/scripts/bootstrap +4 -0
- data/sdks/fog/scripts/bootstrap.ps1 +1 -0
- data/sdks/fog/scripts/wrapper +2 -0
- data/sdks/fog/scripts/wrapper.ps1 +1 -0
- data/sdks/gophercloud/.gitignore +2 -0
- data/sdks/gophercloud/challenges/authenticate_token.go +23 -0
- data/sdks/gophercloud/scripts/bootstrap +6 -0
- data/sdks/gophercloud/scripts/wrapper +10 -0
- data/sdks/jclouds/.gitignore +1 -0
- data/sdks/jclouds/challenges/AuthenticateToken.java +115 -0
- data/sdks/jclouds/pom.xml +34 -0
- data/sdks/jclouds/scripts/bootstrap +3 -0
- data/sdks/jclouds/scripts/wrapper +7 -0
- data/sdks/openstack.net/.gitignore +4 -0
- data/sdks/openstack.net/.nuget/Microsoft.Build.dll +0 -0
- data/sdks/openstack.net/.nuget/NuGet.Config +6 -0
- data/sdks/openstack.net/.nuget/NuGet.exe +0 -0
- data/sdks/openstack.net/.nuget/NuGet.targets +136 -0
- data/sdks/openstack.net/Challenge.cs +10 -0
- data/sdks/openstack.net/RunChallenge.cs +19 -0
- data/sdks/openstack.net/challenges/AuthenticateToken.cs +24 -0
- data/sdks/openstack.net/challenges/Weird.cs +133 -0
- data/sdks/openstack.net/openstack.net.csproj +58 -0
- data/sdks/openstack.net/openstack.net.sln +27 -0
- data/sdks/openstack.net/openstack.net.userprefs +8 -0
- data/sdks/openstack.net/packages.config +6 -0
- data/sdks/openstack.net/scripts/bootstrap +2 -0
- data/sdks/openstack.net/scripts/bootstrap.ps1 +2 -0
- data/sdks/openstack.net/scripts/wrapper +7 -0
- data/sdks/openstack.net/scripts/wrapper.ps1 +1 -0
- data/sdks/php-opencloud/.gitignore +4 -0
- data/sdks/php-opencloud/challenges/all_connections.php +64 -0
- data/sdks/php-opencloud/challenges/authenticate_token.php +14 -0
- data/sdks/php-opencloud/challenges/create_server.php +39 -0
- data/sdks/php-opencloud/challenges/get_object_metadata.php +19 -0
- data/sdks/php-opencloud/composer.json +5 -0
- data/sdks/php-opencloud/scripts/bootstrap +4 -0
- data/sdks/php-opencloud/scripts/bootstrap.ps1 +2 -0
- data/sdks/php-opencloud/scripts/wrapper +2 -0
- data/sdks/php-opencloud/scripts/wrapper.ps1 +1 -0
- data/sdks/pkgcloud/.gitignore +1 -0
- data/sdks/pkgcloud/challenges/authenticate_token.js +17 -0
- data/sdks/pkgcloud/challenges/get_object_metadata.js +18 -0
- data/sdks/pkgcloud/scripts/bootstrap +2 -0
- data/sdks/pkgcloud/scripts/bootstrap.ps1 +1 -0
- data/sdks/pkgcloud/scripts/wrapper +2 -0
- data/sdks/pkgcloud/scripts/wrapper.ps1 +1 -0
- data/sdks/pyrax/.gitignore +2 -0
- data/sdks/pyrax/challenges/all_connections.py +61 -0
- data/sdks/pyrax/challenges/authenticate_token.py +17 -0
- data/sdks/pyrax/challenges/cdn_enable_container.py +22 -0
- data/sdks/pyrax/challenges/create_a_container.py +21 -0
- data/sdks/pyrax/challenges/create_server.py +35 -0
- data/sdks/pyrax/challenges/get_object_metadata.py +17 -0
- data/sdks/pyrax/challenges/upload_folder.py +32 -0
- data/sdks/pyrax/requirements.txt +21 -0
- data/sdks/pyrax/scripts/bootstrap +9 -0
- data/sdks/pyrax/scripts/bootstrap.ps1 +7 -0
- data/sdks/pyrax/scripts/wrapper +3 -0
- data/sdks/pyrax/scripts/wrapper.ps1 +2 -0
- data/spec/fixtures/factorial.py +18 -0
- data/spec/fixtures/polytrix.yml +16 -0
- data/spec/fixtures/src-doc/quine.md.erb +20 -0
- data/spec/polytrix/challenge_builder_spec.rb +16 -0
- data/spec/polytrix/challenge_runner_spec.rb +14 -0
- data/spec/polytrix/challenge_spec.rb +20 -0
- data/spec/polytrix/configuration_spec.rb +10 -0
- data/spec/polytrix/documentation_generator_spec.rb +36 -0
- data/spec/polytrix/file_finder_spec.rb +24 -0
- data/spec/polytrix/manifest_spec.rb +26 -0
- data/spec/polytrix/middleware/feature_executor_spec.rb +48 -0
- data/spec/polytrix_spec.rb +13 -0
- data/spec/rspec_spec.rb +17 -0
- data/spec/spec_helper.rb +7 -0
- metadata +325 -0
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
require 'vendor/autoload.php';
|
|
3
|
+
use OpenCloud\Rackspace;
|
|
4
|
+
|
|
5
|
+
$region = getenv('RAX_REGION');
|
|
6
|
+
$endpoint = getenv('RAX_AUTH_URL') . '/v2.0/';
|
|
7
|
+
$credentials = array(
|
|
8
|
+
'username' => getenv('RAX_USERNAME'),
|
|
9
|
+
'apiKey' => getenv('RAX_API_KEY')
|
|
10
|
+
);
|
|
11
|
+
|
|
12
|
+
$rackspace = new Rackspace($endpoint, $credentials);
|
|
13
|
+
$rackspace->Authenticate();
|
|
14
|
+
|
|
15
|
+
$compute = $rackspace->computeService('cloudServersOpenStack', $region);
|
|
16
|
+
$servers = $compute->serverList();
|
|
17
|
+
$networks = $compute->networkList();
|
|
18
|
+
// echo("Servers: ".var_export($servers));
|
|
19
|
+
// echo("Networks: ".var_export($networks));
|
|
20
|
+
|
|
21
|
+
$loadBalancerService = $rackspace->loadBalancerService('cloudLoadBalancers', $region);
|
|
22
|
+
$load_balancers = $loadBalancerService->loadBalancerList();
|
|
23
|
+
// echo("Cloud Load Balancers: ".var_export($load_balancers));
|
|
24
|
+
|
|
25
|
+
$cloudFilesService = $rackspace->objectStoreService('cloudFiles', $region);
|
|
26
|
+
$containers = $cloudFilesService->listContainers();
|
|
27
|
+
// echo("Cloud Files Containers: ".var_export($containers));
|
|
28
|
+
|
|
29
|
+
$databaseService = $rackspace->databaseService('cloudDatabases', $region);
|
|
30
|
+
$databases = $databaseService->instanceList();
|
|
31
|
+
// echo("Cloud Databases: ".var_export($databases));
|
|
32
|
+
|
|
33
|
+
$dnsService = $rackspace->dnsService('cloudDNS', $region);
|
|
34
|
+
$domains = $dnsService->domainList();
|
|
35
|
+
// Can I get zones?
|
|
36
|
+
// echo("Cloud DNS: $zones")
|
|
37
|
+
// echo('Cloud DNS: $domains');
|
|
38
|
+
|
|
39
|
+
$identityService = $rackspace->identityService();
|
|
40
|
+
$users = $identityService->getUsers();
|
|
41
|
+
// echo("Cloud Identity Users: ".var_export($users));
|
|
42
|
+
|
|
43
|
+
$monitoringService = $rackspace->cloudMonitoringService('cloudMonitoring', 'ORD', 'publicURL');
|
|
44
|
+
$checkTypes = $monitoringService->getCheckTypes();
|
|
45
|
+
// Can I get the account info?
|
|
46
|
+
// echo("Cloud Monitoring Account: $account")
|
|
47
|
+
// echo("Cloud Monitoring Check Types: ".var_export($checkTypes));
|
|
48
|
+
|
|
49
|
+
$blockStorageService = $rackspace->volumeService('cloudBlockStorage', 'DFW');
|
|
50
|
+
$volumes = $blockStorageService->volumeList(false);
|
|
51
|
+
// echo("Cloud Block Storage Volumes: ".var_export($volumes));
|
|
52
|
+
|
|
53
|
+
# Cloud Backup?
|
|
54
|
+
|
|
55
|
+
$autoscaleService = $rackspace->autoscaleService();
|
|
56
|
+
$groups = $autoscaleService->groupList();
|
|
57
|
+
// echo("Autoscale Scaling Groups: ".var_export($groups));
|
|
58
|
+
|
|
59
|
+
# Cloud Queues
|
|
60
|
+
$queuesService = $rackspace->queuesService('cloudQueues', $region);
|
|
61
|
+
$queues = $queuesService->listQueues();
|
|
62
|
+
// echo("Cloud Queues: ".var_export($queues));
|
|
63
|
+
|
|
64
|
+
?>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
require 'vendor/autoload.php';
|
|
3
|
+
use OpenCloud\Rackspace;
|
|
4
|
+
|
|
5
|
+
$endpoint = getenv('RAX_AUTH_URL') . '/v2.0/';
|
|
6
|
+
$credentials = array(
|
|
7
|
+
'username' => getenv('RAX_USERNAME'),
|
|
8
|
+
'apiKey' => getenv('RAX_API_KEY')
|
|
9
|
+
);
|
|
10
|
+
|
|
11
|
+
$rackspace = new Rackspace($endpoint, $credentials);
|
|
12
|
+
$rackspace->Authenticate();
|
|
13
|
+
echo('Authenticated')
|
|
14
|
+
?>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
require('vendor/autoload.php');
|
|
3
|
+
use OpenCloud\Rackspace;
|
|
4
|
+
|
|
5
|
+
$endpoint = getenv('RAX_AUTH_URL') . '/v2.0/';
|
|
6
|
+
$credentials = array(
|
|
7
|
+
'username' => getenv('RAX_USERNAME'),
|
|
8
|
+
'apiKey' => getenv('RAX_API_KEY')
|
|
9
|
+
);
|
|
10
|
+
|
|
11
|
+
$rackspace = new Rackspace($endpoint, $credentials);
|
|
12
|
+
$compute = $rackspace->computeService('cloudServersOpenStack', getenv('RAX_REGION'));
|
|
13
|
+
|
|
14
|
+
$image_id = getenv('SERVER1_IMAGE');
|
|
15
|
+
$flavor_id = getenv('SERVER1_FLAVOR');
|
|
16
|
+
|
|
17
|
+
// Create a server in DFW
|
|
18
|
+
$server = $compute->Server();
|
|
19
|
+
// create it
|
|
20
|
+
print("Creating server...");
|
|
21
|
+
$server->create(array(
|
|
22
|
+
'name' => 'php-opencloud server',
|
|
23
|
+
// Using the image ID from ORD
|
|
24
|
+
'image' => $compute->image($image_id),
|
|
25
|
+
// And a flavor that's too small
|
|
26
|
+
'flavor' => $compute->flavor($flavor_id)
|
|
27
|
+
));
|
|
28
|
+
print("requested, now waiting...\n");
|
|
29
|
+
print("ID=" . $server->id . "...\n");
|
|
30
|
+
$server->WaitFor("ACTIVE", 600, 'dot');
|
|
31
|
+
print("done\n");
|
|
32
|
+
exit(0);
|
|
33
|
+
|
|
34
|
+
function dot($server)
|
|
35
|
+
{
|
|
36
|
+
printf("%s %3d%%\n", $server->status, $server->progress);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
?>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<?php
|
|
2
|
+
require 'vendor/autoload.php';
|
|
3
|
+
use OpenCloud\Rackspace;
|
|
4
|
+
|
|
5
|
+
$region = getenv('RAX_REGION');
|
|
6
|
+
$endpoint = getenv('RAX_AUTH_URL') . '/v2.0/';
|
|
7
|
+
$credentials = array(
|
|
8
|
+
'username' => getenv('RAX_USERNAME'),
|
|
9
|
+
'apiKey' => getenv('RAX_API_KEY')
|
|
10
|
+
);
|
|
11
|
+
$directory = getenv('TEST_DIRECTORY');
|
|
12
|
+
$file = getenv('TEST_FILE');
|
|
13
|
+
|
|
14
|
+
$rackspace = new Rackspace($endpoint, $credentials);
|
|
15
|
+
$cloudFilesService = $rackspace->objectStoreService('cloudFiles', $region);
|
|
16
|
+
$container = $cloudFilesService->getContainer($directory);
|
|
17
|
+
$object = $container->getPartialObject($file);
|
|
18
|
+
|
|
19
|
+
?>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
php "$args"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
node_modules/
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
var pkgcloud = require('pkgcloud');
|
|
2
|
+
|
|
3
|
+
// create our client with your rackspace credentials
|
|
4
|
+
var client = pkgcloud.providers.rackspace.compute.createClient({
|
|
5
|
+
username: process.env.RAX_USERNAME,
|
|
6
|
+
apiKey: process.env.RAX_API_KEY,
|
|
7
|
+
authUrl: process.env.RAX_AUTH_URL,
|
|
8
|
+
region: process.env.RAX_REGION
|
|
9
|
+
});
|
|
10
|
+
client.auth(function(err) {
|
|
11
|
+
if (err) {
|
|
12
|
+
console.log(err.message);
|
|
13
|
+
process.exit(1);
|
|
14
|
+
} else {
|
|
15
|
+
console.log('Authenticated');
|
|
16
|
+
}
|
|
17
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
var pkgcloud = require('pkgcloud');
|
|
2
|
+
|
|
3
|
+
// create our client with your rackspace credentials
|
|
4
|
+
var storageClient = pkgcloud.providers.rackspace.storage.createClient({
|
|
5
|
+
username: process.env.RAX_USERNAME,
|
|
6
|
+
apiKey: process.env.RAX_API_KEY,
|
|
7
|
+
authUrl: process.env.RAX_AUTH_URL,
|
|
8
|
+
region: process.env.RAX_REGION
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
storageClient.getFile(process.env.TEST_DIRECTORY, process.env.TEST_FILE, function (err, server) {
|
|
12
|
+
if (err) {
|
|
13
|
+
console.dir(err);
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
console.dir(server);
|
|
18
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
npm install pkgcloud
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
node "$args"
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
|
|
3
|
+
import os
|
|
4
|
+
import pyrax
|
|
5
|
+
|
|
6
|
+
pyrax.set_setting("identity_type", "rackspace")
|
|
7
|
+
# Create the identity object
|
|
8
|
+
pyrax._create_identity()
|
|
9
|
+
# Change its endpoint
|
|
10
|
+
pyrax.identity.auth_endpoint = os.getenv('RAX_AUTH_URL') + '/v2.0/'
|
|
11
|
+
|
|
12
|
+
# Authenticate
|
|
13
|
+
pyrax.set_credentials(os.getenv('RAX_USERNAME'), os.getenv('RAX_API_KEY'))
|
|
14
|
+
|
|
15
|
+
print "Authenticated"
|
|
16
|
+
|
|
17
|
+
# Cloud Servers API - List Servers
|
|
18
|
+
cs = pyrax.cloudservers
|
|
19
|
+
print "Servers:", cs.servers.list()
|
|
20
|
+
|
|
21
|
+
# Networks API - List Networks
|
|
22
|
+
cnw = pyrax.cloud_networks
|
|
23
|
+
print "Networks:", cnw.list()
|
|
24
|
+
|
|
25
|
+
# Cloud Files API - List Files
|
|
26
|
+
cf = pyrax.cloudfiles
|
|
27
|
+
cf.http_log_debug = True
|
|
28
|
+
print "Cloud Files Containers:", cf.list_containers()
|
|
29
|
+
|
|
30
|
+
# Cloud Load Balancers
|
|
31
|
+
clb = pyrax.cloud_loadbalancers
|
|
32
|
+
print "Cloud Load Balancers:", clb.list()
|
|
33
|
+
|
|
34
|
+
# Cloud Database
|
|
35
|
+
cdb = pyrax.cloud_databases
|
|
36
|
+
print "Cloud Databases:", cdb.list()
|
|
37
|
+
|
|
38
|
+
# Cloud DNS
|
|
39
|
+
cdns = pyrax.cloud_dns
|
|
40
|
+
print "Cloud DNS:", cdns.list()
|
|
41
|
+
|
|
42
|
+
# Cloud Identity
|
|
43
|
+
# print "Cloud Identity Users:", pyrax.identity.list_users()
|
|
44
|
+
|
|
45
|
+
# Cloud Monitoring
|
|
46
|
+
cm = pyrax.cloud_monitoring
|
|
47
|
+
print "Cloud Monitoring Account:", cm.get_account()
|
|
48
|
+
|
|
49
|
+
# Cloud Block Storage
|
|
50
|
+
cbs = pyrax.cloud_blockstorage
|
|
51
|
+
print "Cloud Block Storage Volumes:", cbs.list()
|
|
52
|
+
|
|
53
|
+
# Cloud Backup?
|
|
54
|
+
|
|
55
|
+
# Autoscale
|
|
56
|
+
ax = pyrax.autoscale
|
|
57
|
+
print "Autoscale Scaling Groups:", ax.list()
|
|
58
|
+
|
|
59
|
+
# Cloud Queues
|
|
60
|
+
pq = pyrax.queues
|
|
61
|
+
print "Cloud Queues:", pq.list()
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
|
|
3
|
+
import os
|
|
4
|
+
import pyrax
|
|
5
|
+
|
|
6
|
+
pyrax.set_setting("identity_type", "rackspace")
|
|
7
|
+
# Create the identity object
|
|
8
|
+
pyrax._create_identity()
|
|
9
|
+
# Change its endpoint
|
|
10
|
+
endpoint = os.getenv('RAX_AUTH_URL')
|
|
11
|
+
if endpoint is not None:
|
|
12
|
+
pyrax.identity.auth_endpoint = os.getenv('RAX_AUTH_URL') + '/v2.0/'
|
|
13
|
+
|
|
14
|
+
# Authenticate
|
|
15
|
+
pyrax.set_credentials(os.getenv('RAX_USERNAME'), os.getenv('RAX_API_KEY'))
|
|
16
|
+
|
|
17
|
+
print "Authenticated"
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
|
|
3
|
+
import os
|
|
4
|
+
import pyrax
|
|
5
|
+
|
|
6
|
+
container_name = 'my-site'
|
|
7
|
+
folder_to_upload = os.getenv('TEST_DIRECTORY')
|
|
8
|
+
username = os.getenv('RAX_USERNAME')
|
|
9
|
+
api_key = os.getenv('RAX_API_KEY')
|
|
10
|
+
auth_endpoint = os.getenv('RAX_AUTH_URL')
|
|
11
|
+
|
|
12
|
+
pyrax.set_setting("identity_type", "rackspace")
|
|
13
|
+
# Create the identity object
|
|
14
|
+
pyrax._create_identity()
|
|
15
|
+
# Change its endpoint
|
|
16
|
+
pyrax.identity.auth_endpoint = auth_endpoint + '/v2.0/'
|
|
17
|
+
|
|
18
|
+
# Identity Connection - Authenticate
|
|
19
|
+
pyrax.set_credentials(username, api_key)
|
|
20
|
+
|
|
21
|
+
cf = pyrax.cloudfiles
|
|
22
|
+
cf.make_container_public(container_name, ttl=900)
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
|
|
3
|
+
import os
|
|
4
|
+
import pyrax
|
|
5
|
+
|
|
6
|
+
container_name = os.getenv('CONTAINER_NAME')
|
|
7
|
+
username = os.getenv('RAX_USERNAME')
|
|
8
|
+
api_key = os.getenv('RAX_API_KEY')
|
|
9
|
+
auth_endpoint = os.getenv('RAX_AUTH_URL')
|
|
10
|
+
|
|
11
|
+
pyrax.set_setting("identity_type", "rackspace")
|
|
12
|
+
# Create the identity object
|
|
13
|
+
pyrax._create_identity()
|
|
14
|
+
# Change its endpoint
|
|
15
|
+
pyrax.identity.auth_endpoint = auth_endpoint + '/v2.0/'
|
|
16
|
+
|
|
17
|
+
# Identity Connection - Authenticate
|
|
18
|
+
pyrax.set_credentials(username, api_key)
|
|
19
|
+
|
|
20
|
+
cf = pyrax.cloudfiles
|
|
21
|
+
cont = cf.create_container("my-site")
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
|
|
3
|
+
import os
|
|
4
|
+
import pyrax
|
|
5
|
+
# [Configure Pyrax](https://github.com/rackspace/pyrax/blob/master/docs/getting_started.md#pyrax-configuration)
|
|
6
|
+
# to use the Rackspace identity service.
|
|
7
|
+
|
|
8
|
+
pyrax.set_setting("identity_type", "rackspace")
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
# Change the authentication endpoint if requested, otherwise use the default
|
|
12
|
+
custom_endpoint = os.getenv('RAX_AUTH_URL')
|
|
13
|
+
if custom_endpoint is not None:
|
|
14
|
+
pyrax._create_identity()
|
|
15
|
+
# Pyrax requires the endpoint to contain the version
|
|
16
|
+
pyrax.identity.auth_endpoint = custom_endpoint + '/v2.0/'
|
|
17
|
+
|
|
18
|
+
# Set the region, needs to be done before authenticating.
|
|
19
|
+
pyrax.set_setting('region', os.getenv('RAX_REGION'))
|
|
20
|
+
|
|
21
|
+
# [Authenticate](https://github.com/rackspace/pyrax/blob/master/docs/getting_started.md#authenticating)
|
|
22
|
+
# using an API key.
|
|
23
|
+
pyrax.set_credentials(os.getenv('RAX_USERNAME'), os.getenv('RAX_API_KEY'))
|
|
24
|
+
|
|
25
|
+
# Get the flavor and image for the test scenario.
|
|
26
|
+
flavor = os.getenv('SERVER1_FLAVOR')
|
|
27
|
+
image = os.getenv('SERVER1_IMAGE')
|
|
28
|
+
|
|
29
|
+
# Create a [Cloud Servers](https://github.com/rackspace/pyrax/blob/master/docs/cloud_servers.md) connection.
|
|
30
|
+
cs = pyrax.cloudservers
|
|
31
|
+
|
|
32
|
+
# [Create a server](https://github.com/rackspace/pyrax/blob/master/docs/cloud_servers.md#creating-a-server)
|
|
33
|
+
server = cs.servers.create("Pyrax Server", image, flavor)
|
|
34
|
+
# and [wait for it to build](https://github.com/rackspace/pyrax/blob/master/docs/cloud_servers.md#waiting-for-server-completion).
|
|
35
|
+
pyrax.utils.wait_for_build(server, verbose=True)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
|
|
3
|
+
import os
|
|
4
|
+
import pyrax
|
|
5
|
+
|
|
6
|
+
pyrax.set_setting("identity_type", "rackspace")
|
|
7
|
+
# Create the identity object
|
|
8
|
+
pyrax._create_identity()
|
|
9
|
+
# Change its endpoint
|
|
10
|
+
pyrax.identity.auth_endpoint = os.getenv('RAX_AUTH_URL') + '/v2.0/'
|
|
11
|
+
|
|
12
|
+
# Authenticate
|
|
13
|
+
pyrax.set_credentials(os.getenv('RAX_USERNAME'), os.getenv('RAX_API_KEY'))
|
|
14
|
+
|
|
15
|
+
# Cloud Files API - List Files
|
|
16
|
+
cf = pyrax.cloudfiles
|
|
17
|
+
cf.get_object_metadata(os.getenv('TEST_DIRECTORY'), os.getenv('TEST_FILE'))
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
|
|
3
|
+
import os
|
|
4
|
+
import pyrax
|
|
5
|
+
import time
|
|
6
|
+
|
|
7
|
+
container_name = 'my-site'
|
|
8
|
+
folder_to_upload = os.getenv('TEST_DIRECTORY')
|
|
9
|
+
username = os.getenv('RAX_USERNAME')
|
|
10
|
+
api_key = os.getenv('RAX_API_KEY')
|
|
11
|
+
auth_endpoint = os.getenv('RAX_AUTH_URL')
|
|
12
|
+
|
|
13
|
+
pyrax.set_setting("identity_type", "rackspace")
|
|
14
|
+
# Create the identity object
|
|
15
|
+
pyrax._create_identity()
|
|
16
|
+
# Change its endpoint
|
|
17
|
+
pyrax.identity.auth_endpoint = auth_endpoint + '/v2.0/'
|
|
18
|
+
|
|
19
|
+
# Identity Connection - Authenticate
|
|
20
|
+
pyrax.set_credentials(username, api_key)
|
|
21
|
+
|
|
22
|
+
cf = pyrax.cloudfiles
|
|
23
|
+
print 'Uploading folder'
|
|
24
|
+
upload_key, total_bytes = cf.upload_folder(folder_to_upload, container=container_name)
|
|
25
|
+
print "Total bytes to upload:", total_bytes
|
|
26
|
+
uploaded = 0
|
|
27
|
+
while uploaded < total_bytes:
|
|
28
|
+
uploaded = cf.get_uploaded(upload_key)
|
|
29
|
+
print "Progress: %4.2f%%" % ((uploaded * 100.0) / total_bytes)
|
|
30
|
+
time.sleep(1)
|
|
31
|
+
|
|
32
|
+
print 'Done uploading'
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
Babel==1.3
|
|
2
|
+
httplib2==0.8
|
|
3
|
+
iso8601==0.1.10
|
|
4
|
+
keyring==3.6
|
|
5
|
+
mock==1.0.1
|
|
6
|
+
os-diskconfig-python-novaclient-ext==0.1.2
|
|
7
|
+
os-networksv2-python-novaclient-ext==0.21
|
|
8
|
+
os-virtual-interfacesv2-python-novaclient-ext==0.15
|
|
9
|
+
pbr==0.6
|
|
10
|
+
prettytable==0.7.2
|
|
11
|
+
pyrax==1.6.4
|
|
12
|
+
python-novaclient==2.13.0
|
|
13
|
+
pytz==2014.1
|
|
14
|
+
rackspace-auth-openstack==1.3
|
|
15
|
+
rackspace-novaclient==1.4
|
|
16
|
+
rax-default-network-flags-python-novaclient-ext==0.2.3
|
|
17
|
+
rax-scheduled-images-python-novaclient-ext==0.2.1
|
|
18
|
+
requests==2.2.1
|
|
19
|
+
simplejson==3.3.3
|
|
20
|
+
six==1.6.1
|
|
21
|
+
wsgiref==0.1.2
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
# Content above the snippet is ignored
|
|
3
|
+
|
|
4
|
+
print 'Hello, world!'
|
|
5
|
+
|
|
6
|
+
# {{snippet factorial}}
|
|
7
|
+
def factorial(n):
|
|
8
|
+
if n == 0:
|
|
9
|
+
return 1
|
|
10
|
+
else:
|
|
11
|
+
return n * factorial(n-1)
|
|
12
|
+
# {{endsnippet}}
|
|
13
|
+
|
|
14
|
+
# So is content below the snippet
|
|
15
|
+
print "{{snippet factorial_result}}"
|
|
16
|
+
print "The result of factorial(7) is:"
|
|
17
|
+
print " %d" % factorial(7)
|
|
18
|
+
print "{{endsnippet}}"
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Quines
|
|
2
|
+
|
|
3
|
+
This document is a small collection of quines. This documentation is generated from a [Polytrix](https://github.com/rackerlabs/polytrix) that validated each quine.
|
|
4
|
+
|
|
5
|
+
Examples for <%= scenario %> scenario:
|
|
6
|
+
|
|
7
|
+
<% Polytrix.implementors.each do |implementor| %>
|
|
8
|
+
## <%= implementor %> <%#= implementor.name %>
|
|
9
|
+
|
|
10
|
+
Source:
|
|
11
|
+
|
|
12
|
+
```<%#= implementor.language %>
|
|
13
|
+
<%#= implementor.sample_code_for scenario %>
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Output:
|
|
17
|
+
```
|
|
18
|
+
<%#= implementor.result_for scenario %>
|
|
19
|
+
```
|
|
20
|
+
<% end %>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
module Polytrix
|
|
2
|
+
describe ChallengeBuilder do
|
|
3
|
+
let(:implementor) { Polytrix::Implementor.new :name => 'some_sdk', :basedir => 'spec/fixtures' }
|
|
4
|
+
subject(:builder) { described_class.new implementor }
|
|
5
|
+
let(:challenge) { challenge = builder.build :name => 'factorial', :vars => {} }
|
|
6
|
+
|
|
7
|
+
it 'builds a Challenge' do
|
|
8
|
+
expect(challenge).to be_an_instance_of Polytrix::Challenge
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
it 'finds the source' do
|
|
12
|
+
expected_file = Pathname.new 'spec/fixtures/factorial.py'
|
|
13
|
+
expect(challenge.source_file).to eq(expected_file)
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
module Polytrix
|
|
2
|
+
describe ChallengeRunner do
|
|
3
|
+
subject(:runner) { ChallengeRunner.createRunner }
|
|
4
|
+
let(:challenge) do
|
|
5
|
+
Challenge.new :name => 'factorial', :source_file => 'spec/fixtures/factorial.py', :basedir => 'spec/fixtures'
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
describe '#run_challenge' do
|
|
9
|
+
it 'executes a challenge' do
|
|
10
|
+
expect(runner.run_challenge challenge).to be_an_instance_of Challenge
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
module Polytrix
|
|
2
|
+
describe Challenge do
|
|
3
|
+
subject(:challenge) do
|
|
4
|
+
implementor = Polytrix::Implementor.new :name => 'some_sdk', :basedir => 'spec/fixtures'
|
|
5
|
+
builder = Polytrix::ChallengeBuilder.new implementor
|
|
6
|
+
builder.build :name => 'factorial', :vars => {}
|
|
7
|
+
end
|
|
8
|
+
|
|
9
|
+
describe '#run' do
|
|
10
|
+
it 'executes the challenge and returns itself' do
|
|
11
|
+
expect(challenge.run).to be_an_instance_of Challenge
|
|
12
|
+
expect(challenge.run).to eq(challenge)
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
it 'stores the result' do
|
|
16
|
+
expect(challenge.run[:result]).to be_an_instance_of Result
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
module Polytrix
|
|
2
|
+
describe DocumentationGenerator do
|
|
3
|
+
let(:search_path) { 'spec/fixtures/src-doc' }
|
|
4
|
+
let(:bound_data) { double }
|
|
5
|
+
subject(:generator) { DocumentationGenerator.new(search_path) }
|
|
6
|
+
|
|
7
|
+
context 'when no documentation exists' do
|
|
8
|
+
it 'does nothing if there is no documentation for the scenario' do
|
|
9
|
+
expect(generator.process 'no_doc', bound_data).to be_nil
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
context 'when documentation does exist' do
|
|
14
|
+
|
|
15
|
+
let(:generated_doc) { generator.process 'Quine', bound_data }
|
|
16
|
+
|
|
17
|
+
it 'returns the generated document as a string' do
|
|
18
|
+
expect(generated_doc).to be_a(String)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
context 'ERB processing' do
|
|
22
|
+
it 'processes scenario' do
|
|
23
|
+
expect(generated_doc).to include 'Examples for Quine scenario:'
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
it 'processes Polytrix.implementors' do
|
|
27
|
+
fail 'This test requires implementors' unless Polytrix.implementors
|
|
28
|
+
|
|
29
|
+
Polytrix.implementors.each do |implementor|
|
|
30
|
+
expect(generated_doc).to include "## #{implementor}"
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|