airavata git commit: adding a place holder for allocation manager
Repository: airavata Updated Branches: refs/heads/develop ebdf8977f -> db2a68268 adding a place holder for allocation manager Project: http://git-wip-us.apache.org/repos/asf/airavata/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/db2a6826 Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/db2a6826 Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/db2a6826 Branch: refs/heads/develop Commit: db2a6826851e5b7cafeeb60185ed1204c0bb9281 Parents: ebdf897 Author: Suresh MarruAuthored: Tue Sep 26 16:28:54 2017 -0400 Committer: Suresh Marru Committed: Tue Sep 26 16:28:54 2017 -0400 -- modules/allocation-manager/pom.xml | 27 +++ 1 file changed, 27 insertions(+) -- http://git-wip-us.apache.org/repos/asf/airavata/blob/db2a6826/modules/allocation-manager/pom.xml -- diff --git a/modules/allocation-manager/pom.xml b/modules/allocation-manager/pom.xml new file mode 100644 index 000..b6bebc5 --- /dev/null +++ b/modules/allocation-manager/pom.xml @@ -0,0 +1,27 @@ + +http://maven.apache.org/POM/4.0.0; + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd;> + + +org.apache.airavata +airavata +0.17-SNAPSHOT +../../pom.xml + + +4.0.0 +allocation-manager +0.17-SNAPSHOT +pom +Airavata Resource Allocation Manager +http://airavata.apache.org/ + + +allocation-manager-stubs +allocation-manager-service +allocation-manager-database + + + +
[05/12] airavata-php-gateway git commit: AIRAVATA-2500 Thrift stub code generation
AIRAVATA-2500 Thrift stub code generation Project: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/commit/2db05f4f Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/2db05f4f Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/2db05f4f Branch: refs/heads/develop Commit: 2db05f4f64988558d10fc7b4b059f422a523e3f7 Parents: 3f67f68 Author: Marcus ChristieAuthored: Thu Sep 7 15:16:14 2017 -0400 Committer: Marcus Christie Committed: Thu Sep 7 15:30:48 2017 -0400 -- .../Model/AppCatalog/GatewayProfile/Types.php | 23 1 file changed, 23 insertions(+) -- http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/2db05f4f/app/libraries/Airavata/Model/AppCatalog/GatewayProfile/Types.php -- diff --git a/app/libraries/Airavata/Model/AppCatalog/GatewayProfile/Types.php b/app/libraries/Airavata/Model/AppCatalog/GatewayProfile/Types.php index da3071a..63e39bc 100644 --- a/app/libraries/Airavata/Model/AppCatalog/GatewayProfile/Types.php +++ b/app/libraries/Airavata/Model/AppCatalog/GatewayProfile/Types.php @@ -118,6 +118,10 @@ class ComputeResourcePreference { * @var array */ public $sshAccountProvisionerConfig = null; + /** + * @var string + */ + public $sshAccountProvisionerAdditionalInfo = null; public function __construct($vals=null) { if (!isset(self::$_TSPEC)) { @@ -194,6 +198,10 @@ class ComputeResourcePreference { 'type' => TType::STRING, ), ), +17 => array( + 'var' => 'sshAccountProvisionerAdditionalInfo', + 'type' => TType::STRING, + ), ); } if (is_array($vals)) { @@ -245,6 +253,9 @@ class ComputeResourcePreference { if (isset($vals['sshAccountProvisionerConfig'])) { $this->sshAccountProvisionerConfig = $vals['sshAccountProvisionerConfig']; } + if (isset($vals['sshAccountProvisionerAdditionalInfo'])) { +$this->sshAccountProvisionerAdditionalInfo = $vals['sshAccountProvisionerAdditionalInfo']; + } } } @@ -392,6 +403,13 @@ class ComputeResourcePreference { $xfer += $input->skip($ftype); } break; +case 17: + if ($ftype == TType::STRING) { +$xfer += $input->readString($this->sshAccountProvisionerAdditionalInfo); + } else { +$xfer += $input->skip($ftype); + } + break; default: $xfer += $input->skip($ftype); break; @@ -498,6 +516,11 @@ class ComputeResourcePreference { } $xfer += $output->writeFieldEnd(); } +if ($this->sshAccountProvisionerAdditionalInfo !== null) { + $xfer += $output->writeFieldBegin('sshAccountProvisionerAdditionalInfo', TType::STRING, 17); + $xfer += $output->writeString($this->sshAccountProvisionerAdditionalInfo); + $xfer += $output->writeFieldEnd(); +} $xfer += $output->writeFieldStop(); $xfer += $output->writeStructEnd(); return $xfer;
[08/12] airavata-php-gateway git commit: AIRAVATA-2500 Prevent deleting in-use user credentials
AIRAVATA-2500 Prevent deleting in-use user credentials Project: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/commit/277f3468 Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/277f3468 Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/277f3468 Branch: refs/heads/develop Commit: 277f34685da4273b1ee2f030b02c2830f6ca55e9 Parents: 2782a49 Author: Marcus ChristieAuthored: Thu Sep 7 16:31:28 2017 -0400 Committer: Marcus Christie Committed: Thu Sep 7 16:31:28 2017 -0400 -- app/controllers/UserSettingsController.php | 22 +- app/views/account/credential-store.blade.php | 11 +-- 2 files changed, 26 insertions(+), 7 deletions(-) -- http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/277f3468/app/controllers/UserSettingsController.php -- diff --git a/app/controllers/UserSettingsController.php b/app/controllers/UserSettingsController.php index d73e874..7f449a6 100644 --- a/app/controllers/UserSettingsController.php +++ b/app/controllers/UserSettingsController.php @@ -17,7 +17,7 @@ class UserSettingsController extends BaseController $userCredentialSummaries = URPUtilities::get_all_ssh_pub_keys_summary_for_user(); $defaultCredentialToken = $userResourceProfile->credentialStoreToken; foreach ($userCredentialSummaries as $credentialSummary) { -$credentialSummary->canDelete = ($credentialSummary->token != $defaultCredentialToken); +$credentialSummary->canDelete = $this->canDeleteCredential($credentialSummary->token, $userResourceProfile); } return View::make("account/credential-store", array( @@ -27,6 +27,26 @@ class UserSettingsController extends BaseController )); } +// Don't allow deleting credential if default credential or in use by a +// userComputeResourcePreference or a userStoragePreference +private function canDeleteCredential($token, $userResourceProfile) { +if ($token == $userResourceProfile->credentialStoreToken) { +return false; +} else { +foreach ($userResourceProfile->userComputeResourcePreferences as $userCompResPref) { +if ($userCompResPref->resourceSpecificCredentialStoreToken == $token) { +return false; +} +} +foreach ($userResourceProfile->userStoragePreferences as $userStoragePreference) { +if ($userStoragePreference->resourceSpecificCredentialStoreToken == $token) { +return false; +} +} +} +return true; +} + public function setDefaultCredential() { $defaultToken = Input::get("defaultToken"); http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/277f3468/app/views/account/credential-store.blade.php -- diff --git a/app/views/account/credential-store.blade.php b/app/views/account/credential-store.blade.php index a6b0b33..32e0f0d 100644 --- a/app/views/account/credential-store.blade.php +++ b/app/views/account/credential-store.blade.php @@ -57,15 +57,14 @@ @if ($credentialSummary->token != $defaultCredentialToken) -Make Default +Make Default -@else -This is the default SSH public key that the gateway will use to authenticate to your compute and storage accounts. -@endif -@if ($credentialSummary->canDelete) Delete +class="btn btn-danger delete-credential" +@if(!$credentialSummary->canDelete) disabled @endif>Delete +@else +This is the default SSH public key that the gateway will use to authenticate to your compute and storage accounts. @endif
[11/12] airavata-php-gateway git commit: AIRAVATA-2500 Thrift stub code generation
AIRAVATA-2500 Thrift stub code generation Project: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/commit/4727617a Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/4727617a Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/4727617a Branch: refs/heads/develop Commit: 4727617a70ffc190f1a2ffd388848d934534c24d Parents: 8a3b0ad Author: Marcus ChristieAuthored: Mon Sep 25 16:20:25 2017 -0400 Committer: Marcus Christie Committed: Mon Sep 25 16:20:25 2017 -0400 -- app/libraries/Airavata/API/Airavata.php | 10 +++ .../AppCatalog/UserResourceProfile/Types.php| 28 2 files changed, 38 insertions(+) -- http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/4727617a/app/libraries/Airavata/API/Airavata.php -- diff --git a/app/libraries/Airavata/API/Airavata.php b/app/libraries/Airavata/API/Airavata.php index c8976ba..a22ef84 100644 --- a/app/libraries/Airavata/API/Airavata.php +++ b/app/libraries/Airavata/API/Airavata.php @@ -3485,6 +3485,11 @@ interface AiravataIf { * Resource specific credential store token. If this token is specified, then it is superceeded by the gateway's * default credential store. * + * validated: + * If true the the configuration has been validated in the sense that the username and credential can be used to + * login to the remote host and the scratchLocation is a valid location that the user has permission to write to. + * Should be treated as read-only and only mutated by Airavata middleware. + * * * @throws \Airavata\API\Error\InvalidRequestException * @throws \Airavata\API\Error\AiravataClientException @@ -3717,6 +3722,11 @@ interface AiravataIf { * Resource specific credential store token. If this token is specified, then it is superceeded by the gateway's * default credential store. * + * validated: + * If true the the configuration has been validated in the sense that the username and credential can be used to + * login to the remote host and the scratchLocation is a valid location that the user has permission to write to. + * Should be treated as read-only and only mutated by Airavata middleware. + * * * @throws \Airavata\API\Error\InvalidRequestException * @throws \Airavata\API\Error\AiravataClientException http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/4727617a/app/libraries/Airavata/Model/AppCatalog/UserResourceProfile/Types.php -- diff --git a/app/libraries/Airavata/Model/AppCatalog/UserResourceProfile/Types.php b/app/libraries/Airavata/Model/AppCatalog/UserResourceProfile/Types.php index 8ab78a0..c4a0a9c 100644 --- a/app/libraries/Airavata/Model/AppCatalog/UserResourceProfile/Types.php +++ b/app/libraries/Airavata/Model/AppCatalog/UserResourceProfile/Types.php @@ -43,6 +43,11 @@ use Thrift\Exception\TApplicationException; * Resource specific credential store token. If this token is specified, then it is superceeded by the gateway's * default credential store. * + * validated: + * If true the the configuration has been validated in the sense that the username and credential can be used to + * login to the remote host and the scratchLocation is a valid location that the user has permission to write to. + * Should be treated as read-only and only mutated by Airavata middleware. + * */ class UserComputeResourcePreference { static $_TSPEC; @@ -87,6 +92,10 @@ class UserComputeResourcePreference { * @var int */ public $reservationEndTime = null; + /** + * @var bool + */ + public $validated = false; public function __construct($vals=null) { if (!isset(self::$_TSPEC)) { @@ -131,6 +140,10 @@ class UserComputeResourcePreference { 'var' => 'reservationEndTime', 'type' => TType::I64, ), +11 => array( + 'var' => 'validated', + 'type' => TType::BOOL, + ), ); } if (is_array($vals)) { @@ -164,6 +177,9 @@ class UserComputeResourcePreference { if (isset($vals['reservationEndTime'])) { $this->reservationEndTime = $vals['reservationEndTime']; } + if (isset($vals['validated'])) { +$this->validated = $vals['validated']; + } } } @@ -256,6 +272,13 @@ class UserComputeResourcePreference { $xfer += $input->skip($ftype); } break; +case 11: + if ($ftype == TType::BOOL) { +$xfer += $input->readBool($this->validated); + } else { +$xfer +=
[02/12] airavata-php-gateway git commit: AIRAVATA-2500 Thrift stub code generation
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/cf2eae7e/app/libraries/Airavata/Model/AppCatalog/AccountProvisioning/Types.php -- diff --git a/app/libraries/Airavata/Model/AppCatalog/AccountProvisioning/Types.php b/app/libraries/Airavata/Model/AppCatalog/AccountProvisioning/Types.php new file mode 100644 index 000..541abd8 --- /dev/null +++ b/app/libraries/Airavata/Model/AppCatalog/AccountProvisioning/Types.php @@ -0,0 +1,345 @@ + 'STRING', +1 => 'CRED_STORE_PASSWORD_TOKEN', + ); +} + +class SSHAccountProvisionerConfigParam { + static $_TSPEC; + + /** + * @var string + */ + public $name = null; + /** + * @var int + */ + public $type = 0; + /** + * @var bool + */ + public $isOptional = false; + /** + * @var string + */ + public $description = null; + + public function __construct($vals=null) { +if (!isset(self::$_TSPEC)) { + self::$_TSPEC = array( +1 => array( + 'var' => 'name', + 'type' => TType::STRING, + ), +2 => array( + 'var' => 'type', + 'type' => TType::I32, + ), +3 => array( + 'var' => 'isOptional', + 'type' => TType::BOOL, + ), +4 => array( + 'var' => 'description', + 'type' => TType::STRING, + ), +); +} +if (is_array($vals)) { + if (isset($vals['name'])) { +$this->name = $vals['name']; + } + if (isset($vals['type'])) { +$this->type = $vals['type']; + } + if (isset($vals['isOptional'])) { +$this->isOptional = $vals['isOptional']; + } + if (isset($vals['description'])) { +$this->description = $vals['description']; + } +} + } + + public function getName() { +return 'SSHAccountProvisionerConfigParam'; + } + + public function read($input) + { +$xfer = 0; +$fname = null; +$ftype = 0; +$fid = 0; +$xfer += $input->readStructBegin($fname); +while (true) +{ + $xfer += $input->readFieldBegin($fname, $ftype, $fid); + if ($ftype == TType::STOP) { +break; + } + switch ($fid) + { +case 1: + if ($ftype == TType::STRING) { +$xfer += $input->readString($this->name); + } else { +$xfer += $input->skip($ftype); + } + break; +case 2: + if ($ftype == TType::I32) { +$xfer += $input->readI32($this->type); + } else { +$xfer += $input->skip($ftype); + } + break; +case 3: + if ($ftype == TType::BOOL) { +$xfer += $input->readBool($this->isOptional); + } else { +$xfer += $input->skip($ftype); + } + break; +case 4: + if ($ftype == TType::STRING) { +$xfer += $input->readString($this->description); + } else { +$xfer += $input->skip($ftype); + } + break; +default: + $xfer += $input->skip($ftype); + break; + } + $xfer += $input->readFieldEnd(); +} +$xfer += $input->readStructEnd(); +return $xfer; + } + + public function write($output) { +$xfer = 0; +$xfer += $output->writeStructBegin('SSHAccountProvisionerConfigParam'); +if ($this->name !== null) { + $xfer += $output->writeFieldBegin('name', TType::STRING, 1); + $xfer += $output->writeString($this->name); + $xfer += $output->writeFieldEnd(); +} +if ($this->type !== null) { + $xfer += $output->writeFieldBegin('type', TType::I32, 2); + $xfer += $output->writeI32($this->type); + $xfer += $output->writeFieldEnd(); +} +if ($this->isOptional !== null) { + $xfer += $output->writeFieldBegin('isOptional', TType::BOOL, 3); + $xfer += $output->writeBool($this->isOptional); + $xfer += $output->writeFieldEnd(); +} +if ($this->description !== null) { + $xfer += $output->writeFieldBegin('description', TType::STRING, 4); + $xfer += $output->writeString($this->description); + $xfer += $output->writeFieldEnd(); +} +$xfer += $output->writeFieldStop(); +$xfer += $output->writeStructEnd(); +return $xfer; + } + +} + +class SSHAccountProvisioner { + static $_TSPEC; + + /** + * @var string + */ + public $name = null; + /** + * @var bool + */ + public $canCreateAccount = null; + /** + * @var bool + */ + public $canInstallSSHKey = null; + /** + * @var \Airavata\Model\AppCatalog\AccountProvisioning\SSHAccountProvisionerConfigParam[] + */ + public $configParams = null; + + public function __construct($vals=null) { +if (!isset(self::$_TSPEC)) { + self::$_TSPEC = array( +1 => array( + 'var' => 'name', + 'type' => TType::STRING, + ), +2 => array( + 'var' =>
[09/12] airavata-php-gateway git commit: AIRAVATA-2500 Fixing layout
AIRAVATA-2500 Fixing layout Project: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/commit/20db67cb Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/20db67cb Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/20db67cb Branch: refs/heads/develop Commit: 20db67cb21d836b6ab4dd42a8bbdb4fb3ee7fbb8 Parents: 277f346 Author: Marcus ChristieAuthored: Fri Sep 22 13:53:40 2017 -0400 Committer: Marcus Christie Committed: Fri Sep 22 13:53:58 2017 -0400 -- .../auto-provisioned-accounts.blade.php | 44 ++-- 1 file changed, 23 insertions(+), 21 deletions(-) -- http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/20db67cb/app/views/partials/auto-provisioned-accounts.blade.php -- diff --git a/app/views/partials/auto-provisioned-accounts.blade.php b/app/views/partials/auto-provisioned-accounts.blade.php index 78c9648..5f56aa3 100644 --- a/app/views/partials/auto-provisioned-accounts.blade.php +++ b/app/views/partials/auto-provisioned-accounts.blade.php @@ -22,27 +22,29 @@ @foreach ($auto_provisioned_accounts as $auto_provisioned_account) - -@if ($auto_provisioned_account["errorMessage"] != null) - FAILED - -See Error Message for more information and contact Gateway Admin for help. - -@elseif ($auto_provisioned_account["accountExists"] === false) - ACCOUNT MISSING - -See Additional Info for more information on how to create your account on {{{ $auto_provisioned_account["hostname"]}}}. - -@elseif ($auto_provisioned_account["userComputeResourcePreference"] != null) - OK -@else - UNKNOWN -@endif - -{{{ $auto_provisioned_account["hostname"] }}} -{{-- Not escaping HTML to allow Gateway Admin to put HTML into additionalInfo field --}} -{{ $auto_provisioned_account["additionalInfo"] }} -{{{ $auto_provisioned_account["errorMessage"] }}} + + +@if ($auto_provisioned_account["errorMessage"] != null) + FAILED + +See Error Message for more information and contact Gateway Admin for help. + +@elseif ($auto_provisioned_account["accountExists"] === false) + ACCOUNT MISSING + +See Additional Info for more information on how to create your account on {{{ $auto_provisioned_account["hostname"]}}}. + +@elseif ($auto_provisioned_account["userComputeResourcePreference"] != null) + OK +@else + UNKNOWN +@endif + +{{{ $auto_provisioned_account["hostname"] }}} +{{-- Not escaping HTML to allow Gateway Admin to put HTML into additionalInfo field --}} +{{ $auto_provisioned_account["additionalInfo"] }} +{{{ $auto_provisioned_account["errorMessage"] }}} + @endforeach
[12/12] airavata-php-gateway git commit: AIRAVATA-2500 Disallow editing auto provisioned ssh accounts
AIRAVATA-2500 Disallow editing auto provisioned ssh accounts Project: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/commit/f78e49e0 Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/f78e49e0 Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/f78e49e0 Branch: refs/heads/develop Commit: f78e49e07486d66fc68e9838ed858bc6bc19c3fb Parents: 4727617 Author: Marcus ChristieAuthored: Mon Sep 25 17:10:02 2017 -0400 Committer: Marcus Christie Committed: Mon Sep 25 17:10:02 2017 -0400 -- app/controllers/UserSettingsController.php | 12 + .../user-compute-resource-preferences.blade.php | 27 +--- 2 files changed, 30 insertions(+), 9 deletions(-) -- http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/f78e49e0/app/controllers/UserSettingsController.php -- diff --git a/app/controllers/UserSettingsController.php b/app/controllers/UserSettingsController.php index 7f449a6..ef17e17 100644 --- a/app/controllers/UserSettingsController.php +++ b/app/controllers/UserSettingsController.php @@ -102,6 +102,12 @@ class UserSettingsController extends BaseController public function getComputeResources(){ $userResourceProfile = URPUtilities::get_or_create_user_resource_profile(); +$gatewayResourceProfile = CRUtilities::getGatewayResourceProfile(); +$computeResourcePreferences = $gatewayResourceProfile->computeResourcePreferences; +$computeResourcePreferencesById = array(); +foreach ($computeResourcePreferences as $computeResourcePreference) { + $computeResourcePreferencesById[$computeResourcePreference->computeResourceId] = $computeResourcePreference; +} $allCRs = CRUtilities::getAllCRObjects(); foreach( $allCRs as $index => $crObject) @@ -111,6 +117,12 @@ class UserSettingsController extends BaseController // Add crDetails to each UserComputeResourcePreference foreach ($userResourceProfile->userComputeResourcePreferences as $index => $userCompResPref) { $userCompResPref->crDetails = $allCRsById[$userCompResPref->computeResourceId]; +// Disallow editing a UserComputeResourcePreference that was automatically setup by an sshAccountProvisioner +$userCompResPref->editable = true; +if (array_key_exists($userCompResPref->computeResourceId, $computeResourcePreferencesById)) { +$computeResourcePreference = $computeResourcePreferencesById[$userCompResPref->computeResourceId]; +$userCompResPref->editable = $computeResourcePreference->sshAccountProvisioner == null; +} // To figure out the unselectedCRs, remove this compute resource from allCRsById unset($allCRsById[$userCompResPref->computeResourceId]); } http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/f78e49e0/app/views/partials/user-compute-resource-preferences.blade.php -- diff --git a/app/views/partials/user-compute-resource-preferences.blade.php b/app/views/partials/user-compute-resource-preferences.blade.php index 49c3f85..caedb92 100644 --- a/app/views/partials/user-compute-resource-preferences.blade.php +++ b/app/views/partials/user-compute-resource-preferences.blade.php @@ -13,14 +13,15 @@ + value="@if( isset( $preferences) ){{$preferences->loginUserName}}@endif" + @if(isset($preferences) && !$preferences->editable) disabled @endif/> Preferred Batch Queue - +editable) disabled @endif> Select a Queue from list @foreach( (array)$computeResource->batchQueues as $index => $queue) + value="@if( isset( $preferences) ){{$preferences->scratchLocation}}@endif" + @if(isset($preferences) && !$preferences->editable) disabled @endif/> @@ -44,7 +46,8 @@ + value="@if( isset( $preferences) ){{$preferences->allocationProjectNumber}}@endif" + @if(isset($preferences) && !$preferences->editable) disabled @endif/> @@ -52,7 +55,7 @@ Resource Specific SSH Key - +editable) disabled @endif> resourceSpecificCredentialStoreToken == null) selected @endif> No resource specific SSH key, just use the default one ({{{$defaultCredentialSummary->description}}}) @@ -72,7 +75,8 @@ + value="@if( isset( $preferences)
[01/12] airavata-php-gateway git commit: AIRAVATA-2500 Initial work to setup ssh accounts and display
Repository: airavata-php-gateway Updated Branches: refs/heads/develop fa310a19e -> f78e49e07 AIRAVATA-2500 Initial work to setup ssh accounts and display Project: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/commit/f6653e2e Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/f6653e2e Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/f6653e2e Branch: refs/heads/develop Commit: f6653e2e32dd1b263bbeb97ad409d12ac5ed1c37 Parents: fa310a1 Author: Marcus ChristieAuthored: Thu Sep 7 13:12:00 2017 -0400 Committer: Marcus Christie Committed: Thu Sep 7 15:29:39 2017 -0400 -- app/controllers/AccountController.php | 7 +- app/libraries/CRUtilities.php | 5 ++ app/libraries/URPUtilities.php | 71 app/views/account/dashboard.blade.php | 3 + .../auto-provisioned-accounts.blade.php | 50 ++ 5 files changed, 134 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/f6653e2e/app/controllers/AccountController.php -- diff --git a/app/controllers/AccountController.php b/app/controllers/AccountController.php index f9ea073..734e823 100644 --- a/app/controllers/AccountController.php +++ b/app/controllers/AccountController.php @@ -294,12 +294,15 @@ class AccountController extends BaseController umask($old_umask); } +$auto_provisioned_accounts = URPUtilities::setup_auto_provisioned_accounts(); +Log::debug("auto_provisioned_accounts", array($auto_provisioned_accounts)); + if(Session::has("admin") || Session::has("admin-read-only") || Session::has("gateway-provider")){ return Redirect::to("admin/dashboard". "?status=ok=".$accessToken . "=".$username -. "_code=" . $refreshToken . "_time=" . $validTime); +. "_code=" . $refreshToken . "_time=" . $validTime)->with("auto_provisioned_accounts", $auto_provisioned_accounts); }else{ return Redirect::to("account/dashboard". "?status=ok=".$accessToken ."=".$username -. "_code=" . $refreshToken . "_time=" . $validTime); +. "_code=" . $refreshToken . "_time=" . $validTime)->with("auto_provisioned_accounts", $auto_provisioned_accounts); } } http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/f6653e2e/app/libraries/CRUtilities.php -- diff --git a/app/libraries/CRUtilities.php b/app/libraries/CRUtilities.php index 3643e72..8a815a1 100755 --- a/app/libraries/CRUtilities.php +++ b/app/libraries/CRUtilities.php @@ -544,6 +544,11 @@ class CRUtilities return $gateways; } +public static function getGatewayResourceProfile() +{ +return Airavata::getGatewayResourceProfile( Session::get('authz-token'), Session::get("gateway_id")); +} + public static function updateGatewayProfile( $data){ $gatewayResourceProfile = Airavata::getGatewayResourceProfile( Session::get('authz-token'), $data["gateway_id"]); $gatewayResourceProfile->credentialStoreToken = $data["cst"]; http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/f6653e2e/app/libraries/URPUtilities.php -- diff --git a/app/libraries/URPUtilities.php b/app/libraries/URPUtilities.php index 8632d59..906861a 100644 --- a/app/libraries/URPUtilities.php +++ b/app/libraries/URPUtilities.php @@ -161,6 +161,77 @@ class URPUtilities $gatewayId = Session::get('gateway_id'); Airavata::deleteUserResourceProfile(Session::get('authz-token'), $userId, $gatewayId); } + +/** + * Returns an array with compute resource ids as the key and each entry is a + * map with the following fields: + * * hostname: hostname of compute resource + * * userComputeResourcePreference: if UserComputeResourcePreference exists for compute resource or was able to be created + * * accountExists: (boolean) whether user account exists on cluster + * * additionalInfo: Additional info field from ComputeResourcePreference + * * errorMessage: Error message associated with trying to setup account + */ +public static function setup_auto_provisioned_accounts() +{ +$results = array(); +$gatewayResourceProfile = CRUtilities::getGatewayResourceProfile(); +$computeResourcePreferences = $gatewayResourceProfile->computeResourcePreferences; +$userComputeResourcePreferences =
[07/12] airavata-php-gateway git commit: AIRAVATA-2500 SSHAccountProvisioner error reporting
AIRAVATA-2500 SSHAccountProvisioner error reporting Project: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/commit/2782a493 Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/2782a493 Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/2782a493 Branch: refs/heads/develop Commit: 2782a4939136b7a968f3efb35ceb4c42ee627638 Parents: 2db05f4 Author: Marcus ChristieAuthored: Thu Sep 7 15:24:07 2017 -0400 Committer: Marcus Christie Committed: Thu Sep 7 16:20:04 2017 -0400 -- app/libraries/URPUtilities.php | 30 ++ 1 file changed, 18 insertions(+), 12 deletions(-) -- http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/2782a493/app/libraries/URPUtilities.php -- diff --git a/app/libraries/URPUtilities.php b/app/libraries/URPUtilities.php index 33b1e5e..27b4c67 100644 --- a/app/libraries/URPUtilities.php +++ b/app/libraries/URPUtilities.php @@ -189,24 +189,30 @@ class URPUtilities $computeResource = CRUtilities::get_compute_resource($computeResourceId); $hostname = $computeResource->hostName; $userComputeResourcePreference = null; -if( array_key_exists($computeResourceId, $userComputeResourcePreferences)) { -$userComputeResourcePreference = $userComputeResourcePreferences[$computeResourceId]; -$accountExists = true; -} else if ($sshAccountProvisioner->canCreateAccount) { -$userComputeResourcePreference = URPUtilities::setup_ssh_account($gatewayId, $userId, $computeResourceId, $hostname); -$accountExists = true; -} else if (Airavata::doesUserHaveSSHAccount(Session::get('authz-token'), $computeResourceId, $userId)) { -$userComputeResourcePreference = URPUtilities::setup_ssh_account($gatewayId, $userId, $computeResourceId, $hostname); -$accountExists = true; -} else { -$accountExists = false; +$errorMessage = null; +$accountExists = false; +try { +if( array_key_exists($computeResourceId, $userComputeResourcePreferences)) { +$userComputeResourcePreference = $userComputeResourcePreferences[$computeResourceId]; +$accountExists = true; +} else if ($sshAccountProvisioner->canCreateAccount) { +$userComputeResourcePreference = URPUtilities::setup_ssh_account($gatewayId, $userId, $computeResourceId, $hostname); +$accountExists = true; +} else if (Airavata::doesUserHaveSSHAccount(Session::get('authz-token'), $computeResourceId, $userId)) { +$userComputeResourcePreference = URPUtilities::setup_ssh_account($gatewayId, $userId, $computeResourceId, $hostname); +$accountExists = true; +} +} catch (Exception $ex) { +Log::error("Failed to setup SSH Account for " . $userId . " on $hostname"); +Log::error($ex); +$errorMessage = $ex->getMessage(); } $results[] = array( "hostname" => $hostname, "userComputeResourcePreference" => $userComputeResourcePreference, "accountExists" => $accountExists, "additionalInfo" => $computeResourcePreference->sshAccountProvisionerAdditionalInfo, -"errorMessage" => "TODO" +"errorMessage" => $errorMessage ); } }
[06/12] airavata-php-gateway git commit: AIRAVATA-2500 Display SSHAccountProvisioner additional info
AIRAVATA-2500 Display SSHAccountProvisioner additional info Project: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/commit/3f67f683 Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/3f67f683 Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/3f67f683 Branch: refs/heads/develop Commit: 3f67f683459245977d90183f3039e4d11e1ffdb3 Parents: cf2eae7 Author: Marcus ChristieAuthored: Thu Sep 7 15:15:42 2017 -0400 Committer: Marcus Christie Committed: Thu Sep 7 15:30:48 2017 -0400 -- app/libraries/URPUtilities.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/3f67f683/app/libraries/URPUtilities.php -- diff --git a/app/libraries/URPUtilities.php b/app/libraries/URPUtilities.php index 906861a..33b1e5e 100644 --- a/app/libraries/URPUtilities.php +++ b/app/libraries/URPUtilities.php @@ -205,7 +205,7 @@ class URPUtilities "hostname" => $hostname, "userComputeResourcePreference" => $userComputeResourcePreference, "accountExists" => $accountExists, -"additionalInfo" => "TODO", +"additionalInfo" => $computeResourcePreference->sshAccountProvisionerAdditionalInfo, "errorMessage" => "TODO" ); }
[03/12] airavata-php-gateway git commit: AIRAVATA-2500 Thrift stub code generation
http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/blob/cf2eae7e/app/libraries/Airavata/API/Airavata.php -- diff --git a/app/libraries/Airavata/API/Airavata.php b/app/libraries/Airavata/API/Airavata.php index ae27035..c8976ba 100644 --- a/app/libraries/Airavata/API/Airavata.php +++ b/app/libraries/Airavata/API/Airavata.php @@ -3428,6 +3428,71 @@ interface AiravataIf { */ public function deleteGatewayStoragePreference(\Airavata\Model\Security\AuthzToken $authzToken, $gatewayID, $storageId); /** + * @param \Airavata\Model\Security\AuthzToken $authzToken + * @return \Airavata\Model\AppCatalog\AccountProvisioning\SSHAccountProvisioner[] + * @throws \Airavata\API\Error\InvalidRequestException + * @throws \Airavata\API\Error\AiravataClientException + * @throws \Airavata\API\Error\AiravataSystemException + * @throws \Airavata\API\Error\AuthorizationException + */ + public function getSSHAccountProvisioners(\Airavata\Model\Security\AuthzToken $authzToken); + /** + * Check if user has an SSH account on the given compute resource. This + * method will only work if the compute resource has an SSHAccountProvisioner configured for it. + * + * @param \Airavata\Model\Security\AuthzToken $authzToken + * @param string $computeResourceId + * @param string $userId + * @return bool + * @throws \Airavata\API\Error\InvalidRequestException + * @throws \Airavata\API\Error\AiravataClientException + * @throws \Airavata\API\Error\AiravataSystemException + * @throws \Airavata\API\Error\AuthorizationException + */ + public function doesUserHaveSSHAccount(\Airavata\Model\Security\AuthzToken $authzToken, $computeResourceId, $userId); + /** + * Setup and return a UserComputeResourcePreference object for this user to SSH into the given compute resource with + * the given SSH credential. This method will only work if the compute resource has an SSHAccountProvisioner + * configured for it. The returned UserComputeResourcePreference object is not saved; it is up to the client to + * call addUserComputeResourcePreference to persist it. + * + * @param \Airavata\Model\Security\AuthzToken $authzToken + * @param string $computeResourceId + * @param string $userId + * @param string $airavataCredStoreToken + * @return \Airavata\Model\AppCatalog\UserResourceProfile\UserComputeResourcePreference User specific preferences for a Computer Resource + * + * computeResourceId: + * Corelate the preference to a compute resource. + * + * + * loginUserName: + * If turned true, Airavata will override the preferences of better alternatives exist. + * + * + * preferredBatchQueue: + * Gateways can choose a defualt batch queue based on average job dimention, reservations or other metrics. + * + * scratchLocation: + * Path to the local scratch space on a HPC cluster. Typically used to create working directory for job execution. + * + * allocationProjectNumber: + * Typically used on HPC machines to charge computing usage to a account number. For instance, on XSEDE once an + *allocation is approved, an allocation number is assigned. Before passing this number with job submittions, the + *account to be used has to be added to the allocation. + * + * resourceSpecificCredentialStoreToken: + * Resource specific credential store token. If this token is specified, then it is superceeded by the gateway's + * default credential store. + * + * + * @throws \Airavata\API\Error\InvalidRequestException + * @throws \Airavata\API\Error\AiravataClientException + * @throws \Airavata\API\Error\AiravataSystemException + * @throws \Airavata\API\Error\AuthorizationException + */ + public function setupUserComputeResourcePreferencesForSSH(\Airavata\Model\Security\AuthzToken $authzToken, $computeResourceId, $userId, $airavataCredStoreToken); + /** * Register User Resource Profile. * * @param UserResourceProfile @@ -4045,7 +4110,7 @@ interface AiravataIf { /** * @param \Airavata\Model\Security\AuthzToken $authzToken * @param \Airavata\Model\Group\GroupModel $groupModel - * @return bool + * @return string * @throws \Airavata\API\Error\InvalidRequestException * @throws \Airavata\API\Error\AiravataClientException * @throws \Airavata\API\Error\AiravataSystemException @@ -4066,14 +4131,13 @@ interface AiravataIf { * @param \Airavata\Model\Security\AuthzToken $authzToken * @param string $groupId * @param string $ownerId - * @param string $gatewayId * @return bool * @throws \Airavata\API\Error\InvalidRequestException * @throws \Airavata\API\Error\AiravataClientException * @throws \Airavata\API\Error\AiravataSystemException * @throws \Airavata\API\Error\AuthorizationException */ - public function deleteGroup(\Airavata\Model\Security\AuthzToken $authzToken,
[04/12] airavata-php-gateway git commit: AIRAVATA-2500 Thrift stub code generation
AIRAVATA-2500 Thrift stub code generation Project: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/commit/cf2eae7e Tree: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/tree/cf2eae7e Diff: http://git-wip-us.apache.org/repos/asf/airavata-php-gateway/diff/cf2eae7e Branch: refs/heads/develop Commit: cf2eae7e1e30bf02cb0ee30ae91f558999b9f90d Parents: f6653e2 Author: Marcus ChristieAuthored: Thu Sep 7 13:12:53 2017 -0400 Committer: Marcus Christie Committed: Thu Sep 7 15:30:43 2017 -0400 -- app/libraries/Airavata/API/Airavata.php | 4126 +++--- .../AppCatalog/AccountProvisioning/Types.php| 345 ++ .../Model/AppCatalog/GatewayProfile/Types.php | 120 +- app/libraries/Airavata/Model/Tenant/Types.php | 410 +- 4 files changed, 3326 insertions(+), 1675 deletions(-) --
[25/40] airavata git commit: AIRAVATA-2500 Thrift stub code generation
http://git-wip-us.apache.org/repos/asf/airavata/blob/3184c238/airavata-api/airavata-api-stubs/src/main/java/org/apache/airavata/api/Airavata.java -- diff --git a/airavata-api/airavata-api-stubs/src/main/java/org/apache/airavata/api/Airavata.java b/airavata-api/airavata-api-stubs/src/main/java/org/apache/airavata/api/Airavata.java index d92d222..48fdbd8 100644 --- a/airavata-api/airavata-api-stubs/src/main/java/org/apache/airavata/api/Airavata.java +++ b/airavata-api/airavata-api-stubs/src/main/java/org/apache/airavata/api/Airavata.java @@ -2621,9 +2621,7 @@ public class Airavata { */ public boolean deleteGatewayStoragePreference(org.apache.airavata.model.security.AuthzToken authzToken, String gatewayID, String storageId) throws org.apache.airavata.model.error.InvalidRequestException, org.apache.airavata.model.error.AiravataClientException, org.apache.airavata.model.error.AiravataSystemException, org.apache.airavata.model.error.AuthorizationException, org.apache.thrift.TException; -public List getSSHAccountProvisionerNames(org.apache.airavata.model.security.AuthzToken authzToken) throws org.apache.airavata.model.error.InvalidRequestException, org.apache.airavata.model.error.AiravataClientException, org.apache.airavata.model.error.AiravataSystemException, org.apache.airavata.model.error.AuthorizationException, org.apache.thrift.TException; - -public List getSSHAccountProvisionerConfigParams(org.apache.airavata.model.security.AuthzToken authzToken, String provisionerName) throws org.apache.airavata.model.error.InvalidRequestException, org.apache.airavata.model.error.AiravataClientException, org.apache.airavata.model.error.AiravataSystemException, org.apache.airavata.model.error.AuthorizationException, org.apache.thrift.TException; +public List getSSHAccountProvisioners(org.apache.airavata.model.security.AuthzToken authzToken) throws org.apache.airavata.model.error.InvalidRequestException, org.apache.airavata.model.error.AiravataClientException, org.apache.airavata.model.error.AiravataSystemException, org.apache.airavata.model.error.AuthorizationException, org.apache.thrift.TException; /** * Check if user has an SSH account on the given compute resource. This @@ -2631,9 +2629,9 @@ public class Airavata { * * @param authzToken * @param computeResourceId - * @param username + * @param userId */ -public boolean doesUserHaveSSHAccount(org.apache.airavata.model.security.AuthzToken authzToken, String computeResourceId, String username) throws org.apache.airavata.model.error.InvalidRequestException, org.apache.airavata.model.error.AiravataClientException, org.apache.airavata.model.error.AiravataSystemException, org.apache.airavata.model.error.AuthorizationException, org.apache.thrift.TException; +public boolean doesUserHaveSSHAccount(org.apache.airavata.model.security.AuthzToken authzToken, String computeResourceId, String userId) throws org.apache.airavata.model.error.InvalidRequestException, org.apache.airavata.model.error.AiravataClientException, org.apache.airavata.model.error.AiravataSystemException, org.apache.airavata.model.error.AuthorizationException, org.apache.thrift.TException; /** * Setup and return a UserComputeResourcePreference object for this user to SSH into the given compute resource with @@ -2643,10 +2641,10 @@ public class Airavata { * * @param authzToken * @param computeResourceId - * @param username + * @param userId * @param airavataCredStoreToken */ -public org.apache.airavata.model.appcatalog.userresourceprofile.UserComputeResourcePreference setupUserComputeResourcePreferencesForSSH(org.apache.airavata.model.security.AuthzToken authzToken, String computeResourceId, String username, String airavataCredStoreToken) throws org.apache.airavata.model.error.InvalidRequestException, org.apache.airavata.model.error.AiravataClientException, org.apache.airavata.model.error.AiravataSystemException, org.apache.airavata.model.error.AuthorizationException, org.apache.thrift.TException; +public org.apache.airavata.model.appcatalog.userresourceprofile.UserComputeResourcePreference setupUserComputeResourcePreferencesForSSH(org.apache.airavata.model.security.AuthzToken authzToken, String computeResourceId, String userId, String airavataCredStoreToken) throws org.apache.airavata.model.error.InvalidRequestException, org.apache.airavata.model.error.AiravataClientException, org.apache.airavata.model.error.AiravataSystemException, org.apache.airavata.model.error.AuthorizationException, org.apache.thrift.TException; /** * Register User Resource Profile. @@ -3318,13 +3316,11 @@ public class Airavata { public void deleteGatewayStoragePreference(org.apache.airavata.model.security.AuthzToken authzToken, String gatewayID,
[05/40] airavata git commit: AIRAVATA-2500 SSHAccountManager: install SSH key and verify
AIRAVATA-2500 SSHAccountManager: install SSH key and verify Project: http://git-wip-us.apache.org/repos/asf/airavata/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/3d161b81 Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/3d161b81 Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/3d161b81 Branch: refs/heads/develop Commit: 3d161b8161975be658259739047e36df3bd6ef38 Parents: 2a90139 Author: Marcus ChristieAuthored: Mon Aug 14 12:38:53 2017 -0400 Committer: Marcus Christie Committed: Tue Sep 19 15:07:56 2017 -0400 -- .../accountprovisioning/SSHAccountManager.java | 104 ++- .../airavata/accountprovisioning/SSHUtil.java | 83 +++ 2 files changed, 162 insertions(+), 25 deletions(-) -- http://git-wip-us.apache.org/repos/asf/airavata/blob/3d161b81/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/SSHAccountManager.java -- diff --git a/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/SSHAccountManager.java b/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/SSHAccountManager.java index dcb819b..d565fe9 100644 --- a/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/SSHAccountManager.java +++ b/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/SSHAccountManager.java @@ -25,43 +25,48 @@ import org.apache.airavata.common.utils.ServerSettings; import org.apache.airavata.credential.store.client.CredentialStoreClientFactory; import org.apache.airavata.credential.store.cpi.CredentialStoreService; import org.apache.airavata.credential.store.exception.CredentialStoreException; +import org.apache.airavata.model.appcatalog.accountprovisioning.SSHAccountProvisionerConfigParam; +import org.apache.airavata.model.appcatalog.computeresource.ComputeResourceDescription; +import org.apache.airavata.model.appcatalog.gatewayprofile.ComputeResourcePreference; import org.apache.airavata.model.credential.store.PasswordCredential; +import org.apache.airavata.model.credential.store.SSHCredential; import org.apache.airavata.registry.api.RegistryService; import org.apache.airavata.registry.api.client.RegistryServiceClientFactory; import org.apache.airavata.registry.api.exception.RegistryServiceException; import org.apache.thrift.TException; import java.util.HashMap; +import java.util.List; import java.util.Map; +import java.util.function.Function; +import java.util.stream.Collectors; public class SSHAccountManager { -// TODO: need private key too to verify -public static void setupSSHAccount(String gatewayId, String hostname, String username, String sshPublicKey) { - -// TODO: finish implementing +// TODO: change return type to one that returns some details of the SSH account setup, for example the scratch location +public static void setupSSHAccount(String gatewayId, String computeResourceId, String username, SSHCredential sshCredential) { // get compute resource preferences for the gateway and hostname +// TODO: close the registry service client transport when done with it +RegistryService.Client registryServiceClient = getRegistryServiceClient(); +ComputeResourcePreference computeResourcePreference = null; +ComputeResourceDescription computeResourceDescription = null; +try { +computeResourcePreference = registryServiceClient.getGatewayComputeResourcePreference(gatewayId, computeResourceId); +computeResourceDescription = registryServiceClient.getComputeResource(computeResourceId); +} catch(TException e) { +throw new RuntimeException(e); +} // get the account provisioner and config values for the preferences -String provisionerName = null; -Map provisionerConfig = null; - -CredentialStoreService.Client credentialStoreServiceClient = getCredentialStoreClient(); -// Resolve any CRED_STORE_PASSWORD_TOKEN config parameters to passwords -Map resolvedConfig = new HashMap<>(); -for (Map.Entry configEntry : provisionerConfig.entrySet() ) { -if (configEntry.getKey().getType() == ConfigParam.ConfigParamType.CRED_STORE_PASSWORD_TOKEN) { -try { -PasswordCredential password = credentialStoreServiceClient.getPasswordCredential(configEntry.getValue(), gatewayId); -resolvedConfig.put(configEntry.getKey(), password.getPassword()); -} catch (TException e) { -
[24/40] airavata git commit: AIRAVATA-2500 Thrift stub code generation
http://git-wip-us.apache.org/repos/asf/airavata/blob/3184c238/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/API/Airavata.php -- diff --git a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/API/Airavata.php b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/API/Airavata.php index 18bfcf5..c8976ba 100644 --- a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/API/Airavata.php +++ b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/API/Airavata.php @@ -3428,6 +3428,71 @@ interface AiravataIf { */ public function deleteGatewayStoragePreference(\Airavata\Model\Security\AuthzToken $authzToken, $gatewayID, $storageId); /** + * @param \Airavata\Model\Security\AuthzToken $authzToken + * @return \Airavata\Model\AppCatalog\AccountProvisioning\SSHAccountProvisioner[] + * @throws \Airavata\API\Error\InvalidRequestException + * @throws \Airavata\API\Error\AiravataClientException + * @throws \Airavata\API\Error\AiravataSystemException + * @throws \Airavata\API\Error\AuthorizationException + */ + public function getSSHAccountProvisioners(\Airavata\Model\Security\AuthzToken $authzToken); + /** + * Check if user has an SSH account on the given compute resource. This + * method will only work if the compute resource has an SSHAccountProvisioner configured for it. + * + * @param \Airavata\Model\Security\AuthzToken $authzToken + * @param string $computeResourceId + * @param string $userId + * @return bool + * @throws \Airavata\API\Error\InvalidRequestException + * @throws \Airavata\API\Error\AiravataClientException + * @throws \Airavata\API\Error\AiravataSystemException + * @throws \Airavata\API\Error\AuthorizationException + */ + public function doesUserHaveSSHAccount(\Airavata\Model\Security\AuthzToken $authzToken, $computeResourceId, $userId); + /** + * Setup and return a UserComputeResourcePreference object for this user to SSH into the given compute resource with + * the given SSH credential. This method will only work if the compute resource has an SSHAccountProvisioner + * configured for it. The returned UserComputeResourcePreference object is not saved; it is up to the client to + * call addUserComputeResourcePreference to persist it. + * + * @param \Airavata\Model\Security\AuthzToken $authzToken + * @param string $computeResourceId + * @param string $userId + * @param string $airavataCredStoreToken + * @return \Airavata\Model\AppCatalog\UserResourceProfile\UserComputeResourcePreference User specific preferences for a Computer Resource + * + * computeResourceId: + * Corelate the preference to a compute resource. + * + * + * loginUserName: + * If turned true, Airavata will override the preferences of better alternatives exist. + * + * + * preferredBatchQueue: + * Gateways can choose a defualt batch queue based on average job dimention, reservations or other metrics. + * + * scratchLocation: + * Path to the local scratch space on a HPC cluster. Typically used to create working directory for job execution. + * + * allocationProjectNumber: + * Typically used on HPC machines to charge computing usage to a account number. For instance, on XSEDE once an + *allocation is approved, an allocation number is assigned. Before passing this number with job submittions, the + *account to be used has to be added to the allocation. + * + * resourceSpecificCredentialStoreToken: + * Resource specific credential store token. If this token is specified, then it is superceeded by the gateway's + * default credential store. + * + * + * @throws \Airavata\API\Error\InvalidRequestException + * @throws \Airavata\API\Error\AiravataClientException + * @throws \Airavata\API\Error\AiravataSystemException + * @throws \Airavata\API\Error\AuthorizationException + */ + public function setupUserComputeResourcePreferencesForSSH(\Airavata\Model\Security\AuthzToken $authzToken, $computeResourceId, $userId, $airavataCredStoreToken); + /** * Register User Resource Profile. * * @param UserResourceProfile @@ -12720,6 +12785,200 @@ class AiravataClient implements \Airavata\API\AiravataIf { throw new \Exception("deleteGatewayStoragePreference failed: unknown result"); } + public function getSSHAccountProvisioners(\Airavata\Model\Security\AuthzToken $authzToken) + { +$this->send_getSSHAccountProvisioners($authzToken); +return $this->recv_getSSHAccountProvisioners(); + } + + public function send_getSSHAccountProvisioners(\Airavata\Model\Security\AuthzToken $authzToken) + { +$args = new \Airavata\API\Airavata_getSSHAccountProvisioners_args(); +$args->authzToken = $authzToken; +$bin_accel =
[20/40] airavata git commit: AIRAVATA-2500 Partial Implementation
AIRAVATA-2500 Partial Implementation Project: http://git-wip-us.apache.org/repos/asf/airavata/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/1c2ab272 Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/1c2ab272 Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/1c2ab272 Branch: refs/heads/develop Commit: 1c2ab2724fdb0e6d104130d0c4a8fc4c6df96312 Parents: fab1900 Author: spamidigAuthored: Fri Sep 15 09:56:05 2017 -0400 Committer: Marcus Christie Committed: Tue Sep 19 15:08:05 2017 -0400 -- modules/compute-account-provisioning/pom.xml| 6 + .../IULdapSSHAccountProvisioner.java| 120 ++- .../SSHAccountProvisionerFactoryTest.java | 10 +- .../TestSSHAccountProvisionerProvider.java | 8 +- 4 files changed, 136 insertions(+), 8 deletions(-) -- http://git-wip-us.apache.org/repos/asf/airavata/blob/1c2ab272/modules/compute-account-provisioning/pom.xml -- diff --git a/modules/compute-account-provisioning/pom.xml b/modules/compute-account-provisioning/pom.xml index ee89d33..de963df 100644 --- a/modules/compute-account-provisioning/pom.xml +++ b/modules/compute-account-provisioning/pom.xml @@ -52,6 +52,12 @@ org.slf4j slf4j-api + + +org.apache.directory.api +api-all +1.0.0 + junit junit http://git-wip-us.apache.org/repos/asf/airavata/blob/1c2ab272/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/provisioner/IULdapSSHAccountProvisioner.java -- diff --git a/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/provisioner/IULdapSSHAccountProvisioner.java b/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/provisioner/IULdapSSHAccountProvisioner.java index 03fa803..331c01c 100644 --- a/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/provisioner/IULdapSSHAccountProvisioner.java +++ b/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/provisioner/IULdapSSHAccountProvisioner.java @@ -22,20 +22,92 @@ package org.apache.airavata.accountprovisioning.provisioner; import org.apache.airavata.accountprovisioning.ConfigParam; import org.apache.airavata.accountprovisioning.SSHAccountProvisioner; - +import org.apache.directory.api.ldap.model.cursor.CursorException; +import org.apache.directory.ldap.client.api.*; +import org.apache.directory.api.ldap.model.cursor.EntryCursor; +import org.apache.directory.api.ldap.model.entry.Attribute; +import org.apache.directory.api.ldap.model.entry.Entry; +import org.apache.directory.api.ldap.model.entry.Modification; +import org.apache.directory.api.ldap.model.entry.DefaultEntry; +import org.apache.directory.api.ldap.model.exception.LdapException; +import org.apache.directory.api.ldap.model.message.SearchScope; +import org.apache.directory.api.ldap.model.message.DeleteResponse; +import org.apache.directory.api.ldap.model.message.ResultCodeEnum; +import org.junit.Assert; import java.util.Map; +import java.util.List; -public class IULdapSSHAccountProvisioner implements SSHAccountProvisioner { +public class IULdapSSHAccountProvisioner implements SSHAccountProvisioner { +String ldaphost, adminDN, ldap_username, ldap_password, adminPass, ldapBaseDN; +int ldapport, ldapPortId; +LdapConnection connection; @Override public void init(Map config) { // TODO: implement +ldapServerName = config.get(new ConfigParam("ldaphost"));//"bazooka.hps.iu.edu" +ldapPortId = config.get(new ConfigParam("ldapport"));//"636" +ldap_username = config.get(new ConfigParam("ldap_username"));//"cn=sgrcusr" +ldap_password = config.get(new ConfigParam("ldap_password"));//"lore footwork engorge" +ldapBaseDN = config.get(new ConfigParam( "ldapBaseDN" ));//"dc=rt,dc=iu,dc=edu" +try { +connection = new LdapNetworkConnection(ldaphost, ldapport, true); + + +System.out.println( "binding connection:" ); +String AuthDN=ldap_username+","+ldapBaseDN; +connection.bind(AuthDN,ldap_password); +//check that we're auth'ed and connected +System.out.println("asserting bound:"); +Assert.assertTrue( connection.isAuthenticated() ); +Assert.assertTrue( connection.isConnected() ); +} catch (Exception e) { +System.out.println("Exception caught!"); +
[40/40] airavata git commit: Merge branch 'AIRAVATA-2500' into develop
Merge branch 'AIRAVATA-2500' into develop I regenerated thrift stubs to deal with some conflicts Project: http://git-wip-us.apache.org/repos/asf/airavata/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/ebdf8977 Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/ebdf8977 Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/ebdf8977 Branch: refs/heads/develop Commit: ebdf8977f90d82572186a8944b9b7cdddac5db6a Parents: 666bcdf 50d7bb6 Author: Marcus ChristieAuthored: Tue Sep 26 15:08:05 2017 -0400 Committer: Marcus Christie Committed: Tue Sep 26 15:08:05 2017 -0400 -- airavata-api/airavata-api-server/pom.xml| 5 + .../server/handler/AiravataServerHandler.java |84 + .../java/org/apache/airavata/api/Airavata.java | 34970 ++--- .../resources/lib/Airavata/API/Airavata.php | 4066 +- .../Model/AppCatalog/GatewayProfile/Types.php | 143 +- .../AppCatalog/UserResourceProfile/Types.php|28 + .../SSHAccountProvisioner.java | 722 + .../SSHAccountProvisionerConfigParam.java | 702 + .../SSHAccountProvisionerConfigParamType.java |62 + .../ComputeResourcePreference.java | 375 +- .../gatewayprofile/GatewayResourceProfile.java |72 +- .../UserComputeResourcePreference.java | 113 +- modules/compute-account-provisioning/pom.xml|73 + .../accountprovisioning/ConfigParam.java|89 + .../InvalidSetupException.java |43 + .../InvalidUsernameException.java |43 + .../accountprovisioning/SSHAccountManager.java | 296 + .../SSHAccountProvisioner.java |77 + .../SSHAccountProvisionerFactory.java |63 + .../SSHAccountProvisionerProvider.java |60 + .../airavata/accountprovisioning/SSHUtil.java | 154 + .../IULdapSSHAccountProvisioner.java| 190 + .../IULdapSSHAccountProvisionerProvider.java|80 + ...ntprovisioning.SSHAccountProvisionerProvider |22 + .../SSHAccountProvisionerFactoryTest.java |77 + .../provisioner/TestSSHAccountProvisioner.java |65 + .../TestSSHAccountProvisionerProvider.java |80 + ...ntprovisioning.SSHAccountProvisionerProvider |21 + .../catalog/impl/GwyResourceProfileImpl.java|12 + .../catalog/impl/UsrResourceProfileImpl.java| 2 + .../model/ComputeResourcePreference.java|41 +- .../SSHAccountProvisionerConfiguration.java |98 + .../SSHAccountProvisionerConfigurationPK.java |57 + .../model/UserComputeResourcePreference.java|10 + .../ComputeHostPreferenceResource.java |62 +- .../UserComputeHostPreferenceResource.java |11 + .../app/catalog/util/AppCatalogJPAUtils.java|10 + .../util/AppCatalogThriftConversion.java|10 +- .../src/main/resources/META-INF/persistence.xml | 1 + .../src/main/resources/appcatalog-derby.sql |50 +- .../src/main/resources/appcatalog-mysql.sql |52 +- .../DeltaScripts/appCatalog_schema_delta.sql|36 + pom.xml | 1 + .../airavata-apis/airavata_api.thrift |27 + .../account_provisioning_model.thrift |44 + .../gateway_resource_profile_model.thrift | 6 +- .../user_resource_profile_model.thrift | 8 +- 47 files changed, 26586 insertions(+), 16727 deletions(-) --
[35/40] airavata git commit: AIRAVATA-2500 data migration for new validated flag
AIRAVATA-2500 data migration for new validated flag Project: http://git-wip-us.apache.org/repos/asf/airavata/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/ba4982c1 Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/ba4982c1 Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/ba4982c1 Branch: refs/heads/develop Commit: ba4982c1fe90b841b250f085a5b536c21c4f3201 Parents: 29fedaf Author: Marcus ChristieAuthored: Mon Sep 25 10:38:28 2017 -0400 Committer: Marcus Christie Committed: Mon Sep 25 10:38:28 2017 -0400 -- .../0.18-0.19/DeltaScripts/appCatalog_schema_delta.sql | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/airavata/blob/ba4982c1/modules/registry/release-migration-scripts/0.18-0.19/DeltaScripts/appCatalog_schema_delta.sql -- diff --git a/modules/registry/release-migration-scripts/0.18-0.19/DeltaScripts/appCatalog_schema_delta.sql b/modules/registry/release-migration-scripts/0.18-0.19/DeltaScripts/appCatalog_schema_delta.sql index 04241e2..672b43b 100644 --- a/modules/registry/release-migration-scripts/0.18-0.19/DeltaScripts/appCatalog_schema_delta.sql +++ b/modules/registry/release-migration-scripts/0.18-0.19/DeltaScripts/appCatalog_schema_delta.sql @@ -31,4 +31,6 @@ CREATE TABLE SSH_ACCOUNT_PROVISIONER_CONFIG FOREIGN KEY (GATEWAY_ID, RESOURCE_ID) REFERENCES COMPUTE_RESOURCE_PREFERENCE (GATEWAY_ID, RESOURCE_ID) ON DELETE CASCADE ) ENGINE=MyISAM DEFAULT CHARSET=latin1; -alter table USER_COMPUTE_RESOURCE_PREFERENCE add VALIDATED tinyint(1) NOT NULL DEFAULT 0; \ No newline at end of file +alter table USER_COMPUTE_RESOURCE_PREFERENCE add VALIDATED tinyint(1) NOT NULL DEFAULT 0; +-- VALIDATED defaults to false (0) but set all existing ones to be true (1) +update USER_COMPUTE_RESOURCE_PREFERENCE set VALIDATED = 1; \ No newline at end of file
[38/40] airavata git commit: Merge branch 'AIRAVATA-2500' into develop
http://git-wip-us.apache.org/repos/asf/airavata/blob/ebdf8977/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/Model/AppCatalog/UserResourceProfile/Types.php -- http://git-wip-us.apache.org/repos/asf/airavata/blob/ebdf8977/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/appcatalog/accountprovisioning/SSHAccountProvisioner.java -- diff --cc airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/appcatalog/accountprovisioning/SSHAccountProvisioner.java index 000,0dcadc4..0a4d046 mode 00,100644..100644 --- a/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/appcatalog/accountprovisioning/SSHAccountProvisioner.java +++ b/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/appcatalog/accountprovisioning/SSHAccountProvisioner.java @@@ -1,0 -1,755 +1,722 @@@ + /** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + /** - * Autogenerated by Thrift Compiler (0.9.3) ++ * Autogenerated by Thrift Compiler (0.10.0) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ + package org.apache.airavata.model.appcatalog.accountprovisioning; + -import org.apache.thrift.scheme.IScheme; -import org.apache.thrift.scheme.SchemeFactory; -import org.apache.thrift.scheme.StandardScheme; - -import org.apache.thrift.scheme.TupleScheme; -import org.apache.thrift.protocol.TTupleProtocol; -import org.apache.thrift.protocol.TProtocolException; -import org.apache.thrift.EncodingUtils; -import org.apache.thrift.TException; -import org.apache.thrift.async.AsyncMethodCallback; -import org.apache.thrift.server.AbstractNonblockingServer.*; -import java.util.List; -import java.util.ArrayList; -import java.util.Map; -import java.util.HashMap; -import java.util.EnumMap; -import java.util.Set; -import java.util.HashSet; -import java.util.EnumSet; -import java.util.Collections; -import java.util.BitSet; -import java.nio.ByteBuffer; -import java.util.Arrays; -import javax.annotation.Generated; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) -@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)") ++@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked", "unused"}) ++@javax.annotation.Generated(value = "Autogenerated by Thrift Compiler (0.10.0)") + public class SSHAccountProvisioner implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("SSHAccountProvisioner"); + + private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("name", org.apache.thrift.protocol.TType.STRING, (short)1); + private static final org.apache.thrift.protocol.TField CAN_CREATE_ACCOUNT_FIELD_DESC = new org.apache.thrift.protocol.TField("canCreateAccount", org.apache.thrift.protocol.TType.BOOL, (short)2); + private static final org.apache.thrift.protocol.TField CAN_INSTALL_SSHKEY_FIELD_DESC = new org.apache.thrift.protocol.TField("canInstallSSHKey", org.apache.thrift.protocol.TType.BOOL, (short)3); + private static final org.apache.thrift.protocol.TField CONFIG_PARAMS_FIELD_DESC = new org.apache.thrift.protocol.TField("configParams", org.apache.thrift.protocol.TType.LIST, (short)4); + - private static final Map schemes = new HashMap (); - static { -schemes.put(StandardScheme.class, new SSHAccountProvisionerStandardSchemeFactory()); -schemes.put(TupleScheme.class, new SSHAccountProvisionerTupleSchemeFactory()); - } ++ private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new SSHAccountProvisionerStandardSchemeFactory(); ++ private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new
[32/40] airavata git commit: AIRAVATA-2500 Add 'validated' flag to UserComputeResourcePreference
AIRAVATA-2500 Add 'validated' flag to UserComputeResourcePreference Project: http://git-wip-us.apache.org/repos/asf/airavata/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/20fc3fdb Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/20fc3fdb Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/20fc3fdb Branch: refs/heads/develop Commit: 20fc3fdbbd7928c63c0ee6abf1382d9970bbef67 Parents: 596eb5b Author: Marcus ChristieAuthored: Mon Sep 25 09:24:01 2017 -0400 Committer: Marcus Christie Committed: Mon Sep 25 09:57:28 2017 -0400 -- .../accountprovisioning/SSHAccountManager.java | 1 + .../catalog/impl/UsrResourceProfileImpl.java| 2 ++ .../model/UserComputeResourcePreference.java| 10 ++ .../UserComputeHostPreferenceResource.java | 11 ++ .../app/catalog/util/AppCatalogJPAUtils.java| 1 + .../util/AppCatalogThriftConversion.java| 1 + .../src/main/resources/appcatalog-derby.sql | 38 +++- .../src/main/resources/appcatalog-mysql.sql | 38 .../DeltaScripts/appCatalog_schema_delta.sql| 2 ++ .../user_resource_profile_model.thrift | 8 - 10 files changed, 110 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/airavata/blob/20fc3fdb/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/SSHAccountManager.java -- diff --git a/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/SSHAccountManager.java b/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/SSHAccountManager.java index e7e9052..136bbee 100644 --- a/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/SSHAccountManager.java +++ b/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/SSHAccountManager.java @@ -180,6 +180,7 @@ public class SSHAccountManager { userComputeResourcePreference.setComputeResourceId(computeResourceId); userComputeResourcePreference.setLoginUserName(username); userComputeResourcePreference.setScratchLocation(scratchLocation); +userComputeResourcePreference.setValidated(true); return userComputeResourcePreference; } http://git-wip-us.apache.org/repos/asf/airavata/blob/20fc3fdb/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/impl/UsrResourceProfileImpl.java -- diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/impl/UsrResourceProfileImpl.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/impl/UsrResourceProfileImpl.java index b7a95f8..a7366ca 100644 --- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/impl/UsrResourceProfileImpl.java +++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/impl/UsrResourceProfileImpl.java @@ -83,6 +83,7 @@ public class UsrResourceProfileImpl implements UsrResourceProfile { if (preference.getReservationEndTime() > 0) { resource.setReservationEndTime(AiravataUtils.getTime(preference.getReservationEndTime())); } +resource.setValidated(preference.isValidated()); resource.save(); } } @@ -142,6 +143,7 @@ public class UsrResourceProfileImpl implements UsrResourceProfile { if (preference.getReservationEndTime() > 0) { resource.setReservationEndTime(AiravataUtils.getTime(preference.getReservationEndTime())); } +resource.setValidated(preference.isValidated()); resource.save(); } } http://git-wip-us.apache.org/repos/asf/airavata/blob/20fc3fdb/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/UserComputeResourcePreference.java -- diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/UserComputeResourcePreference.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/UserComputeResourcePreference.java index e86248f..81ef75a 100644 --- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/UserComputeResourcePreference.java +++
[18/40] airavata git commit: AIRAVATA-2500 Added additional info field for SSH Account Provisioners
AIRAVATA-2500 Added additional info field for SSH Account Provisioners This field is meant to contain additional information or instructions to the user. First use case is to give user information on how to obtain a cluster account when the SSHAccountProvisioner is not able to automatically create the account. Project: http://git-wip-us.apache.org/repos/asf/airavata/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/71d33eaf Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/71d33eaf Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/71d33eaf Branch: refs/heads/develop Commit: 71d33eafe2fadda66ecd33aeb2a8415f7f67bcb1 Parents: 31f3906 Author: Marcus ChristieAuthored: Thu Sep 7 14:47:06 2017 -0400 Committer: Marcus Christie Committed: Tue Sep 19 15:08:05 2017 -0400 -- .../app/catalog/impl/GwyResourceProfileImpl.java | 2 ++ .../catalog/model/ComputeResourcePreference.java | 10 ++ .../resources/ComputeHostPreferenceResource.java | 18 +++--- .../core/app/catalog/util/AppCatalogJPAUtils.java | 1 + .../catalog/util/AppCatalogThriftConversion.java | 1 + .../src/main/resources/appcatalog-derby.sql | 1 + .../src/main/resources/appcatalog-mysql.sql | 1 + .../DeltaScripts/appCatalog_schema_delta.sql | 1 + .../gateway_resource_profile_model.thrift | 3 ++- 9 files changed, 34 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/airavata/blob/71d33eaf/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/impl/GwyResourceProfileImpl.java -- diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/impl/GwyResourceProfileImpl.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/impl/GwyResourceProfileImpl.java index 78a6f0f..aba25c7 100644 --- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/impl/GwyResourceProfileImpl.java +++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/impl/GwyResourceProfileImpl.java @@ -94,6 +94,7 @@ public class GwyResourceProfileImpl implements GwyResourceProfile { Map sshAccountProvisionerConfigurationsCopy = new HashMap<>(preference.getSshAccountProvisionerConfig()); resource.setSshAccountProvisionerConfigurations(sshAccountProvisionerConfigurationsCopy); } + resource.setSshAccountProvisionerAdditionalInfo(preference.getSshAccountProvisionerAdditionalInfo()); resource.save(); } } @@ -164,6 +165,7 @@ public class GwyResourceProfileImpl implements GwyResourceProfile { Map sshAccountProvisionerConfigurationsCopy = new HashMap<>(preference.getSshAccountProvisionerConfig()); resource.setSshAccountProvisionerConfigurations(sshAccountProvisionerConfigurationsCopy); } + resource.setSshAccountProvisionerAdditionalInfo(preference.getSshAccountProvisionerAdditionalInfo()); resource.save(); } } http://git-wip-us.apache.org/repos/asf/airavata/blob/71d33eaf/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/ComputeResourcePreference.java -- diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/ComputeResourcePreference.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/ComputeResourcePreference.java index 20f55d4..67402f4 100644 --- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/ComputeResourcePreference.java +++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/model/ComputeResourcePreference.java @@ -62,6 +62,8 @@ public class ComputeResourcePreference { private Timestamp reservationEndTime; @Column(name = "SSH_ACCOUNT_PROVISIONER") private String sshAccountProvisioner; +@Column(name = "SSH_ACCOUNT_PROVISIONER_ADDITIONAL_INFO") +private String sshAccountProvisionerAdditionalInfo; @ManyToOne(cascade= CascadeType.MERGE) @@ -227,4 +229,12 @@ public class ComputeResourcePreference { public void setSshAccountProvisionerConfigurations(Collection sshAccountProvisionerConfigurations) { this.sshAccountProvisionerConfigurations =
[22/40] airavata git commit: AIRAVATA-2500 SSHAccountManager bug fixes
AIRAVATA-2500 SSHAccountManager bug fixes Project: http://git-wip-us.apache.org/repos/asf/airavata/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/31f3906b Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/31f3906b Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/31f3906b Branch: refs/heads/develop Commit: 31f3906b6123bb1ce57cd9030f05f15d343cd9f9 Parents: 3184c23 Author: Marcus ChristieAuthored: Thu Sep 7 13:11:03 2017 -0400 Committer: Marcus Christie Committed: Tue Sep 19 15:08:05 2017 -0400 -- .../apache/airavata/accountprovisioning/SSHAccountManager.java | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) -- http://git-wip-us.apache.org/repos/asf/airavata/blob/31f3906b/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/SSHAccountManager.java -- diff --git a/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/SSHAccountManager.java b/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/SSHAccountManager.java index 8493dc1..70c144c 100644 --- a/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/SSHAccountManager.java +++ b/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/SSHAccountManager.java @@ -165,7 +165,7 @@ public class SSHAccountManager { PasswordCredential password = credentialStoreServiceClient.getPasswordCredential(configEntry.getValue(), gatewayId); resolvedConfig.put(configEntry.getKey(), password.getPassword()); } catch (TException e) { -throw new RuntimeException("Failed to get password needed to configure " + provisionerName); +throw new RuntimeException("Failed to get password needed to configure " + provisionerName, e); } } else { resolvedConfig.put(configEntry.getKey(), configEntry.getValue()); @@ -182,6 +182,8 @@ public class SSHAccountManager { } private static Map convertConfigParams(String provisionerName, Map thriftConfigParams) { +// TODO: also check that all required parameters are present? +// TODO: also, this doesn't handle optional entries which should be skipped if missing from thriftConfigParams List configParams = SSHAccountProvisionerFactory.getSSHAccountProvisionerConfigParams(provisionerName); Map configParamMap = configParams.stream().collect(Collectors.toMap(ConfigParam::getName, Function.identity())); @@ -204,7 +206,7 @@ public class SSHAccountManager { try { String credServerHost = ServerSettings.getCredentialStoreServerHost(); int credServerPort = Integer.valueOf(ServerSettings.getCredentialStoreServerPort()); -return CredentialStoreClientFactory.createAiravataCSClient(null, 0); +return CredentialStoreClientFactory.createAiravataCSClient(credServerHost, credServerPort); } catch (CredentialStoreException | ApplicationSettingsException e) { throw new RuntimeException("Failed to create credential store service client", e); }
[09/40] airavata git commit: AIRAVATA-2500: generated Thrift stub code
http://git-wip-us.apache.org/repos/asf/airavata/blob/722aabd4/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/appcatalog/accountprovisioning/SSHAccountProvisioner.java -- diff --git a/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/appcatalog/accountprovisioning/SSHAccountProvisioner.java b/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/appcatalog/accountprovisioning/SSHAccountProvisioner.java new file mode 100644 index 000..fb0a965 --- /dev/null +++ b/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/appcatalog/accountprovisioning/SSHAccountProvisioner.java @@ -0,0 +1,600 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * Autogenerated by Thrift Compiler (0.9.3) + * + * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING + * @generated + */ +package org.apache.airavata.model.appcatalog.accountprovisioning; + +import org.apache.thrift.scheme.IScheme; +import org.apache.thrift.scheme.SchemeFactory; +import org.apache.thrift.scheme.StandardScheme; + +import org.apache.thrift.scheme.TupleScheme; +import org.apache.thrift.protocol.TTupleProtocol; +import org.apache.thrift.protocol.TProtocolException; +import org.apache.thrift.EncodingUtils; +import org.apache.thrift.TException; +import org.apache.thrift.async.AsyncMethodCallback; +import org.apache.thrift.server.AbstractNonblockingServer.*; +import java.util.List; +import java.util.ArrayList; +import java.util.Map; +import java.util.HashMap; +import java.util.EnumMap; +import java.util.Set; +import java.util.HashSet; +import java.util.EnumSet; +import java.util.Collections; +import java.util.BitSet; +import java.nio.ByteBuffer; +import java.util.Arrays; +import javax.annotation.Generated; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) +@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)") +public class SSHAccountProvisioner implements org.apache.thrift.TBase, java.io.Serializable, Cloneable, Comparable { + private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("SSHAccountProvisioner"); + + private static final org.apache.thrift.protocol.TField NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("name", org.apache.thrift.protocol.TType.STRING, (short)1); + private static final org.apache.thrift.protocol.TField CAN_CREATE_ACCOUNT_FIELD_DESC = new org.apache.thrift.protocol.TField("canCreateAccount", org.apache.thrift.protocol.TType.BOOL, (short)2); + private static final org.apache.thrift.protocol.TField CAN_INSTALL_SSHKEY_FIELD_DESC = new org.apache.thrift.protocol.TField("canInstallSSHKey", org.apache.thrift.protocol.TType.BOOL, (short)3); + + private static final Map schemes = new HashMap (); + static { +schemes.put(StandardScheme.class, new SSHAccountProvisionerStandardSchemeFactory()); +schemes.put(TupleScheme.class, new SSHAccountProvisionerTupleSchemeFactory()); + } + + private String name; // required + private boolean canCreateAccount; // required + private boolean canInstallSSHKey; // required + + /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ + public enum _Fields implements org.apache.thrift.TFieldIdEnum { +NAME((short)1, "name"), +CAN_CREATE_ACCOUNT((short)2, "canCreateAccount"), +CAN_INSTALL_SSHKEY((short)3, "canInstallSSHKey"); + +private static final Map byName = new HashMap (); + +static { + for (_Fields field : EnumSet.allOf(_Fields.class)) { +byName.put(field.getFieldName(), field); + } +} + +/** + * Find the _Fields constant that matches fieldId, or null if its not found. + */ +public static _Fields findByThriftId(int fieldId) { + switch(fieldId) { +case 1: // NAME + return NAME; +case 2: // CAN_CREATE_ACCOUNT + return
[36/40] airavata git commit: AIRAVATA-2500 Returning/using username of cluster account
AIRAVATA-2500 Returning/using username of cluster account Project: http://git-wip-us.apache.org/repos/asf/airavata/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/50d7bb6a Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/50d7bb6a Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/50d7bb6a Branch: refs/heads/develop Commit: 50d7bb6a5b90966eb6cb78c1a5d95f7647345e1b Parents: ba4982c Author: Marcus ChristieAuthored: Mon Sep 25 16:17:54 2017 -0400 Committer: Marcus Christie Committed: Mon Sep 25 16:17:54 2017 -0400 -- .../accountprovisioning/SSHAccountManager.java | 45 ++-- .../SSHAccountProvisioner.java | 6 ++- .../IULdapSSHAccountProvisioner.java| 5 ++- .../provisioner/TestSSHAccountProvisioner.java | 6 ++- 4 files changed, 44 insertions(+), 18 deletions(-) -- http://git-wip-us.apache.org/repos/asf/airavata/blob/50d7bb6a/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/SSHAccountManager.java -- diff --git a/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/SSHAccountManager.java b/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/SSHAccountManager.java index 136bbee..d6b9eb1 100644 --- a/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/SSHAccountManager.java +++ b/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/SSHAccountManager.java @@ -50,7 +50,16 @@ public class SSHAccountManager { private final static Logger logger = LoggerFactory.getLogger(SSHAccountManager.class); -public static boolean doesUserHaveSSHAccount(String gatewayId, String computeResourceId, String username) throws InvalidSetupException, InvalidUsernameException { +/** + * Check if user has an SSH account on the compute resource. + * @param gatewayId + * @param computeResourceId + * @param userId Airavata user id + * @return + * @throws InvalidSetupException + * @throws InvalidUsernameException + */ +public static boolean doesUserHaveSSHAccount(String gatewayId, String computeResourceId, String userId) throws InvalidSetupException, InvalidUsernameException { // get compute resource preferences for the gateway and hostname RegistryService.Client registryServiceClient = getRegistryServiceClient(); @@ -75,15 +84,25 @@ public class SSHAccountManager { SSHAccountProvisioner sshAccountProvisioner = createSshAccountProvisioner(gatewayId, computeResourcePreference); try { -return sshAccountProvisioner.hasAccount(username); +return sshAccountProvisioner.hasAccount(userId); } catch (InvalidUsernameException e) { throw e; } catch (Exception e) { -throw new RuntimeException("hasAccount call failed for username [" + username + "]: " + e.getMessage(), e); +throw new RuntimeException("hasAccount call failed for userId [" + userId + "]: " + e.getMessage(), e); } } -public static UserComputeResourcePreference setupSSHAccount(String gatewayId, String computeResourceId, String username, SSHCredential sshCredential) throws InvalidSetupException, InvalidUsernameException { +/** + * Add SSH key to compute resource on behalf of user. + * @param gatewayId + * @param computeResourceId + * @param userId Airavata user id + * @param sshCredential + * @return a populated but not persisted UserComputeResourcePreference instance + * @throws InvalidSetupException + * @throws InvalidUsernameException + */ +public static UserComputeResourcePreference setupSSHAccount(String gatewayId, String computeResourceId, String userId, SSHCredential sshCredential) throws InvalidSetupException, InvalidUsernameException { // get compute resource preferences for the gateway and hostname RegistryService.Client registryServiceClient = getRegistryServiceClient(); @@ -127,32 +146,34 @@ public class SSHAccountManager { SSHAccountProvisioner sshAccountProvisioner = createSshAccountProvisioner(gatewayId, computeResourcePreference); boolean canCreateAccount = SSHAccountProvisionerFactory.canCreateAccount(computeResourcePreference.getSshAccountProvisioner()); -// First check if username has an account +// First check if userId has an account boolean hasAccount = false; try { -hasAccount = sshAccountProvisioner.hasAccount(username); +hasAccount = sshAccountProvisioner.hasAccount(userId); }
[23/40] airavata git commit: AIRAVATA-2500 Thrift stub code generation
http://git-wip-us.apache.org/repos/asf/airavata/blob/3184c238/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/Model/AppCatalog/GatewayProfile/Types.php -- diff --git a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/Model/AppCatalog/GatewayProfile/Types.php b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/Model/AppCatalog/GatewayProfile/Types.php index f0b329d..da3071a 100644 --- a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/Model/AppCatalog/GatewayProfile/Types.php +++ b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/Model/AppCatalog/GatewayProfile/Types.php @@ -110,6 +110,14 @@ class ComputeResourcePreference { * @var int */ public $reservationEndTime = null; + /** + * @var string + */ + public $sshAccountProvisioner = null; + /** + * @var array + */ + public $sshAccountProvisionerConfig = null; public function __construct($vals=null) { if (!isset(self::$_TSPEC)) { @@ -170,6 +178,22 @@ class ComputeResourcePreference { 'var' => 'reservationEndTime', 'type' => TType::I64, ), +15 => array( + 'var' => 'sshAccountProvisioner', + 'type' => TType::STRING, + ), +16 => array( + 'var' => 'sshAccountProvisionerConfig', + 'type' => TType::MAP, + 'ktype' => TType::STRING, + 'vtype' => TType::STRING, + 'key' => array( +'type' => TType::STRING, + ), + 'val' => array( +'type' => TType::STRING, +), + ), ); } if (is_array($vals)) { @@ -215,6 +239,12 @@ class ComputeResourcePreference { if (isset($vals['reservationEndTime'])) { $this->reservationEndTime = $vals['reservationEndTime']; } + if (isset($vals['sshAccountProvisioner'])) { +$this->sshAccountProvisioner = $vals['sshAccountProvisioner']; + } + if (isset($vals['sshAccountProvisionerConfig'])) { +$this->sshAccountProvisionerConfig = $vals['sshAccountProvisionerConfig']; + } } } @@ -335,6 +365,33 @@ class ComputeResourcePreference { $xfer += $input->skip($ftype); } break; +case 15: + if ($ftype == TType::STRING) { +$xfer += $input->readString($this->sshAccountProvisioner); + } else { +$xfer += $input->skip($ftype); + } + break; +case 16: + if ($ftype == TType::MAP) { +$this->sshAccountProvisionerConfig = array(); +$_size0 = 0; +$_ktype1 = 0; +$_vtype2 = 0; +$xfer += $input->readMapBegin($_ktype1, $_vtype2, $_size0); +for ($_i4 = 0; $_i4 < $_size0; ++$_i4) +{ + $key5 = ''; + $val6 = ''; + $xfer += $input->readString($key5); + $xfer += $input->readString($val6); + $this->sshAccountProvisionerConfig[$key5] = $val6; +} +$xfer += $input->readMapEnd(); + } else { +$xfer += $input->skip($ftype); + } + break; default: $xfer += $input->skip($ftype); break; @@ -418,6 +475,29 @@ class ComputeResourcePreference { $xfer += $output->writeI64($this->reservationEndTime); $xfer += $output->writeFieldEnd(); } +if ($this->sshAccountProvisioner !== null) { + $xfer += $output->writeFieldBegin('sshAccountProvisioner', TType::STRING, 15); + $xfer += $output->writeString($this->sshAccountProvisioner); + $xfer += $output->writeFieldEnd(); +} +if ($this->sshAccountProvisionerConfig !== null) { + if (!is_array($this->sshAccountProvisionerConfig)) { +throw new TProtocolException('Bad type in structure.', TProtocolException::INVALID_DATA); + } + $xfer += $output->writeFieldBegin('sshAccountProvisionerConfig', TType::MAP, 16); + { +$output->writeMapBegin(TType::STRING, TType::STRING, count($this->sshAccountProvisionerConfig)); +{ + foreach ($this->sshAccountProvisionerConfig as $kiter7 => $viter8) + { +$xfer += $output->writeString($kiter7); +$xfer += $output->writeString($viter8); + } +} +$output->writeMapEnd(); + } + $xfer += $output->writeFieldEnd(); +} $xfer += $output->writeFieldStop(); $xfer += $output->writeStructEnd(); return $xfer; @@ -711,15 +791,15 @@ class GatewayResourceProfile { case 3: if ($ftype == TType::LST) { $this->computeResourcePreferences = array(); -$_size0 = 0; -$_etype3 = 0; -$xfer +=
[31/40] airavata git commit: AIRAVATA-2500 Fix bug deriving ssh hostname
AIRAVATA-2500 Fix bug deriving ssh hostname Project: http://git-wip-us.apache.org/repos/asf/airavata/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/596eb5ba Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/596eb5ba Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/596eb5ba Branch: refs/heads/develop Commit: 596eb5ba21bec45cdd5eb92a7b09f0249eddcceb Parents: 8f68bc1 Author: Marcus ChristieAuthored: Mon Sep 25 09:24:41 2017 -0400 Committer: Marcus Christie Committed: Mon Sep 25 09:42:24 2017 -0400 -- .../airavata/accountprovisioning/SSHAccountManager.java | 9 + 1 file changed, 9 insertions(+) -- http://git-wip-us.apache.org/repos/asf/airavata/blob/596eb5ba/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/SSHAccountManager.java -- diff --git a/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/SSHAccountManager.java b/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/SSHAccountManager.java index 61deb49..e7e9052 100644 --- a/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/SSHAccountManager.java +++ b/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/SSHAccountManager.java @@ -183,6 +183,15 @@ public class SSHAccountManager { return userComputeResourcePreference; } +private static String getSSHHostname(ComputeResourceDescription computeResourceDescription, SSHJobSubmission sshJobSubmission) { +String alternativeSSHHostName = sshJobSubmission.getAlternativeSSHHostName(); +if (alternativeSSHHostName != null && !"".equals(alternativeSSHHostName.trim())) { +return alternativeSSHHostName; +} else { +return computeResourceDescription.getHostName(); +} +} + private static SSHAccountProvisioner createSshAccountProvisioner(String gatewayId, ComputeResourcePreference computeResourcePreference) throws InvalidSetupException { String provisionerName = computeResourcePreference.getSshAccountProvisioner(); Map provisionerConfig = convertConfigParams(provisionerName, computeResourcePreference.getSshAccountProvisionerConfig());
[02/40] airavata git commit: AIRAVATA-2500 Initial interfaces, APIs for account provisioning
AIRAVATA-2500 Initial interfaces, APIs for account provisioning Project: http://git-wip-us.apache.org/repos/asf/airavata/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/1c39e2ea Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/1c39e2ea Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/1c39e2ea Branch: refs/heads/develop Commit: 1c39e2ea715f736d25d874c36a519ee0ed250162 Parents: 6488090 Author: Marcus ChristieAuthored: Wed Aug 9 15:54:07 2017 -0400 Committer: Marcus Christie Committed: Tue Sep 19 15:07:40 2017 -0400 -- modules/compute-account-provisioning/pom.xml| 67 + .../accountprovisioning/ConfigParam.java| 67 + .../accountprovisioning/SSHAccountManager.java | 69 ++ .../SSHAccountProvisioner.java | 43 +++ .../SSHAccountProvisionerFactory.java | 49 + .../IULdapSSHAccountProvisioner.java| 75 ...ta.accountprovisioning.SSHAccountProvisioner | 22 ++ pom.xml | 1 + .../airavata-apis/airavata_api.thrift | 11 +++ .../account_provisioning_model.thrift | 40 +++ .../gateway_resource_profile_model.thrift | 5 +- 11 files changed, 448 insertions(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/airavata/blob/1c39e2ea/modules/compute-account-provisioning/pom.xml -- diff --git a/modules/compute-account-provisioning/pom.xml b/modules/compute-account-provisioning/pom.xml new file mode 100644 index 000..ee89d33 --- /dev/null +++ b/modules/compute-account-provisioning/pom.xml @@ -0,0 +1,67 @@ + + + +http://maven.apache.org/POM/4.0.0; + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance; + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd;> + +airavata +org.apache.airavata +0.17-SNAPSHOT +../../pom.xml + +4.0.0 + +compute-account-provisioning + + + +airavata-credential-store +org.apache.airavata +${project.version} + + +registry-api-stubs +org.apache.airavata +${project.version} + + +com.jcraft +jsch +0.1.50 + + +org.slf4j +slf4j-api + + +junit +junit +test + + +com.google.code.gson +gson +2.3.1 + + + + \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/1c39e2ea/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/ConfigParam.java -- diff --git a/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/ConfigParam.java b/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/ConfigParam.java new file mode 100644 index 000..beb8bbc --- /dev/null +++ b/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/ConfigParam.java @@ -0,0 +1,67 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ + +package org.apache.airavata.accountprovisioning; + +public class ConfigParam { + +public enum ConfigParamType { +STRING, +CRED_TOKEN, +} + +private boolean optional = false; +private String name; +private String description; +private ConfigParamType type = ConfigParamType.STRING; + +public boolean isOptional() { +return optional; +} + +public void setOptional(boolean optional) { +this.optional = optional; +} + +public String getName() { +return name; +} + +public void setName(String name)
[14/40] airavata git commit: AIRAVATA-2500 Implement API method to get provisioner metadata
AIRAVATA-2500 Implement API method to get provisioner metadata Project: http://git-wip-us.apache.org/repos/asf/airavata/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/643d35b3 Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/643d35b3 Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/643d35b3 Branch: refs/heads/develop Commit: 643d35b3884d1014a47c3a1b50fc6580d0dabeb1 Parents: 469a7e7 Author: Marcus ChristieAuthored: Thu Sep 7 09:41:17 2017 -0400 Committer: Marcus Christie Committed: Tue Sep 19 15:07:57 2017 -0400 -- .../server/handler/AiravataServerHandler.java | 56 ++-- .../accountprovisioning/SSHAccountManager.java | 3 +- .../SSHAccountProvisioner.java | 10 ++-- .../SSHAccountProvisionerFactory.java | 14 ++--- .../SSHAccountProvisionerProvider.java | 3 +- .../IULdapSSHAccountProvisioner.java| 10 .../IULdapSSHAccountProvisionerProvider.java| 31 ++- .../SSHAccountProvisionerFactoryTest.java | 4 +- .../provisioner/TestSSHAccountProvisioner.java | 10 .../TestSSHAccountProvisionerProvider.java | 10 .../airavata-apis/airavata_api.thrift | 12 ++--- .../account_provisioning_model.thrift | 12 +++-- 12 files changed, 107 insertions(+), 68 deletions(-) -- http://git-wip-us.apache.org/repos/asf/airavata/blob/643d35b3/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java -- diff --git a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java index bb3f2c0..febb703 100644 --- a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java +++ b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java @@ -19,7 +19,10 @@ */ package org.apache.airavata.api.server.handler; +import org.apache.airavata.accountprovisioning.ConfigParam; import org.apache.airavata.accountprovisioning.SSHAccountManager; +import org.apache.airavata.accountprovisioning.SSHAccountProvisionerFactory; +import org.apache.airavata.accountprovisioning.SSHAccountProvisionerProvider; import org.apache.airavata.api.Airavata; import org.apache.airavata.api.airavata_apiConstants; import org.apache.airavata.api.server.util.ThriftClientPool; @@ -38,6 +41,7 @@ import org.apache.airavata.messaging.core.Type; import org.apache.airavata.model.WorkflowModel; import org.apache.airavata.model.appcatalog.accountprovisioning.SSHAccountProvisioner; import org.apache.airavata.model.appcatalog.accountprovisioning.SSHAccountProvisionerConfigParam; +import org.apache.airavata.model.appcatalog.accountprovisioning.SSHAccountProvisionerConfigParamType; import org.apache.airavata.model.appcatalog.appdeployment.ApplicationDeploymentDescription; import org.apache.airavata.model.appcatalog.appdeployment.ApplicationModule; import org.apache.airavata.model.appcatalog.appinterface.ApplicationInterfaceDescription; @@ -3969,30 +3973,48 @@ public class AiravataServerHandler implements Airavata.Iface { @Override @SecurityCheck -public List getSSHAccountProvisionerNames(AuthzToken authzToken) throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException, TException { +public List getSSHAccountProvisioners(AuthzToken authzToken) throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException, TException { -// TODO: implement -return null; -} - -@Override -@SecurityCheck -public List getSSHAccountProvisionerConfigParams(AuthzToken authzToken, String provisionerName) throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException, TException { - -// TODO: implement -return null; +List sshAccountProvisioners = new ArrayList<>(); +List sshAccountProvisionerProviders = SSHAccountProvisionerFactory.getSSHAccountProvisionerProviders(); +for (SSHAccountProvisionerProvider provider : sshAccountProvisionerProviders) { +// TODO: Move this Thrift conversion to utility class +SSHAccountProvisioner sshAccountProvisioner = new SSHAccountProvisioner(); + sshAccountProvisioner.setCanCreateAccount(provider.canCreateAccount()); + sshAccountProvisioner.setCanInstallSSHKey(provider.canInstallSSHKey()); +
[08/40] airavata git commit: AIRAVATA-2500 Update thrift API and regenerated
AIRAVATA-2500 Update thrift API and regenerated Project: http://git-wip-us.apache.org/repos/asf/airavata/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/2a901394 Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/2a901394 Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/2a901394 Branch: refs/heads/develop Commit: 2a90139402c9c82350138adc4dc3bc59d56cee93 Parents: 77baac4 Author: Marcus ChristieAuthored: Mon Aug 14 12:36:19 2017 -0400 Committer: Marcus Christie Committed: Tue Sep 19 15:07:56 2017 -0400 -- .../java/org/apache/airavata/api/Airavata.java | 35330 + .../ComputeResourcePreference.java | 285 +- .../gatewayprofile/GatewayResourceProfile.java |72 +- .../account_provisioning_model.thrift | 2 +- .../gateway_resource_profile_model.thrift | 2 +- 5 files changed, 19411 insertions(+), 16280 deletions(-) --
[06/40] airavata git commit: AIRAVATA-2500 Update thrift API and regenerated
http://git-wip-us.apache.org/repos/asf/airavata/blob/2a901394/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/appcatalog/gatewayprofile/ComputeResourcePreference.java -- diff --git a/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/appcatalog/gatewayprofile/ComputeResourcePreference.java b/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/appcatalog/gatewayprofile/ComputeResourcePreference.java index b1c092b..0d52abb 100644 --- a/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/appcatalog/gatewayprofile/ComputeResourcePreference.java +++ b/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/appcatalog/gatewayprofile/ComputeResourcePreference.java @@ -103,6 +103,8 @@ public class ComputeResourcePreference implements org.apache.thrift.TBase, SchemeFactory> schemes = new HashMap(); static { @@ -124,6 +126,8 @@ public class ComputeResourcePreference implements org.apache.thrift.TBase sshAccountProvisionerConfig; // optional /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ public enum _Fields implements org.apache.thrift.TFieldIdEnum { @@ -148,7 +152,9 @@ public class ComputeResourcePreference implements org.apache.thrift.TBase byName = new HashMap (); @@ -191,6 +197,10 @@ public class ComputeResourcePreference implements org.apache.thrift.TBase metaDataMap; static { Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class); @@ -267,6 +277,12 @@ public class ComputeResourcePreference implements org.apache.thrift.TBase __this__sshAccountProvisionerConfig = new HashMap (other.sshAccountProvisionerConfig.size()); + for (Map.Entry other_element : other.sshAccountProvisionerConfig.entrySet()) { + + org.apache.airavata.model.appcatalog.accountprovisioning.SSHAccountProvisionerConfigParam other_element_key = other_element.getKey(); +String other_element_value = other_element.getValue(); + + org.apache.airavata.model.appcatalog.accountprovisioning.SSHAccountProvisionerConfigParam __this__sshAccountProvisionerConfig_copy_key = new org.apache.airavata.model.appcatalog.accountprovisioning.SSHAccountProvisionerConfigParam(other_element_key); + +String __this__sshAccountProvisionerConfig_copy_value = other_element_value; + + __this__sshAccountProvisionerConfig.put(__this__sshAccountProvisionerConfig_copy_key, __this__sshAccountProvisionerConfig_copy_value); + } + this.sshAccountProvisionerConfig = __this__sshAccountProvisionerConfig; +} } public ComputeResourcePreference deepCopy() { @@ -352,6 +386,8 @@ public class ComputeResourcePreference implements org.apache.thrift.TBase(); +} +this.sshAccountProvisionerConfig.put(key, val); + } + + public Map getSshAccountProvisionerConfig() { +return this.sshAccountProvisionerConfig; + } + + public void setSshAccountProvisionerConfig(Map sshAccountProvisionerConfig) { +this.sshAccountProvisionerConfig = sshAccountProvisionerConfig; + } + + public void unsetSshAccountProvisionerConfig() { +this.sshAccountProvisionerConfig = null; + } + + /** Returns true if field sshAccountProvisionerConfig is set (has been assigned a value) and false otherwise */ + public boolean isSetSshAccountProvisionerConfig() { +return this.sshAccountProvisionerConfig != null; + } + + public void setSshAccountProvisionerConfigIsSet(boolean value) { +if (!value) { + this.sshAccountProvisionerConfig = null; +} + } + public void setFieldValue(_Fields field, Object value) { switch (field) { case COMPUTE_RESOURCE_ID: @@ -803,6 +896,22 @@ public class ComputeResourcePreference implements org.apache.thrift.TBase)value); + } + break; + } } @@ -850,6 +959,12 @@ public class ComputeResourcePreference implements org.apache.thrift.TBase(2*_map0.size); + org.apache.airavata.model.appcatalog.accountprovisioning.SSHAccountProvisionerConfigParam _key1; +String _val2; +for (int _i3 = 0; _i3 < _map0.size; ++_i3) +{ + _key1 = new org.apache.airavata.model.appcatalog.accountprovisioning.SSHAccountProvisionerConfigParam(); + _key1.read(iprot); + _val2 =
[11/40] airavata git commit: AIRAVATA-2500: generated Thrift stub code
AIRAVATA-2500: generated Thrift stub code Project: http://git-wip-us.apache.org/repos/asf/airavata/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/722aabd4 Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/722aabd4 Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/722aabd4 Branch: refs/heads/develop Commit: 722aabd4c4fcde001ace20416ea16027a1299224 Parents: 8f2f135 Author: Marcus ChristieAuthored: Thu Aug 31 09:17:23 2017 -0400 Committer: Marcus Christie Committed: Tue Sep 19 15:07:56 2017 -0400 -- .../java/org/apache/airavata/api/Airavata.java | 4698 +++--- .../SSHAccountProvisioner.java | 600 +++ .../SSHAccountProvisionerConfigParam.java | 733 +++ .../SSHAccountProvisionerConfigParamType.java | 62 + 4 files changed, 5345 insertions(+), 748 deletions(-) --
[17/40] airavata git commit: AIRAVATA-2500 Thrift stub generation
AIRAVATA-2500 Thrift stub generation Project: http://git-wip-us.apache.org/repos/asf/airavata/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/469a7e79 Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/469a7e79 Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/469a7e79 Branch: refs/heads/develop Commit: 469a7e791db59ca277685f47a422e8805d3c4042 Parents: ac2823a Author: Marcus ChristieAuthored: Fri Sep 1 17:12:46 2017 -0400 Committer: Marcus Christie Committed: Tue Sep 19 15:07:57 2017 -0400 -- .../java/org/apache/airavata/api/Airavata.java | 782 +-- .../ComputeResourcePreference.java | 78 +- 2 files changed, 415 insertions(+), 445 deletions(-) --
[13/40] airavata git commit: AIRAVATA-2500 Finish implementing SSHAccountManager
AIRAVATA-2500 Finish implementing SSHAccountManager Project: http://git-wip-us.apache.org/repos/asf/airavata/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/0d1e90f6 Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/0d1e90f6 Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/0d1e90f6 Branch: refs/heads/develop Commit: 0d1e90f612831337588867f2589819eefcadde0a Parents: 8c748c6 Author: Marcus ChristieAuthored: Thu Aug 24 14:23:10 2017 -0400 Committer: Marcus Christie Committed: Tue Sep 19 15:07:56 2017 -0400 -- .../accountprovisioning/SSHAccountManager.java | 41 ++-- 1 file changed, 30 insertions(+), 11 deletions(-) -- http://git-wip-us.apache.org/repos/asf/airavata/blob/0d1e90f6/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/SSHAccountManager.java -- diff --git a/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/SSHAccountManager.java b/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/SSHAccountManager.java index a56a632..ec7cfc1 100644 --- a/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/SSHAccountManager.java +++ b/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/SSHAccountManager.java @@ -27,7 +27,11 @@ import org.apache.airavata.credential.store.cpi.CredentialStoreService; import org.apache.airavata.credential.store.exception.CredentialStoreException; import org.apache.airavata.model.appcatalog.accountprovisioning.SSHAccountProvisionerConfigParam; import org.apache.airavata.model.appcatalog.computeresource.ComputeResourceDescription; +import org.apache.airavata.model.appcatalog.computeresource.JobSubmissionInterface; +import org.apache.airavata.model.appcatalog.computeresource.JobSubmissionProtocol; +import org.apache.airavata.model.appcatalog.computeresource.SSHJobSubmission; import org.apache.airavata.model.appcatalog.gatewayprofile.ComputeResourcePreference; +import org.apache.airavata.model.appcatalog.userresourceprofile.UserComputeResourcePreference; import org.apache.airavata.model.credential.store.PasswordCredential; import org.apache.airavata.model.credential.store.SSHCredential; import org.apache.airavata.registry.api.RegistryService; @@ -47,24 +51,37 @@ public class SSHAccountManager { private final static Logger logger = LoggerFactory.getLogger(SSHAccountManager.class); -// TODO: change return type to one that returns some details of the SSH account setup, for example the scratch location -public static void setupSSHAccount(String gatewayId, String computeResourceId, String username, SSHCredential sshCredential) { +public static UserComputeResourcePreference setupSSHAccount(String gatewayId, String computeResourceId, String username, SSHCredential sshCredential) { // get compute resource preferences for the gateway and hostname -// TODO: close the registry service client transport when done with it RegistryService.Client registryServiceClient = getRegistryServiceClient(); ComputeResourcePreference computeResourcePreference = null; ComputeResourceDescription computeResourceDescription = null; +SSHJobSubmission sshJobSubmission = null; try { computeResourcePreference = registryServiceClient.getGatewayComputeResourcePreference(gatewayId, computeResourceId); computeResourceDescription = registryServiceClient.getComputeResource(computeResourceId); +// Find the SSHJobSubmission +for (JobSubmissionInterface jobSubmissionInterface : computeResourceDescription.getJobSubmissionInterfaces()) { +if (jobSubmissionInterface.getJobSubmissionProtocol() == JobSubmissionProtocol.SSH) { +sshJobSubmission = registryServiceClient.getSSHJobSubmission(jobSubmissionInterface.getJobSubmissionInterfaceId()); +break; +} +} } catch(TException e) { throw new RuntimeException(e); +} finally { +if (registryServiceClient.getInputProtocol().getTransport().isOpen()) { + registryServiceClient.getInputProtocol().getTransport().close(); +} +} + +if (sshJobSubmission == null) { +throw new RuntimeException("Compute resource [" + computeResourceId + "] does not have an SSH Job Submission interface."); } // get the account provisioner and config values for the preferences if (!computeResourcePreference.isSetSshAccountProvisioner()) { -
[37/40] airavata git commit: Merge branch 'AIRAVATA-2500' into develop
http://git-wip-us.apache.org/repos/asf/airavata/blob/ebdf8977/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/appcatalog/gatewayprofile/ComputeResourcePreference.java -- diff --cc airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/appcatalog/gatewayprofile/ComputeResourcePreference.java index 50d368c,d758e9d..3bcd153 --- a/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/appcatalog/gatewayprofile/ComputeResourcePreference.java +++ b/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/appcatalog/gatewayprofile/ComputeResourcePreference.java @@@ -76,24 -103,33 +76,30 @@@ public class ComputeResourcePreference private static final org.apache.thrift.protocol.TField RESERVATION_FIELD_DESC = new org.apache.thrift.protocol.TField("reservation", org.apache.thrift.protocol.TType.STRING, (short)12); private static final org.apache.thrift.protocol.TField RESERVATION_START_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("reservationStartTime", org.apache.thrift.protocol.TType.I64, (short)13); private static final org.apache.thrift.protocol.TField RESERVATION_END_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("reservationEndTime", org.apache.thrift.protocol.TType.I64, (short)14); + private static final org.apache.thrift.protocol.TField SSH_ACCOUNT_PROVISIONER_FIELD_DESC = new org.apache.thrift.protocol.TField("sshAccountProvisioner", org.apache.thrift.protocol.TType.STRING, (short)15); + private static final org.apache.thrift.protocol.TField SSH_ACCOUNT_PROVISIONER_CONFIG_FIELD_DESC = new org.apache.thrift.protocol.TField("sshAccountProvisionerConfig", org.apache.thrift.protocol.TType.MAP, (short)16); + private static final org.apache.thrift.protocol.TField SSH_ACCOUNT_PROVISIONER_ADDITIONAL_INFO_FIELD_DESC = new org.apache.thrift.protocol.TField("sshAccountProvisionerAdditionalInfo", org.apache.thrift.protocol.TType.STRING, (short)17); - private static final Mapschemes = new HashMap (); - static { -schemes.put(StandardScheme.class, new ComputeResourcePreferenceStandardSchemeFactory()); -schemes.put(TupleScheme.class, new ComputeResourcePreferenceTupleSchemeFactory()); - } + private static final org.apache.thrift.scheme.SchemeFactory STANDARD_SCHEME_FACTORY = new ComputeResourcePreferenceStandardSchemeFactory(); + private static final org.apache.thrift.scheme.SchemeFactory TUPLE_SCHEME_FACTORY = new ComputeResourcePreferenceTupleSchemeFactory(); - private String computeResourceId; // required + private java.lang.String computeResourceId; // required private boolean overridebyAiravata; // required - private String loginUserName; // optional + private java.lang.String loginUserName; // optional private org.apache.airavata.model.appcatalog.computeresource.JobSubmissionProtocol preferredJobSubmissionProtocol; // optional private org.apache.airavata.model.data.movement.DataMovementProtocol preferredDataMovementProtocol; // optional - private String preferredBatchQueue; // optional - private String scratchLocation; // optional - private String allocationProjectNumber; // optional - private String resourceSpecificCredentialStoreToken; // optional - private String usageReportingGatewayId; // optional - private String qualityOfService; // optional - private String reservation; // optional + private java.lang.String preferredBatchQueue; // optional + private java.lang.String scratchLocation; // optional + private java.lang.String allocationProjectNumber; // optional + private java.lang.String resourceSpecificCredentialStoreToken; // optional + private java.lang.String usageReportingGatewayId; // optional + private java.lang.String qualityOfService; // optional + private java.lang.String reservation; // optional private long reservationStartTime; // optional private long reservationEndTime; // optional - private String sshAccountProvisioner; // optional - private Map sshAccountProvisionerConfig; // optional - private String sshAccountProvisionerAdditionalInfo; // optional ++ private java.lang.String sshAccountProvisioner; // optional ++ private java.util.Map sshAccountProvisionerConfig; // optional ++ private java.lang.String sshAccountProvisionerAdditionalInfo; // optional /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ public enum _Fields implements org.apache.thrift.TFieldIdEnum { @@@ -118,12 -154,15 +124,15 @@@ QUALITY_OF_SERVICE((short)11, "qualityOfService"), RESERVATION((short)12, "reservation"), RESERVATION_START_TIME((short)13, "reservationStartTime"), - RESERVATION_END_TIME((short)14, "reservationEndTime"); +
[34/40] airavata git commit: AIRAVATA-2500 fixing order of arguments
AIRAVATA-2500 fixing order of arguments Project: http://git-wip-us.apache.org/repos/asf/airavata/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/29fedaf5 Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/29fedaf5 Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/29fedaf5 Branch: refs/heads/develop Commit: 29fedaf52435c5ab97b524298bfa52a476fd80ce Parents: e5dcade Author: Marcus ChristieAuthored: Mon Sep 25 10:33:24 2017 -0400 Committer: Marcus Christie Committed: Mon Sep 25 10:33:24 2017 -0400 -- .../main/java/org/apache/airavata/accountprovisioning/SSHUtil.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- http://git-wip-us.apache.org/repos/asf/airavata/blob/29fedaf5/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/SSHUtil.java -- diff --git a/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/SSHUtil.java b/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/SSHUtil.java index 4ac60bf..f823648 100644 --- a/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/SSHUtil.java +++ b/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/SSHUtil.java @@ -148,7 +148,7 @@ public class SSHUtil { } catch (IOException e) { throw new RuntimeException(e); } -boolean result = validate(username, hostname, 22, sshCredential); +boolean result = validate(hostname, 22, username, sshCredential); System.out.println(result); } }
[33/40] airavata git commit: AIRAVATA-2500 Thrift stub code generation
AIRAVATA-2500 Thrift stub code generation Project: http://git-wip-us.apache.org/repos/asf/airavata/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/e5dcade0 Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/e5dcade0 Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/e5dcade0 Branch: refs/heads/develop Commit: e5dcade08f7a91bf7bd135647358202475f37620 Parents: 20fc3fd Author: Marcus ChristieAuthored: Mon Sep 25 09:45:47 2017 -0400 Committer: Marcus Christie Committed: Mon Sep 25 09:57:28 2017 -0400 -- .../resources/lib/Airavata/API/Airavata.php | 10 ++ .../AppCatalog/UserResourceProfile/Types.php| 28 + .../UserComputeResourcePreference.java | 114 ++- 3 files changed, 148 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/airavata/blob/e5dcade0/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/API/Airavata.php -- diff --git a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/API/Airavata.php b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/API/Airavata.php index c8976ba..a22ef84 100644 --- a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/API/Airavata.php +++ b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/API/Airavata.php @@ -3485,6 +3485,11 @@ interface AiravataIf { * Resource specific credential store token. If this token is specified, then it is superceeded by the gateway's * default credential store. * + * validated: + * If true the the configuration has been validated in the sense that the username and credential can be used to + * login to the remote host and the scratchLocation is a valid location that the user has permission to write to. + * Should be treated as read-only and only mutated by Airavata middleware. + * * * @throws \Airavata\API\Error\InvalidRequestException * @throws \Airavata\API\Error\AiravataClientException @@ -3717,6 +3722,11 @@ interface AiravataIf { * Resource specific credential store token. If this token is specified, then it is superceeded by the gateway's * default credential store. * + * validated: + * If true the the configuration has been validated in the sense that the username and credential can be used to + * login to the remote host and the scratchLocation is a valid location that the user has permission to write to. + * Should be treated as read-only and only mutated by Airavata middleware. + * * * @throws \Airavata\API\Error\InvalidRequestException * @throws \Airavata\API\Error\AiravataClientException http://git-wip-us.apache.org/repos/asf/airavata/blob/e5dcade0/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/Model/AppCatalog/UserResourceProfile/Types.php -- diff --git a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/Model/AppCatalog/UserResourceProfile/Types.php b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/Model/AppCatalog/UserResourceProfile/Types.php index 8ab78a0..c4a0a9c 100644 --- a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/Model/AppCatalog/UserResourceProfile/Types.php +++ b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/Model/AppCatalog/UserResourceProfile/Types.php @@ -43,6 +43,11 @@ use Thrift\Exception\TApplicationException; * Resource specific credential store token. If this token is specified, then it is superceeded by the gateway's * default credential store. * + * validated: + * If true the the configuration has been validated in the sense that the username and credential can be used to + * login to the remote host and the scratchLocation is a valid location that the user has permission to write to. + * Should be treated as read-only and only mutated by Airavata middleware. + * */ class UserComputeResourcePreference { static $_TSPEC; @@ -87,6 +92,10 @@ class UserComputeResourcePreference { * @var int */ public $reservationEndTime = null; + /** + * @var bool + */ + public $validated = false; public function __construct($vals=null) { if (!isset(self::$_TSPEC)) { @@ -131,6 +140,10 @@ class UserComputeResourcePreference { 'var' => 'reservationEndTime', 'type' => TType::I64, ), +11 => array( + 'var' => 'validated', + 'type' => TType::BOOL, + ), ); }
[21/40] airavata git commit: Integrate IULdapSSHAccountProvisioner with fixes
Integrate IULdapSSHAccountProvisioner with fixes Project: http://git-wip-us.apache.org/repos/asf/airavata/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/74371129 Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/74371129 Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/74371129 Branch: refs/heads/develop Commit: 743711290ee07336005ee7a4d023cdce5325a6f6 Parents: 1c2ab27 Author: Marcus ChristieAuthored: Mon Sep 18 15:12:16 2017 -0400 Committer: Marcus Christie Committed: Tue Sep 19 15:08:05 2017 -0400 -- .../IULdapSSHAccountProvisioner.java| 242 ++- .../IULdapSSHAccountProvisionerProvider.java| 47 ++-- .../SSHAccountProvisionerFactoryTest.java | 4 - .../TestSSHAccountProvisionerProvider.java | 2 +- 4 files changed, 153 insertions(+), 142 deletions(-) -- http://git-wip-us.apache.org/repos/asf/airavata/blob/74371129/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/provisioner/IULdapSSHAccountProvisioner.java -- diff --git a/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/provisioner/IULdapSSHAccountProvisioner.java b/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/provisioner/IULdapSSHAccountProvisioner.java index 331c01c..d0c204f 100644 --- a/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/provisioner/IULdapSSHAccountProvisioner.java +++ b/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/provisioner/IULdapSSHAccountProvisioner.java @@ -21,152 +21,158 @@ package org.apache.airavata.accountprovisioning.provisioner; import org.apache.airavata.accountprovisioning.ConfigParam; +import org.apache.airavata.accountprovisioning.SSHAccountManager; import org.apache.airavata.accountprovisioning.SSHAccountProvisioner; -import org.apache.directory.api.ldap.model.cursor.CursorException; -import org.apache.directory.ldap.client.api.*; -import org.apache.directory.api.ldap.model.cursor.EntryCursor; -import org.apache.directory.api.ldap.model.entry.Attribute; +import org.apache.directory.api.ldap.model.entry.DefaultAttribute; import org.apache.directory.api.ldap.model.entry.Entry; -import org.apache.directory.api.ldap.model.entry.Modification; -import org.apache.directory.api.ldap.model.entry.DefaultEntry; +import org.apache.directory.api.ldap.model.entry.ModificationOperation; import org.apache.directory.api.ldap.model.exception.LdapException; -import org.apache.directory.api.ldap.model.message.SearchScope; -import org.apache.directory.api.ldap.model.message.DeleteResponse; +import org.apache.directory.api.ldap.model.message.ModifyRequest; +import org.apache.directory.api.ldap.model.message.ModifyRequestImpl; +import org.apache.directory.api.ldap.model.message.ModifyResponse; import org.apache.directory.api.ldap.model.message.ResultCodeEnum; -import org.junit.Assert; +import org.apache.directory.api.ldap.model.name.Dn; +import org.apache.directory.ldap.client.api.LdapConnection; +import org.apache.directory.ldap.client.api.LdapNetworkConnection; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.IOException; +import java.util.HashMap; import java.util.Map; -import java.util.List; +import java.util.function.Function; public class IULdapSSHAccountProvisioner implements SSHAccountProvisioner { -String ldaphost, adminDN, ldap_username, ldap_password, adminPass, ldapBaseDN; -int ldapport, ldapPortId; -LdapConnection connection; +private final static Logger logger = LoggerFactory.getLogger(SSHAccountManager.class); +public static final String LDAP_PUBLIC_KEY_OBJECT_CLASS = "ldapPublicKey"; +public static final String SSH_PUBLIC_KEY_ATTRIBUTE_NAME = "sshPublicKey"; + +private String ldapHost, ldapUsername, ldapPassword, ldapBaseDN, canonicalScratchLocation; +private int ldapPort; @Override public void init(Map config) { -// TODO: implement -ldapServerName = config.get(new ConfigParam("ldaphost"));//"bazooka.hps.iu.edu" -ldapPortId = config.get(new ConfigParam("ldapport"));//"636" -ldap_username = config.get(new ConfigParam("ldap_username"));//"cn=sgrcusr" -ldap_password = config.get(new ConfigParam("ldap_password"));//"lore footwork engorge" -ldapBaseDN = config.get(new ConfigParam( "ldapBaseDN" ));//"dc=rt,dc=iu,dc=edu" -try { -connection = new LdapNetworkConnection(ldaphost, ldapport, true); - - -System.out.println( "binding connection:" ); -String
[27/40] airavata git commit: AIRAVATA-2500 Improved error handling, error messages
AIRAVATA-2500 Improved error handling, error messages Project: http://git-wip-us.apache.org/repos/asf/airavata/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/66689a8b Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/66689a8b Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/66689a8b Branch: refs/heads/develop Commit: 66689a8b817f534d80e1ed0f2594509f53190e95 Parents: 7437112 Author: Marcus ChristieAuthored: Wed Sep 20 14:48:49 2017 -0400 Committer: Marcus Christie Committed: Wed Sep 20 15:04:53 2017 -0400 -- .../InvalidSetupException.java | 43 ++ .../InvalidUsernameException.java | 43 ++ .../accountprovisioning/SSHAccountManager.java | 89 +++- .../SSHAccountProvisioner.java | 8 +- .../airavata/accountprovisioning/SSHUtil.java | 2 +- .../IULdapSSHAccountProvisioner.java| 15 ++-- .../provisioner/TestSSHAccountProvisioner.java | 10 ++- 7 files changed, 175 insertions(+), 35 deletions(-) -- http://git-wip-us.apache.org/repos/asf/airavata/blob/66689a8b/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/InvalidSetupException.java -- diff --git a/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/InvalidSetupException.java b/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/InvalidSetupException.java new file mode 100644 index 000..004ec97 --- /dev/null +++ b/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/InvalidSetupException.java @@ -0,0 +1,43 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ + +package org.apache.airavata.accountprovisioning; + +/** + * This exception indicates that some SSHAccountProvisioner setup is missing or incorrect. + * Message should indicate what is invalid and potentially how to fix it. + */ +public class InvalidSetupException extends Exception { + +public InvalidSetupException() { +} + +public InvalidSetupException(String message) { +super(message); +} + +public InvalidSetupException(String message, Throwable cause) { +super(message, cause); +} + +public InvalidSetupException(Throwable cause) { +super(cause); +} +} http://git-wip-us.apache.org/repos/asf/airavata/blob/66689a8b/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/InvalidUsernameException.java -- diff --git a/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/InvalidUsernameException.java b/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/InvalidUsernameException.java new file mode 100644 index 000..f78d7df --- /dev/null +++ b/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/InvalidUsernameException.java @@ -0,0 +1,43 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ + +package org.apache.airavata.accountprovisioning; + +/** +
[16/40] airavata git commit: AIRAVATA-2500 Thrift stub generation
http://git-wip-us.apache.org/repos/asf/airavata/blob/469a7e79/airavata-api/airavata-api-stubs/src/main/java/org/apache/airavata/api/Airavata.java -- diff --git a/airavata-api/airavata-api-stubs/src/main/java/org/apache/airavata/api/Airavata.java b/airavata-api/airavata-api-stubs/src/main/java/org/apache/airavata/api/Airavata.java index 6214caf..d92d222 100644 --- a/airavata-api/airavata-api-stubs/src/main/java/org/apache/airavata/api/Airavata.java +++ b/airavata-api/airavata-api-stubs/src/main/java/org/apache/airavata/api/Airavata.java @@ -2626,27 +2626,27 @@ public class Airavata { public List getSSHAccountProvisionerConfigParams(org.apache.airavata.model.security.AuthzToken authzToken, String provisionerName) throws org.apache.airavata.model.error.InvalidRequestException, org.apache.airavata.model.error.AiravataClientException, org.apache.airavata.model.error.AiravataSystemException, org.apache.airavata.model.error.AuthorizationException, org.apache.thrift.TException; /** - * Setup and return a UserComputeResourcePreference object for this user to SSH into the given compute resource with - * the given SSH credential. This method will only work if the compute resource has an SSHAccountProvisioner - * configured for it. The returned UserComputeResourcePreference object is not saved; it is up to the client to - * call addUserComputeResourcePreference to persist it. + * Check if user has an SSH account on the given compute resource. This + * method will only work if the compute resource has an SSHAccountProvisioner configured for it. * * @param authzToken * @param computeResourceId * @param username - * @param airavataCredStoreToken */ -public org.apache.airavata.model.appcatalog.userresourceprofile.UserComputeResourcePreference setupUserComputeResourcePreferencesForSSH(org.apache.airavata.model.security.AuthzToken authzToken, String computeResourceId, String username, String airavataCredStoreToken) throws org.apache.airavata.model.error.InvalidRequestException, org.apache.airavata.model.error.AiravataClientException, org.apache.airavata.model.error.AiravataSystemException, org.apache.airavata.model.error.AuthorizationException, org.apache.thrift.TException; +public boolean doesUserHaveSSHAccount(org.apache.airavata.model.security.AuthzToken authzToken, String computeResourceId, String username) throws org.apache.airavata.model.error.InvalidRequestException, org.apache.airavata.model.error.AiravataClientException, org.apache.airavata.model.error.AiravataSystemException, org.apache.airavata.model.error.AuthorizationException, org.apache.thrift.TException; /** - * Check if user has an SSH account on the given compute resource. This - * method will only work if the compute resource has an SSHAccountProvisioner configured for it. + * Setup and return a UserComputeResourcePreference object for this user to SSH into the given compute resource with + * the given SSH credential. This method will only work if the compute resource has an SSHAccountProvisioner + * configured for it. The returned UserComputeResourcePreference object is not saved; it is up to the client to + * call addUserComputeResourcePreference to persist it. * * @param authzToken * @param computeResourceId * @param username + * @param airavataCredStoreToken */ -public boolean doesUserHaveSSHAccount(org.apache.airavata.model.security.AuthzToken authzToken, String computeResourceId, String username) throws org.apache.airavata.model.error.InvalidRequestException, org.apache.airavata.model.error.AiravataClientException, org.apache.airavata.model.error.AiravataSystemException, org.apache.airavata.model.error.AuthorizationException, org.apache.thrift.TException; +public org.apache.airavata.model.appcatalog.userresourceprofile.UserComputeResourcePreference setupUserComputeResourcePreferencesForSSH(org.apache.airavata.model.security.AuthzToken authzToken, String computeResourceId, String username, String airavataCredStoreToken) throws org.apache.airavata.model.error.InvalidRequestException, org.apache.airavata.model.error.AiravataClientException, org.apache.airavata.model.error.AiravataSystemException, org.apache.airavata.model.error.AuthorizationException, org.apache.thrift.TException; /** * Register User Resource Profile. @@ -3322,10 +3322,10 @@ public class Airavata { public void getSSHAccountProvisionerConfigParams(org.apache.airavata.model.security.AuthzToken authzToken, String provisionerName, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; -public void setupUserComputeResourcePreferencesForSSH(org.apache.airavata.model.security.AuthzToken authzToken, String computeResourceId, String username, String
[39/40] airavata git commit: Merge branch 'AIRAVATA-2500' into develop
http://git-wip-us.apache.org/repos/asf/airavata/blob/ebdf8977/airavata-api/airavata-api-stubs/src/main/java/org/apache/airavata/api/Airavata.java -- diff --cc airavata-api/airavata-api-stubs/src/main/java/org/apache/airavata/api/Airavata.java index 88b5f90,48fdbd8..36ab707 --- a/airavata-api/airavata-api-stubs/src/main/java/org/apache/airavata/api/Airavata.java +++ b/airavata-api/airavata-api-stubs/src/main/java/org/apache/airavata/api/Airavata.java @@@ -2592,8 -2619,33 +2592,33 @@@ public class Airavata * @param gatewayID * @param storageId */ -public boolean deleteGatewayStoragePreference(org.apache.airavata.model.security.AuthzToken authzToken, String gatewayID, String storageId) throws org.apache.airavata.model.error.InvalidRequestException, org.apache.airavata.model.error.AiravataClientException, org.apache.airavata.model.error.AiravataSystemException, org.apache.airavata.model.error.AuthorizationException, org.apache.thrift.TException; +public boolean deleteGatewayStoragePreference(org.apache.airavata.model.security.AuthzToken authzToken, java.lang.String gatewayID, java.lang.String storageId) throws org.apache.airavata.model.error.InvalidRequestException, org.apache.airavata.model.error.AiravataClientException, org.apache.airavata.model.error.AiravataSystemException, org.apache.airavata.model.error.AuthorizationException, org.apache.thrift.TException; -public List getSSHAccountProvisioners(org.apache.airavata.model.security.AuthzToken authzToken) throws org.apache.airavata.model.error.InvalidRequestException, org.apache.airavata.model.error.AiravataClientException, org.apache.airavata.model.error.AiravataSystemException, org.apache.airavata.model.error.AuthorizationException, org.apache.thrift.TException; ++public java.util.List getSSHAccountProvisioners(org.apache.airavata.model.security.AuthzToken authzToken) throws org.apache.airavata.model.error.InvalidRequestException, org.apache.airavata.model.error.AiravataClientException, org.apache.airavata.model.error.AiravataSystemException, org.apache.airavata.model.error.AuthorizationException, org.apache.thrift.TException; + + /** + * Check if user has an SSH account on the given compute resource. This + * method will only work if the compute resource has an SSHAccountProvisioner configured for it. + * + * @param authzToken + * @param computeResourceId + * @param userId + */ -public boolean doesUserHaveSSHAccount(org.apache.airavata.model.security.AuthzToken authzToken, String computeResourceId, String userId) throws org.apache.airavata.model.error.InvalidRequestException, org.apache.airavata.model.error.AiravataClientException, org.apache.airavata.model.error.AiravataSystemException, org.apache.airavata.model.error.AuthorizationException, org.apache.thrift.TException; ++public boolean doesUserHaveSSHAccount(org.apache.airavata.model.security.AuthzToken authzToken, java.lang.String computeResourceId, java.lang.String userId) throws org.apache.airavata.model.error.InvalidRequestException, org.apache.airavata.model.error.AiravataClientException, org.apache.airavata.model.error.AiravataSystemException, org.apache.airavata.model.error.AuthorizationException, org.apache.thrift.TException; + + /** + * Setup and return a UserComputeResourcePreference object for this user to SSH into the given compute resource with + * the given SSH credential. This method will only work if the compute resource has an SSHAccountProvisioner + * configured for it. The returned UserComputeResourcePreference object is not saved; it is up to the client to + * call addUserComputeResourcePreference to persist it. + * + * @param authzToken + * @param computeResourceId + * @param userId + * @param airavataCredStoreToken + */ -public org.apache.airavata.model.appcatalog.userresourceprofile.UserComputeResourcePreference setupUserComputeResourcePreferencesForSSH(org.apache.airavata.model.security.AuthzToken authzToken, String computeResourceId, String userId, String airavataCredStoreToken) throws org.apache.airavata.model.error.InvalidRequestException, org.apache.airavata.model.error.AiravataClientException, org.apache.airavata.model.error.AiravataSystemException, org.apache.airavata.model.error.AuthorizationException, org.apache.thrift.TException; ++public org.apache.airavata.model.appcatalog.userresourceprofile.UserComputeResourcePreference setupUserComputeResourcePreferencesForSSH(org.apache.airavata.model.security.AuthzToken authzToken, java.lang.String computeResourceId, java.lang.String userId, java.lang.String airavataCredStoreToken) throws org.apache.airavata.model.error.InvalidRequestException, org.apache.airavata.model.error.AiravataClientException,
[19/40] airavata git commit: AIRAVATA-2500 Thrift stub code generation
AIRAVATA-2500 Thrift stub code generation Project: http://git-wip-us.apache.org/repos/asf/airavata/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/fab19005 Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/fab19005 Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/fab19005 Branch: refs/heads/develop Commit: fab19005af44bec99634aa5d9233948803428d16 Parents: 71d33ea Author: Marcus ChristieAuthored: Thu Sep 7 15:16:43 2017 -0400 Committer: Marcus Christie Committed: Tue Sep 19 15:08:05 2017 -0400 -- .../Model/AppCatalog/GatewayProfile/Types.php | 23 .../ComputeResourcePreference.java | 114 ++- 2 files changed, 133 insertions(+), 4 deletions(-) -- http://git-wip-us.apache.org/repos/asf/airavata/blob/fab19005/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/Model/AppCatalog/GatewayProfile/Types.php -- diff --git a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/Model/AppCatalog/GatewayProfile/Types.php b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/Model/AppCatalog/GatewayProfile/Types.php index da3071a..63e39bc 100644 --- a/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/Model/AppCatalog/GatewayProfile/Types.php +++ b/airavata-api/airavata-client-sdks/airavata-php-sdk/src/main/resources/lib/Airavata/Model/AppCatalog/GatewayProfile/Types.php @@ -118,6 +118,10 @@ class ComputeResourcePreference { * @var array */ public $sshAccountProvisionerConfig = null; + /** + * @var string + */ + public $sshAccountProvisionerAdditionalInfo = null; public function __construct($vals=null) { if (!isset(self::$_TSPEC)) { @@ -194,6 +198,10 @@ class ComputeResourcePreference { 'type' => TType::STRING, ), ), +17 => array( + 'var' => 'sshAccountProvisionerAdditionalInfo', + 'type' => TType::STRING, + ), ); } if (is_array($vals)) { @@ -245,6 +253,9 @@ class ComputeResourcePreference { if (isset($vals['sshAccountProvisionerConfig'])) { $this->sshAccountProvisionerConfig = $vals['sshAccountProvisionerConfig']; } + if (isset($vals['sshAccountProvisionerAdditionalInfo'])) { +$this->sshAccountProvisionerAdditionalInfo = $vals['sshAccountProvisionerAdditionalInfo']; + } } } @@ -392,6 +403,13 @@ class ComputeResourcePreference { $xfer += $input->skip($ftype); } break; +case 17: + if ($ftype == TType::STRING) { +$xfer += $input->readString($this->sshAccountProvisionerAdditionalInfo); + } else { +$xfer += $input->skip($ftype); + } + break; default: $xfer += $input->skip($ftype); break; @@ -498,6 +516,11 @@ class ComputeResourcePreference { } $xfer += $output->writeFieldEnd(); } +if ($this->sshAccountProvisionerAdditionalInfo !== null) { + $xfer += $output->writeFieldBegin('sshAccountProvisionerAdditionalInfo', TType::STRING, 17); + $xfer += $output->writeString($this->sshAccountProvisionerAdditionalInfo); + $xfer += $output->writeFieldEnd(); +} $xfer += $output->writeFieldStop(); $xfer += $output->writeStructEnd(); return $xfer; http://git-wip-us.apache.org/repos/asf/airavata/blob/fab19005/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/appcatalog/gatewayprofile/ComputeResourcePreference.java -- diff --git a/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/appcatalog/gatewayprofile/ComputeResourcePreference.java b/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/appcatalog/gatewayprofile/ComputeResourcePreference.java index 3edf60c..d758e9d 100644 --- a/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/appcatalog/gatewayprofile/ComputeResourcePreference.java +++ b/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/appcatalog/gatewayprofile/ComputeResourcePreference.java @@ -105,6 +105,7 @@ public class ComputeResourcePreference implements org.apache.thrift.TBase, SchemeFactory> schemes = new HashMap (); static { @@ -128,6 +129,7 @@ public class ComputeResourcePreference implements org.apache.thrift.TBase sshAccountProvisionerConfig; // optional + private String sshAccountProvisionerAdditionalInfo; // optional /** The set of fields this struct contains, along with convenience methods
[07/40] airavata git commit: AIRAVATA-2500 Update thrift API and regenerated
http://git-wip-us.apache.org/repos/asf/airavata/blob/2a901394/airavata-api/airavata-api-stubs/src/main/java/org/apache/airavata/api/Airavata.java -- diff --git a/airavata-api/airavata-api-stubs/src/main/java/org/apache/airavata/api/Airavata.java b/airavata-api/airavata-api-stubs/src/main/java/org/apache/airavata/api/Airavata.java index 6ef1610..851f96e 100644 --- a/airavata-api/airavata-api-stubs/src/main/java/org/apache/airavata/api/Airavata.java +++ b/airavata-api/airavata-api-stubs/src/main/java/org/apache/airavata/api/Airavata.java @@ -2621,6 +2621,10 @@ public class Airavata { */ public boolean deleteGatewayStoragePreference(org.apache.airavata.model.security.AuthzToken authzToken, String gatewayID, String storageId) throws org.apache.airavata.model.error.InvalidRequestException, org.apache.airavata.model.error.AiravataClientException, org.apache.airavata.model.error.AiravataSystemException, org.apache.airavata.model.error.AuthorizationException, org.apache.thrift.TException; +public List getSSHAccountProvisionerNames(org.apache.airavata.model.security.AuthzToken authzToken) throws org.apache.airavata.model.error.InvalidRequestException, org.apache.airavata.model.error.AiravataClientException, org.apache.airavata.model.error.AiravataSystemException, org.apache.airavata.model.error.AuthorizationException, org.apache.thrift.TException; + +public List getSSHAccountProvisionerConfigParams(org.apache.airavata.model.security.AuthzToken authzToken, String provisionerName) throws org.apache.airavata.model.error.InvalidRequestException, org.apache.airavata.model.error.AiravataClientException, org.apache.airavata.model.error.AiravataSystemException, org.apache.airavata.model.error.AuthorizationException, org.apache.thrift.TException; + /** * Register User Resource Profile. * @@ -3291,6 +3295,10 @@ public class Airavata { public void deleteGatewayStoragePreference(org.apache.airavata.model.security.AuthzToken authzToken, String gatewayID, String storageId, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; +public void getSSHAccountProvisionerNames(org.apache.airavata.model.security.AuthzToken authzToken, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + +public void getSSHAccountProvisionerConfigParams(org.apache.airavata.model.security.AuthzToken authzToken, String provisionerName, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + public void registerUserResourceProfile(org.apache.airavata.model.security.AuthzToken authzToken, org.apache.airavata.model.appcatalog.userresourceprofile.UserResourceProfile userResourceProfile, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; public void getUserResourceProfile(org.apache.airavata.model.security.AuthzToken authzToken, String userId, String gatewayID, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; @@ -8275,6 +8283,77 @@ public class Airavata { throw new org.apache.thrift.TApplicationException(org.apache.thrift.TApplicationException.MISSING_RESULT, "deleteGatewayStoragePreference failed: unknown result"); } +public List getSSHAccountProvisionerNames(org.apache.airavata.model.security.AuthzToken authzToken) throws org.apache.airavata.model.error.InvalidRequestException, org.apache.airavata.model.error.AiravataClientException, org.apache.airavata.model.error.AiravataSystemException, org.apache.airavata.model.error.AuthorizationException, org.apache.thrift.TException +{ + send_getSSHAccountProvisionerNames(authzToken); + return recv_getSSHAccountProvisionerNames(); +} + +public void send_getSSHAccountProvisionerNames(org.apache.airavata.model.security.AuthzToken authzToken) throws org.apache.thrift.TException +{ + getSSHAccountProvisionerNames_args args = new getSSHAccountProvisionerNames_args(); + args.setAuthzToken(authzToken); + sendBase("getSSHAccountProvisionerNames", args); +} + +public List recv_getSSHAccountProvisionerNames() throws org.apache.airavata.model.error.InvalidRequestException, org.apache.airavata.model.error.AiravataClientException, org.apache.airavata.model.error.AiravataSystemException, org.apache.airavata.model.error.AuthorizationException, org.apache.thrift.TException +{ + getSSHAccountProvisionerNames_result result = new getSSHAccountProvisionerNames_result(); + receiveBase(result, "getSSHAccountProvisionerNames"); + if (result.isSetSuccess()) { +return result.success; + } + if (result.ire != null) { +throw result.ire; + } + if (result.ace != null) { +throw result.ace; + } + if
[28/40] airavata git commit: AIRAVATA-2500 Javadoc for SSHAccountProvisioner interfaces
AIRAVATA-2500 Javadoc for SSHAccountProvisioner interfaces Project: http://git-wip-us.apache.org/repos/asf/airavata/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/2425187b Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/2425187b Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/2425187b Branch: refs/heads/develop Commit: 2425187bb505fbc21580d52dc2192043bb18551a Parents: 66689a8 Author: Marcus ChristieAuthored: Wed Sep 20 15:05:18 2017 -0400 Committer: Marcus Christie Committed: Wed Sep 20 15:05:18 2017 -0400 -- .../SSHAccountProvisioner.java | 43 .../SSHAccountProvisionerProvider.java | 21 ++ 2 files changed, 64 insertions(+) -- http://git-wip-us.apache.org/repos/asf/airavata/blob/2425187b/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/SSHAccountProvisioner.java -- diff --git a/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/SSHAccountProvisioner.java b/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/SSHAccountProvisioner.java index 866ef5c..395b622 100644 --- a/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/SSHAccountProvisioner.java +++ b/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/SSHAccountProvisioner.java @@ -22,11 +22,54 @@ package org.apache.airavata.accountprovisioning; import java.util.Map; +/** + * An SSHAccountProvisioner is capable of installing an Airavata-managed SSH public key onto a compute host for a user. + * SSHAccountProvisioners may also optionally provide the capability to create accounts directly on the compute host + * for the user. An SSHAccountProvisioner's {@link SSHAccountProvisionerProvider} provides some methods to define the + * configuration params that this SSHAccountProvisioner requires as well as some metadata method to describe the + * capabilities of this SSHAccountProvisioner. + */ public interface SSHAccountProvisioner { +/** + * Initialize this SSHAccountProvisioner. + * @param config + */ void init(Map config); + +/** + * Return true if this user has an account on the compute host + * @param userId the Airavata user id + * @return + * @throws InvalidUsernameException + */ boolean hasAccount(String userId) throws InvalidUsernameException; + +/** + * Create an account for the user if no account exists. May throw {@link UnsupportedOperationException} if + * unimplemented for this SSHAccountProvisioner. + * @param userId the Airavata user id + * @param sshPublicKey the public key part of an Airavata managed SSH credential + * @throws InvalidUsernameException + */ void createAccount(String userId, String sshPublicKey) throws InvalidUsernameException; + +/** + * Install an SSH key for the user on the compute host. + * @param userId the Airavata user id + * @param sshPublicKey the public key part of an Airavata managed SSH credential + * @throws InvalidUsernameException + */ void installSSHKey(String userId, String sshPublicKey) throws InvalidUsernameException; + +/** + * Get the scratch location that should be created for the user. Note: this method doesn't create the scratch + * location on the compute host, it merely determines a path to a good scratch location to be used by a gateway + * on behalf of the user. + * + * @param userId + * @return a filesystem path (e.g. "/N/scratch/username/some-gateway") + * @throws InvalidUsernameException + */ String getScratchLocation(String userId) throws InvalidUsernameException; } http://git-wip-us.apache.org/repos/asf/airavata/blob/2425187b/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/SSHAccountProvisionerProvider.java -- diff --git a/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/SSHAccountProvisionerProvider.java b/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/SSHAccountProvisionerProvider.java index 297c757..c0407d5 100644 --- a/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/SSHAccountProvisionerProvider.java +++ b/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/SSHAccountProvisionerProvider.java @@ -32,8 +32,29 @@ public interface SSHAccountProvisionerProvider {
[26/40] airavata git commit: AIRAVATA-2500 Thrift stub code generation
AIRAVATA-2500 Thrift stub code generation Project: http://git-wip-us.apache.org/repos/asf/airavata/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/3184c238 Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/3184c238 Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/3184c238 Branch: refs/heads/develop Commit: 3184c23874cf15aef991859bbb87b9d1e0892f9d Parents: 643d35b Author: Marcus ChristieAuthored: Thu Sep 7 09:42:32 2017 -0400 Committer: Marcus Christie Committed: Tue Sep 19 15:08:05 2017 -0400 -- .../java/org/apache/airavata/api/Airavata.java | 36866 - .../resources/lib/Airavata/API/Airavata.php | 8436 ++-- .../Model/AppCatalog/GatewayProfile/Types.php | 120 +- .../SSHAccountProvisioner.java | 159 +- .../ComputeResourcePreference.java |25 +- 5 files changed, 22774 insertions(+), 22832 deletions(-) --
[04/40] airavata git commit: AIRAVATA-2500 Add creation of scratch location
AIRAVATA-2500 Add creation of scratch location Project: http://git-wip-us.apache.org/repos/asf/airavata/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/8c748c66 Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/8c748c66 Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/8c748c66 Branch: refs/heads/develop Commit: 8c748c66b5f4c40847432b6abe5b1ca535188be9 Parents: 3d161b8 Author: Marcus ChristieAuthored: Wed Aug 23 17:19:05 2017 -0400 Committer: Marcus Christie Committed: Tue Sep 19 15:07:56 2017 -0400 -- .../accountprovisioning/SSHAccountManager.java | 11 ++- .../airavata/accountprovisioning/SSHUtil.java | 79 +++- 2 files changed, 84 insertions(+), 6 deletions(-) -- http://git-wip-us.apache.org/repos/asf/airavata/blob/8c748c66/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/SSHAccountManager.java -- diff --git a/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/SSHAccountManager.java b/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/SSHAccountManager.java index d565fe9..a56a632 100644 --- a/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/SSHAccountManager.java +++ b/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/SSHAccountManager.java @@ -34,6 +34,8 @@ import org.apache.airavata.registry.api.RegistryService; import org.apache.airavata.registry.api.client.RegistryServiceClientFactory; import org.apache.airavata.registry.api.exception.RegistryServiceException; import org.apache.thrift.TException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import java.util.HashMap; import java.util.List; @@ -43,6 +45,8 @@ import java.util.stream.Collectors; public class SSHAccountManager { +private final static Logger logger = LoggerFactory.getLogger(SSHAccountManager.class); + // TODO: change return type to one that returns some details of the SSH account setup, for example the scratch location public static void setupSSHAccount(String gatewayId, String computeResourceId, String username, SSHCredential sshCredential) { @@ -84,8 +88,9 @@ public class SSHAccountManager { // Install SSH key sshAccountProvisioner.installSSHKey(username, sshCredential.getPublicKey()); +// TODO: replace hard coded port 22 with port from SSHJobSubmission interface // Verify can authenticate to host -boolean validated = SSHUtil.validate(username, computeResourceDescription.getHostName(), 22, sshCredential); +boolean validated = SSHUtil.validate(computeResourceDescription.getHostName(), 22, username, sshCredential); if (!validated) { throw new RuntimeException("Failed to validate installation of key for [" + username + "] on [" + computeResourceDescription.getHostName() + "] using SSH Account Provisioner [" @@ -93,8 +98,10 @@ public class SSHAccountManager { } // create the scratch location on the host -// TODO: create the scratch location String scratchLocation = sshAccountProvisioner.getScratchLocation(username); +SSHUtil.execute(computeResourceDescription.getHostName(), 22, username, sshCredential, "mkdir -p " + scratchLocation); + +// TODO: return information about provisioned account } private static Map resolveProvisionerConfig(String gatewayId, String provisionerName, Map provisionerConfig) { http://git-wip-us.apache.org/repos/asf/airavata/blob/8c748c66/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/SSHUtil.java -- diff --git a/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/SSHUtil.java b/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/SSHUtil.java index 4b5452a..2550270 100644 --- a/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/SSHUtil.java +++ b/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/SSHUtil.java @@ -20,12 +20,14 @@ package org.apache.airavata.accountprovisioning; -import com.jcraft.jsch.JSch; -import com.jcraft.jsch.JSchException; -import com.jcraft.jsch.Session; +import com.jcraft.jsch.*; import org.apache.airavata.model.credential.store.SSHCredential; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import java.io.ByteArrayOutputStream;
[30/40] airavata git commit: AIRAVATA-2500 Adding try/catch around doesUserHaveSSHAccount
AIRAVATA-2500 Adding try/catch around doesUserHaveSSHAccount Project: http://git-wip-us.apache.org/repos/asf/airavata/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/8f68bc1a Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/8f68bc1a Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/8f68bc1a Branch: refs/heads/develop Commit: 8f68bc1a9fdef0f980c7ae47ef671366fdb4373b Parents: 42059ec Author: Marcus ChristieAuthored: Wed Sep 20 16:42:37 2017 -0400 Committer: Marcus Christie Committed: Wed Sep 20 16:42:37 2017 -0400 -- .../server/handler/AiravataServerHandler.java| 19 +-- 1 file changed, 13 insertions(+), 6 deletions(-) -- http://git-wip-us.apache.org/repos/asf/airavata/blob/8f68bc1a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java -- diff --git a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java index febb703..162260e 100644 --- a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java +++ b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java @@ -19,10 +19,7 @@ */ package org.apache.airavata.api.server.handler; -import org.apache.airavata.accountprovisioning.ConfigParam; -import org.apache.airavata.accountprovisioning.SSHAccountManager; -import org.apache.airavata.accountprovisioning.SSHAccountProvisionerFactory; -import org.apache.airavata.accountprovisioning.SSHAccountProvisionerProvider; +import org.apache.airavata.accountprovisioning.*; import org.apache.airavata.api.Airavata; import org.apache.airavata.api.airavata_apiConstants; import org.apache.airavata.api.server.util.ThriftClientPool; @@ -4008,8 +4005,18 @@ public class AiravataServerHandler implements Airavata.Iface { @Override @SecurityCheck public boolean doesUserHaveSSHAccount(AuthzToken authzToken, String computeResourceId, String userId) throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException, TException { -String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID); -return SSHAccountManager.doesUserHaveSSHAccount(gatewayId, computeResourceId, userId); +try { +String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID); +return SSHAccountManager.doesUserHaveSSHAccount(gatewayId, computeResourceId, userId); +} catch (Exception e) { +String errorMessage = "Error occurred while checking if [" + userId + "] has an SSH Account on [" + +computeResourceId + "]."; +logger.error(errorMessage, e); +AiravataSystemException exception = new AiravataSystemException(); +exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR); +exception.setMessage(errorMessage + " More info : " + e.getMessage()); +throw exception; +} } @Override
[15/40] airavata git commit: AIRAVATA-2500 Thrift stub generation
http://git-wip-us.apache.org/repos/asf/airavata/blob/469a7e79/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/appcatalog/gatewayprofile/ComputeResourcePreference.java -- diff --git a/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/appcatalog/gatewayprofile/ComputeResourcePreference.java b/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/appcatalog/gatewayprofile/ComputeResourcePreference.java index 0d52abb..5601424 100644 --- a/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/appcatalog/gatewayprofile/ComputeResourcePreference.java +++ b/airavata-api/airavata-data-models/src/main/java/org/apache/airavata/model/appcatalog/gatewayprofile/ComputeResourcePreference.java @@ -23,32 +23,15 @@ */ package org.apache.airavata.model.appcatalog.gatewayprofile; +import org.apache.thrift.EncodingUtils; +import org.apache.thrift.protocol.TTupleProtocol; import org.apache.thrift.scheme.IScheme; import org.apache.thrift.scheme.SchemeFactory; import org.apache.thrift.scheme.StandardScheme; - import org.apache.thrift.scheme.TupleScheme; -import org.apache.thrift.protocol.TTupleProtocol; -import org.apache.thrift.protocol.TProtocolException; -import org.apache.thrift.EncodingUtils; -import org.apache.thrift.TException; -import org.apache.thrift.async.AsyncMethodCallback; -import org.apache.thrift.server.AbstractNonblockingServer.*; -import java.util.List; -import java.util.ArrayList; -import java.util.Map; -import java.util.HashMap; -import java.util.EnumMap; -import java.util.Set; -import java.util.HashSet; -import java.util.EnumSet; -import java.util.Collections; -import java.util.BitSet; -import java.nio.ByteBuffer; -import java.util.Arrays; + import javax.annotation.Generated; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; +import java.util.*; @SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"}) /** @@ -127,7 +110,7 @@ public class ComputeResourcePreference implements org.apache.thrift.TBase sshAccountProvisionerConfig; // optional + private MapsshAccountProvisionerConfig; // optional /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */ public enum _Fields implements org.apache.thrift.TFieldIdEnum { @@ -281,7 +264,7 @@ public class ComputeResourcePreference implements org.apache.thrift.TBase __this__sshAccountProvisionerConfig = new HashMap (other.sshAccountProvisionerConfig.size()); - for (Map.Entry other_element : other.sshAccountProvisionerConfig.entrySet()) { - - org.apache.airavata.model.appcatalog.accountprovisioning.SSHAccountProvisionerConfigParam other_element_key = other_element.getKey(); -String other_element_value = other_element.getValue(); - - org.apache.airavata.model.appcatalog.accountprovisioning.SSHAccountProvisionerConfigParam __this__sshAccountProvisionerConfig_copy_key = new org.apache.airavata.model.appcatalog.accountprovisioning.SSHAccountProvisionerConfigParam(other_element_key); - -String __this__sshAccountProvisionerConfig_copy_value = other_element_value; - - __this__sshAccountProvisionerConfig.put(__this__sshAccountProvisionerConfig_copy_key, __this__sshAccountProvisionerConfig_copy_value); - } + Map __this__sshAccountProvisionerConfig = new HashMap (other.sshAccountProvisionerConfig); this.sshAccountProvisionerConfig = __this__sshAccountProvisionerConfig; } } @@ -752,18 +724,18 @@ public class ComputeResourcePreference implements org.apache.thrift.TBase(); + this.sshAccountProvisionerConfig = new HashMap (); } this.sshAccountProvisionerConfig.put(key, val); } - public Map getSshAccountProvisionerConfig() { + public Map getSshAccountProvisionerConfig() { return this.sshAccountProvisionerConfig; } - public void setSshAccountProvisionerConfig(Map sshAccountProvisionerConfig) { + public void setSshAccountProvisionerConfig(Map sshAccountProvisionerConfig) { this.sshAccountProvisionerConfig = sshAccountProvisionerConfig; } @@ -908,7 +880,7 @@ public class ComputeResourcePreference implements org.apache.thrift.TBase)value); +setSshAccountProvisionerConfig((Map )value); } break; @@ -1767,13 +1739,12 @@ public class ComputeResourcePreference implements
[03/40] airavata git commit: AIRAVATA-2500 Persist SSH account provisioner and config
AIRAVATA-2500 Persist SSH account provisioner and config Project: http://git-wip-us.apache.org/repos/asf/airavata/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/ac2823a6 Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/ac2823a6 Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/ac2823a6 Branch: refs/heads/develop Commit: ac2823a604abca6e0db6314dd7658c1325bb94c3 Parents: 722aabd Author: Marcus ChristieAuthored: Fri Sep 1 12:33:40 2017 -0400 Committer: Marcus Christie Committed: Tue Sep 19 15:07:56 2017 -0400 -- .../accountprovisioning/SSHAccountManager.java | 5 +- .../catalog/impl/GwyResourceProfileImpl.java| 10 ++ .../model/ComputeResourcePreference.java| 31 +-- .../SSHAccountProvisionerConfiguration.java | 98 .../SSHAccountProvisionerConfigurationPK.java | 57 .../ComputeHostPreferenceResource.java | 50 +++--- .../app/catalog/util/AppCatalogJPAUtils.java| 8 ++ .../util/AppCatalogThriftConversion.java| 8 +- .../src/main/resources/META-INF/persistence.xml | 1 + .../src/main/resources/appcatalog-derby.sql | 11 +++ .../src/main/resources/appcatalog-mysql.sql | 13 ++- .../DeltaScripts/appCatalog_schema_delta.sql| 31 +++ .../gateway_resource_profile_model.thrift | 2 +- 13 files changed, 300 insertions(+), 25 deletions(-) -- http://git-wip-us.apache.org/repos/asf/airavata/blob/ac2823a6/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/SSHAccountManager.java -- diff --git a/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/SSHAccountManager.java b/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/SSHAccountManager.java index f9ed22a..74c0dd2 100644 --- a/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/SSHAccountManager.java +++ b/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/SSHAccountManager.java @@ -25,7 +25,6 @@ import org.apache.airavata.common.utils.ServerSettings; import org.apache.airavata.credential.store.client.CredentialStoreClientFactory; import org.apache.airavata.credential.store.cpi.CredentialStoreService; import org.apache.airavata.credential.store.exception.CredentialStoreException; -import org.apache.airavata.model.appcatalog.accountprovisioning.SSHAccountProvisionerConfigParam; import org.apache.airavata.model.appcatalog.computeresource.ComputeResourceDescription; import org.apache.airavata.model.appcatalog.computeresource.JobSubmissionInterface; import org.apache.airavata.model.appcatalog.computeresource.JobSubmissionProtocol; @@ -181,11 +180,11 @@ public class SSHAccountManager { } } -private static Map convertConfigParams(String provisionerName, Map thriftConfigParams) { +private static Map convertConfigParams(String provisionerName, Map thriftConfigParams) { List configParams = SSHAccountProvisionerFactory.getSSHAccountProvisionerConfigParams(provisionerName); Map configParamMap = configParams.stream().collect(Collectors.toMap(ConfigParam::getName, Function.identity())); -return thriftConfigParams.entrySet().stream().collect(Collectors.toMap(entry -> configParamMap.get(entry.getKey().getName()), entry -> entry.getValue())); +return thriftConfigParams.entrySet().stream().collect(Collectors.toMap(entry -> configParamMap.get(entry.getKey()), entry -> entry.getValue())); } private static RegistryService.Client getRegistryServiceClient() { http://git-wip-us.apache.org/repos/asf/airavata/blob/ac2823a6/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/impl/GwyResourceProfileImpl.java -- diff --git a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/impl/GwyResourceProfileImpl.java b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/impl/GwyResourceProfileImpl.java index ccfb08a..78a6f0f 100644 --- a/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/impl/GwyResourceProfileImpl.java +++ b/modules/registry/registry-core/src/main/java/org/apache/airavata/registry/core/app/catalog/impl/GwyResourceProfileImpl.java @@ -89,6 +89,11 @@ public class GwyResourceProfileImpl implements GwyResourceProfile { if
[12/40] airavata git commit: AIRAVATA-2500 Implement doesUserHaveSSHAccount and setup SSH account methods in API
AIRAVATA-2500 Implement doesUserHaveSSHAccount and setup SSH account methods in API Project: http://git-wip-us.apache.org/repos/asf/airavata/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/8f2f1353 Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/8f2f1353 Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/8f2f1353 Branch: refs/heads/develop Commit: 8f2f135374c96f92ffb7eb1775bdfdecb144fb20 Parents: 0d1e90f Author: Marcus ChristieAuthored: Thu Aug 31 09:16:03 2017 -0400 Committer: Marcus Christie Committed: Tue Sep 19 15:07:56 2017 -0400 -- airavata-api/airavata-api-server/pom.xml| 5 ++ .../server/handler/AiravataServerHandler.java | 55 .../accountprovisioning/SSHAccountManager.java | 42 --- .../SSHAccountProvisionerProvider.java | 1 + .../airavata-apis/airavata_api.thrift | 24 - .../account_provisioning_model.thrift | 2 + 6 files changed, 122 insertions(+), 7 deletions(-) -- http://git-wip-us.apache.org/repos/asf/airavata/blob/8f2f1353/airavata-api/airavata-api-server/pom.xml -- diff --git a/airavata-api/airavata-api-server/pom.xml b/airavata-api/airavata-api-server/pom.xml index ada0b8f..a4d10af 100644 --- a/airavata-api/airavata-api-server/pom.xml +++ b/airavata-api/airavata-api-server/pom.xml @@ -93,6 +93,11 @@ services-security ${project.version} + +org.apache.airavata +compute-account-provisioning +${project.version} + http://git-wip-us.apache.org/repos/asf/airavata/blob/8f2f1353/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java -- diff --git a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java index 4ae91ea..bb3f2c0 100644 --- a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java +++ b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java @@ -19,6 +19,7 @@ */ package org.apache.airavata.api.server.handler; +import org.apache.airavata.accountprovisioning.SSHAccountManager; import org.apache.airavata.api.Airavata; import org.apache.airavata.api.airavata_apiConstants; import org.apache.airavata.api.server.util.ThriftClientPool; @@ -35,6 +36,8 @@ import org.apache.airavata.messaging.core.MessagingFactory; import org.apache.airavata.messaging.core.Publisher; import org.apache.airavata.messaging.core.Type; import org.apache.airavata.model.WorkflowModel; +import org.apache.airavata.model.appcatalog.accountprovisioning.SSHAccountProvisioner; +import org.apache.airavata.model.appcatalog.accountprovisioning.SSHAccountProvisionerConfigParam; import org.apache.airavata.model.appcatalog.appdeployment.ApplicationDeploymentDescription; import org.apache.airavata.model.appcatalog.appdeployment.ApplicationModule; import org.apache.airavata.model.appcatalog.appinterface.ApplicationInterfaceDescription; @@ -3964,6 +3967,58 @@ public class AiravataServerHandler implements Airavata.Iface { } } +@Override +@SecurityCheck +public List getSSHAccountProvisionerNames(AuthzToken authzToken) throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException, TException { + +// TODO: implement +return null; +} + +@Override +@SecurityCheck +public List getSSHAccountProvisionerConfigParams(AuthzToken authzToken, String provisionerName) throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException, TException { + +// TODO: implement +return null; +} + +@Override +@SecurityCheck +public boolean doesUserHaveSSHAccount(AuthzToken authzToken, String computeResourceId, String username) throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException, TException { +String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID); +return SSHAccountManager.doesUserHaveSSHAccount(gatewayId, computeResourceId, username); +} + +@Override +@SecurityCheck +public UserComputeResourcePreference setupUserComputeResourcePreferencesForSSH(AuthzToken authzToken, String computeResourceId, String username, String airavataCredStoreToken) throws
[10/40] airavata git commit: AIRAVATA-2500: generated Thrift stub code
http://git-wip-us.apache.org/repos/asf/airavata/blob/722aabd4/airavata-api/airavata-api-stubs/src/main/java/org/apache/airavata/api/Airavata.java -- diff --git a/airavata-api/airavata-api-stubs/src/main/java/org/apache/airavata/api/Airavata.java b/airavata-api/airavata-api-stubs/src/main/java/org/apache/airavata/api/Airavata.java index 851f96e..6214caf 100644 --- a/airavata-api/airavata-api-stubs/src/main/java/org/apache/airavata/api/Airavata.java +++ b/airavata-api/airavata-api-stubs/src/main/java/org/apache/airavata/api/Airavata.java @@ -2621,11 +2621,34 @@ public class Airavata { */ public boolean deleteGatewayStoragePreference(org.apache.airavata.model.security.AuthzToken authzToken, String gatewayID, String storageId) throws org.apache.airavata.model.error.InvalidRequestException, org.apache.airavata.model.error.AiravataClientException, org.apache.airavata.model.error.AiravataSystemException, org.apache.airavata.model.error.AuthorizationException, org.apache.thrift.TException; -public List getSSHAccountProvisionerNames(org.apache.airavata.model.security.AuthzToken authzToken) throws org.apache.airavata.model.error.InvalidRequestException, org.apache.airavata.model.error.AiravataClientException, org.apache.airavata.model.error.AiravataSystemException, org.apache.airavata.model.error.AuthorizationException, org.apache.thrift.TException; +public List getSSHAccountProvisionerNames(org.apache.airavata.model.security.AuthzToken authzToken) throws org.apache.airavata.model.error.InvalidRequestException, org.apache.airavata.model.error.AiravataClientException, org.apache.airavata.model.error.AiravataSystemException, org.apache.airavata.model.error.AuthorizationException, org.apache.thrift.TException; public List getSSHAccountProvisionerConfigParams(org.apache.airavata.model.security.AuthzToken authzToken, String provisionerName) throws org.apache.airavata.model.error.InvalidRequestException, org.apache.airavata.model.error.AiravataClientException, org.apache.airavata.model.error.AiravataSystemException, org.apache.airavata.model.error.AuthorizationException, org.apache.thrift.TException; /** + * Setup and return a UserComputeResourcePreference object for this user to SSH into the given compute resource with + * the given SSH credential. This method will only work if the compute resource has an SSHAccountProvisioner + * configured for it. The returned UserComputeResourcePreference object is not saved; it is up to the client to + * call addUserComputeResourcePreference to persist it. + * + * @param authzToken + * @param computeResourceId + * @param username + * @param airavataCredStoreToken + */ +public org.apache.airavata.model.appcatalog.userresourceprofile.UserComputeResourcePreference setupUserComputeResourcePreferencesForSSH(org.apache.airavata.model.security.AuthzToken authzToken, String computeResourceId, String username, String airavataCredStoreToken) throws org.apache.airavata.model.error.InvalidRequestException, org.apache.airavata.model.error.AiravataClientException, org.apache.airavata.model.error.AiravataSystemException, org.apache.airavata.model.error.AuthorizationException, org.apache.thrift.TException; + +/** + * Check if user has an SSH account on the given compute resource. This + * method will only work if the compute resource has an SSHAccountProvisioner configured for it. + * + * @param authzToken + * @param computeResourceId + * @param username + */ +public boolean doesUserHaveSSHAccount(org.apache.airavata.model.security.AuthzToken authzToken, String computeResourceId, String username) throws org.apache.airavata.model.error.InvalidRequestException, org.apache.airavata.model.error.AiravataClientException, org.apache.airavata.model.error.AiravataSystemException, org.apache.airavata.model.error.AuthorizationException, org.apache.thrift.TException; + +/** * Register User Resource Profile. * * @param UserResourceProfile @@ -3299,6 +3322,10 @@ public class Airavata { public void getSSHAccountProvisionerConfigParams(org.apache.airavata.model.security.AuthzToken authzToken, String provisionerName, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; +public void setupUserComputeResourcePreferencesForSSH(org.apache.airavata.model.security.AuthzToken authzToken, String computeResourceId, String username, String airavataCredStoreToken, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; + +public void doesUserHaveSSHAccount(org.apache.airavata.model.security.AuthzToken authzToken, String computeResourceId, String username, org.apache.thrift.async.AsyncMethodCallback resultHandler) throws org.apache.thrift.TException; +
[01/40] airavata git commit: AIRAVATA-2500 Implement SSHAccountProvisionerFactory
Repository: airavata Updated Branches: refs/heads/develop 666bcdf6e -> ebdf8977f AIRAVATA-2500 Implement SSHAccountProvisionerFactory Project: http://git-wip-us.apache.org/repos/asf/airavata/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/77baac43 Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/77baac43 Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/77baac43 Branch: refs/heads/develop Commit: 77baac438f9a59629a9fc21a904dc7397245a029 Parents: 1c39e2e Author: Marcus ChristieAuthored: Thu Aug 10 15:24:26 2017 -0400 Committer: Marcus Christie Committed: Tue Sep 19 15:07:40 2017 -0400 -- .../accountprovisioning/ConfigParam.java| 32 +++-- .../accountprovisioning/SSHAccountManager.java | 37 +- .../SSHAccountProvisioner.java | 9 --- .../SSHAccountProvisionerFactory.java | 28 +--- .../SSHAccountProvisionerProvider.java | 37 ++ .../IULdapSSHAccountProvisioner.java| 7 -- .../IULdapSSHAccountProvisionerProvider.java| 44 ...ta.accountprovisioning.SSHAccountProvisioner | 22 -- ...ntprovisioning.SSHAccountProvisionerProvider | 22 ++ .../SSHAccountProvisionerFactoryTest.java | 75 .../provisioner/TestSSHAccountProvisioner.java | 71 ++ .../TestSSHAccountProvisionerProvider.java | 66 + ...ntprovisioning.SSHAccountProvisionerProvider | 21 ++ .../account_provisioning_model.thrift | 2 +- .../gateway_resource_profile_model.thrift | 2 +- 15 files changed, 420 insertions(+), 55 deletions(-) -- http://git-wip-us.apache.org/repos/asf/airavata/blob/77baac43/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/ConfigParam.java -- diff --git a/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/ConfigParam.java b/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/ConfigParam.java index beb8bbc..cf27b7f 100644 --- a/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/ConfigParam.java +++ b/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/ConfigParam.java @@ -24,7 +24,7 @@ public class ConfigParam { public enum ConfigParamType { STRING, -CRED_TOKEN, +CRED_STORE_PASSWORD_TOKEN, } private boolean optional = false; @@ -32,36 +32,58 @@ public class ConfigParam { private String description; private ConfigParamType type = ConfigParamType.STRING; +public ConfigParam(String name) { +this.name = name; +} + public boolean isOptional() { return optional; } -public void setOptional(boolean optional) { +public ConfigParam setOptional(boolean optional) { this.optional = optional; +return this; } public String getName() { return name; } -public void setName(String name) { +public ConfigParam setName(String name) { this.name = name; +return this; } public String getDescription() { return description; } -public void setDescription(String description) { +public ConfigParam setDescription(String description) { this.description = description; +return this; } public ConfigParamType getType() { return type; } -public void setType(ConfigParamType type) { +public ConfigParam setType(ConfigParamType type) { this.type = type; +return this; +} + +@Override +public boolean equals(Object o) { +if (this == o) return true; +if (!(o instanceof ConfigParam)) return false; + +ConfigParam that = (ConfigParam) o; + +return name.equals(that.name); } +@Override +public int hashCode() { +return name.hashCode(); +} } http://git-wip-us.apache.org/repos/asf/airavata/blob/77baac43/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/SSHAccountManager.java -- diff --git a/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/SSHAccountManager.java b/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/SSHAccountManager.java index 4e00e4e..dcb819b 100644 --- a/modules/compute-account-provisioning/src/main/java/org/apache/airavata/accountprovisioning/SSHAccountManager.java +++
[6/8] airavata-django-portal git commit: AIRAVATA-2534 Setup build for common js and scss
http://git-wip-us.apache.org/repos/asf/airavata-django-portal/blob/840789b5/django_airavata/package.json -- diff --git a/django_airavata/package.json b/django_airavata/package.json new file mode 100644 index 000..6099bfd --- /dev/null +++ b/django_airavata/package.json @@ -0,0 +1,30 @@ +{ + "name": "django-airavata-common", + "description": "Common JS code for the Airavata Django Portal", + "version": "1.0.0", + "author": "Marcus Christie", + "private": true, + "scripts": { +"dev": "cross-env NODE_ENV=development webpack --progress --hide-modules", +"watch": "cross-env NODE_ENV=development webpack --watch", +"build": "cross-env NODE_ENV=production webpack --progress --hide-modules" + }, + "dependencies": { +"vue": "^2.3.3" + }, + "devDependencies": { +"babel-core": "^6.0.0", +"babel-loader": "^7.1.2", +"babel-preset-env": "^1.5.1", +"cross-env": "^3.0.0", +"css-loader": "^0.25.0", +"extract-text-webpack-plugin": "^3.0.0", +"file-loader": "^0.9.0", +"node-sass": "^4.5.3", +"sass-loader": "^6.0.6", +"vue-loader": "^12.1.0", +"vue-template-compiler": "^2.3.3", +"webpack": "^3.6.0", +"webpack-dev-server": "^2.4.5" + } +} http://git-wip-us.apache.org/repos/asf/airavata-django-portal/blob/840789b5/django_airavata/static/common/js/index.js -- diff --git a/django_airavata/static/common/js/index.js b/django_airavata/static/common/js/index.js new file mode 100644 index 000..e69de29 http://git-wip-us.apache.org/repos/asf/airavata-django-portal/blob/840789b5/django_airavata/static/common/scss/main.scss -- diff --git a/django_airavata/static/common/scss/main.scss b/django_airavata/static/common/scss/main.scss new file mode 100644 index 000..e5d88cf --- /dev/null +++ b/django_airavata/static/common/scss/main.scss @@ -0,0 +1,208 @@ +html, +body { +height: 100%; +} + +body { +color: #333; +background-color: #f7f7f7; +} + +.c-header { +display: flex; +align-items: center; +border-bottom: 1px solid #ddd; +background-color: #ff; + +&__logo { +margin-right: 1rem; +width: 70px; +background-color: #99; + +svg { +display: block; +} +} + +&__title { +font-size: 1.25rem; +line-height: 1; + +a { +color: #333; +} +} + +&__controls { +margin-left: auto; +margin-right: 2rem; +} +} + +.c-nav { +background-color: #444; +min-width: 70px; +min-height: 60px; +padding: 1rem 0; +margin-top: -1px; +display: flex; + +&__item { +color: #ccc; +font-size: 1.5rem; +display: block; +text-align: center; +line-height: 1; +flex-grow: 1; + +&:hover, +&:focus { +color: #ff; +} + +&:active { +color: #bbb; +} + +&.is-active { +color: #ff; +} +} +} + +@media screen and (min-width: 768px) { +.c-nav { +height: 100%; +flex-direction: column; + +&__item { +flex-grow: 0; +margin-bottom: 2rem; +} +} +} + +.stage { +width: 100%; +height: 100%; +display: flex; +flex-direction: column; +} + +@media screen and (min-width: 768px) { +.stage { +flex-direction: row; +} +} + + +.main-content { +flex-grow: 1; +padding: 1rem; +} + +.sidebar { +flex-basis: 200px; +background-color: #ff; +} + +.sidebar-header { +padding: 1.5rem; +display: flex; +align-items: center; +border-bottom: 1px solid #eee; + +&__title { +font-size: .825rem; +text-transform: uppercase; +letter-spacing: .04rem; +margin: 0; +} + +&__action { +margin-left: auto; +font-size: .825rem; +} +} + +@media screen and (min-width: 768px) { +.sidebar { +min-width: 310px; +border-left: 1px solid #ddd; +} +} + +.card { +background-color: #fff; +border-radius: 4px; +border: none; +box-shadow: 0 2px 0 #eee; +margin-bottom: 30px; +} + +/** + * Make a small card text modifier so we can still use + * Bootstrap's default styles if needed. + */ +.card-text--small { +line-height: 1.4; +font-size: .825rem; +} + +.card.is-disabled { +background-color: #ddd; + +.card-title { +color: #99; +} + +.badge { +background-color: #ccc; +color: #99; +} +} + +.card-link:hover { +text-decoration: none; +background-color: #fafafa; +} + +.card.is-disabled .card-link:hover { +background-color: #ddd; +
[2/8] airavata-django-portal git commit: AIRAVATA-2534 Setup build for common js and scss
http://git-wip-us.apache.org/repos/asf/airavata-django-portal/blob/840789b5/django_airavata/static/js/vendor.js.map -- diff --git a/django_airavata/static/js/vendor.js.map b/django_airavata/static/js/vendor.js.map deleted file mode 100644 index 09e4508..000 --- a/django_airavata/static/js/vendor.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["webpack:///static/js/vendor.js","webpack:///./~/vue-loader/lib/component-normalizer.js","webpack:///./~/vue/dist/vue.esm.js","webpack:///./~/vue-router/dist/vue-router.esm.js","webpack:///./~/vue-style-loader/lib/listToStyles.js","webpack:///(webpack)/buildin/global.js","webpack:///./~/css-loader/lib/css-base.js","webpack:///./~/vue-style-loader/lib/addStylesClient.js","webpack:///./~/vue-resource/dist/vue-resource.es2015.js"],"names":["webpackJsonpAiravataApp","0","module","exports","rawScriptExports","compiledTemplate","injectStyles","scopeId","moduleIdentifier","esModule","scriptExports","type","default","options","render","staticRenderFns","_scopeId","hook","context","this","$vnode","ssrContext","parent","__VUE_SSR_CONTEXT__","call","_registeredComponents","add","_ssrRegister","functional","existing","beforeCreate","h","concat","10","__webpack_exports__","__webpack_require__","global","isUndef","v","undefined","isDef","isTrue","isFalse","isPrimitive","va lue","isObject","obj","isPlainObject","_toString","isRegExp","isValidArrayIndex","val","n","parseFloat","Math","floor","isFinite","toString","JSON","stringify","String","toNumber","isNaN","makeMap","str","expectsLowerCase","map","Object","create","list","split","i","length","toLowerCase","remove","arr","item","index","indexOf","splice","hasOwn","key","hasOwnProperty","cached","fn","cache","bind","ctx","boundFn","a","l","arguments","apply","_length","toArray","start","ret","Array","extend","to","_from","toObject","res","noop","b","c","looseEqual","isObjectA","isObjectB","isArrayA","isArray","isArrayB","every","e","keysA","keys","keysB","looseIndexOf","once","called","isReserved","charCodeAt","def","enumerable","defineProperty","writable","configurable","parsePath","path","bailRE","test","segments","handleError","err","vm","info","config","errorHandler","inBrowser","console","error","isNative","Ctor","pushTarget","_target","Dep","target","targetStack","push","popTarget","pop","protoAu gment","src","__proto__","copyAugment","observe","asRootData","ob","__ob__","Observer","observerState","shouldConvert","isServerRendering","isExtensible","_isVue","vmCount","defineReactive$$1","customSetter","shallow","dep","property","getOwnPropertyDescriptor","getter","get","setter","set","childOb","depend","dependArray","newVal","notify","max","del","mergeData","from","toVal","fromVal","mergeDataOrFn","parentVal","childVal","instanceData","defaultData","mergeHook","mergeAssets","normalizeProps","props","name","camelize","normalizeInject","inject","normalized","normalizeDirectives","dirs","directives","update","mergeOptions","child","mergeField","strat","strats","defaultStrat","extendsFrom","extends","mixins","resolveAsset","id","warnMissing","assets","camelizedId","PascalCaseId","capitalize","validateProp","propOptions","propsData","prop","absent","isType","Boolean","hyphenate","getPropDefaultValue","prevShouldConvert","$options","_props","getType","match","len","createTextVNode" ,"VNode","cloneVNode","vnode","cloned","tag","data","children","text","elm","componentOptions","asyncFactory","ns","isStatic","isComment","isCloned","cloneVNodes","vnodes","createFnInvoker","fns","invoker","arguments$1","slice","updateListeners","on","oldOn","remove$$1","cur","old","event","normalizeEvent","capture","passive","mergeVNodeHook","hookKey","wrappedHook","oldHook","merged","extractPropsFromVNodeData","attrs","altKey","checkProp","hash","preserve","simpleNormalizeChildren","prototype","normalizeChildren","normalizeArrayChildren","isTextNode","node","nestedIndex","last","_isVList","ensureCtor","comp","base","__esModule","createAsyncPlaceholder","factory","createEmptyVNode","asyncMeta","resolveAsyncComponent","baseCtor","errorComp","resolved","loading","loadingComp","contexts","sync","forceRender","$forceUpdate","resolve","reject","reason","then","component","delay","setTimeout","timeout","getFirstComponentChild","initEvents","_events","_hasHookEvent","listeners","_parentLi
[4/8] airavata-django-portal git commit: AIRAVATA-2534 Setup build for common js and scss
http://git-wip-us.apache.org/repos/asf/airavata-django-portal/blob/840789b5/django_airavata/static/js/manifest.js.map -- diff --git a/django_airavata/static/js/manifest.js.map b/django_airavata/static/js/manifest.js.map deleted file mode 100644 index 01396b3..000 --- a/django_airavata/static/js/manifest.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["webpack:///static/js/manifest.js","webpack:///webpack/bootstrap 7597438498a80717affd"],"names":["modules","__webpack_require__","moduleId","installedModules","exports","module","i","l","call","parentJsonpFunction","window","chunkIds","moreModules","executeModules","chunkId","result","resolves","length","installedChunks","push","Object","prototype","hasOwnProperty","shift","s","2","e","onScriptComplete","script","onerror","onload","clearTimeout","timeout","chunk","Error","undefined","installedChunkData","Promise","resolve","promise","reject","head","document","getElementsByTagName","createElement","type","charset","async","nc","setAttribute","src","p","0","1","setTimeout","appendChild","m","c","value","d","name","getter","o","defineProperty","configurable","enumerable","get","n","__esModule","object","property","oe","err","console","error"],"mappings":"CAAS,SAAUA,GCuCnB,QAAAC,GAAAC,GAGA,GAAAC,EAAAD,GACA,MAAAC,GAAAD,GAAAE,OAGA,IAAAC,GAAAF,EAAAD,IACAI,EAAAJ,EAC AK,GAAA,EACAH,WAUA,OANAJ,GAAAE,GAAAM,KAAAH,EAAAD,QAAAC,IAAAD,QAAAH,GAGAI,EAAAE,GAAA,EAGAF,EAAAD,QA1DA,GAAAK,GAAAC,OAAA,uBACAA,QAAA,iCAAAC,EAAAC,EAAAC,GAIA,IADA,GAAAX,GAAAY,EAAAC,EAAAT,EAAA,EAAAU,KACQV,EAAAK,EAAAM,OAAoBX,IAC5BQ,EAAAH,EAAAL,GACAY,EAAAJ,IACAE,EAAAG,KAAAD,EAAAJ,GAAA,IAEAI,EAAAJ,GAAA,CAEA,KAAAZ,IAAAU,GACAQ,OAAAC,UAAAC,eAAAd,KAAAI,EAAAV,KACAF,EAAAE,GAAAU,EAAAV,GAIA,KADAO,KAAAE,EAAAC,EAAAC,GACAG,EAAAC,QACAD,EAAAO,SAEA,IAAAV,EACA,IAAAP,EAAA,EAAYA,EAAAO,EAAAI,OAA2BX,IACvCS,EAAAd,IAAAuB,EAAAX,EAAAP,GAGA,OAAAS,GAIA,IAAAZ,MAGAe,GACAO,EAAA,EA6BAxB,GAAAyB,EAAA,SAAAZ,GA+BA,QAAAa,KAEAC,EAAAC,QAAAD,EAAAE,OAAA,KACAC,aAAAC,EACA,IAAAC,GAAAf,EAAAJ,EACA,KAAAmB,IACAA,GACAA,EAAA,MAAAC,OAAA,iBAAApB,EAAA,aAEAI,EAAAJ,OAAAqB,IAvCA,GAAAC,GAAAlB,EAAAJ,EACA,QAAAsB,EACA,UAAAC,SAAA,SAAAC,GAA0CA,KAI1C,IAAAF,EACA,M,GAAA,EAIA,IAAAG,GAAA,GAAAF,SAAA,SAAAC,EAAAE,GACAJ,EAAAlB,EAAAJ,IAAAwB,EAAAE,IAEAJ,GAAA,GAAAG,CAGA,IAAAE,GAAAC,SAAAC,qBAAA,WACAf,EAAAc,SAAAE,cAAA,SACAhB,GAAAiB,KAAA,kBACAjB,EAAAkB,QAAA, QACAlB,EAAAmB,OAAA,EACAnB,EAAAI,QAAA,KAEA/B,EAAA+C,IACApB,EAAAqB,aAAA,QAAAhD,EAAA+C,IAEApB,EAAAsB,IAAAjD,EAAAkD,EAAA,aAAArC,EAAA,KAAwEsC,EAAA,uBAAAC,EAAA,wBAAsDvC,GAAA,KAC9H,IAAAkB,GAAAsB,WAAA3B,EAAA,KAgBA,OAfAC,GAAAC,QAAAD,EAAAE,OAAAH,EAaAc,EAAAc,YAAA3B,GAEAW,GAIAtC,EAAAuD,EAAAxD,EAGAC,EAAAwD,EAAAtD,EAGAF,EAAAK,EAAA,SAAAoD,GAA2C,M,IAG3CzD,EAAA0D,EAAA,SAAAvD,EAAAwD,EAAAC,GACA5D,EAAA6D,EAAA1D,EAAAwD,IACAxC,OAAA2C,eAAA3D,EAAAwD,GACAI,cAAA,EACAC,YAAA,EACAC,IAAAL,KAMA5D,EAAAkE,EAAA,SAAA9D,GACA,GAAAwD,GAAAxD,KAAA+D,WACA,WAA2B,MAAA/D,GAAA,SAC3B,WAAiC,M,GAEjC,OADAJ,GAAA0D,EAAAE,EAAA,I,GACAA,GAIA5D,EAAA6D,EAAA,SAAAO,EAAAC,GAAsD,MAAAlD,QAAAC,UAAAC,eAAAd,KAAA6D,EAAAC,IAGtDrE,EAAAkD,EAAA,IAGAlD,EAAAsE,GAAA,SAAAC,GAA8D,KAApBC,SAAAC,MAAAF,GAAoBA","file":"static/js/manifest.js","sourcesContent":["/**/ (function(modules) { // webpackBootstrap\n/**/ \t// install a JSONP callback for chunk loading\n/**/ \tvar parentJsonpFunction = window[\"webpackJsonpAiravataApp\"];\n/** / \twindow[\"webpackJsonpAiravataApp\"] = function webpackJsonpCallback(chunkIds, moreModules, executeModules) {\n/**/ \t\t// add \"moreModules\" to the modules object,\n/**/ \t\t// then flag all \"chunkIds\" as loaded and fire callback\n/**/ \t\tvar moduleId, chunkId, i = 0, resolves = [], result;\n/**/ \t\tfor(;i < chunkIds.length; i++) {\n/**/ \t\t\tchunkId = chunkIds[i];\n/**/ \t\t\tif(installedChunks[chunkId]) {\n/**/ \t\t\t\tresolves.push(installedChunks[chunkId][0]);\n/**/ \t\t\t}\n/**/ \t\t\tinstalledChunks[chunkId] = 0;\n/**/ \t\t}\n/**/ \t\tfor(moduleId in moreModules) {\n/**/ \t\t\tif(Object.prototype.hasOwnProperty.call(moreModules, moduleId)) {\n/**/ \t\t\t\tmodules[moduleId] = moreModules[moduleId];\n/**/ \t\t\t}\n/**/ \t\t}\n/**/ \t\tif(parentJsonpFunction) parentJsonpFunction(chunkIds, moreModules, executeModules);\n/**/ \t\twhile(resolves.length) {\n/**/ \t\t\tresolves.shift()();\n/**/ \t\t} \n/**/ \t\tif(executeModules) {\n/**/ \t\t\tfor(i=0; i < executeModules.length; i++) {\n/**/ \t\t\t\tresult = __webpack_require__(__webpack_require__.s = executeModules[i]);\n/**/ \t\t\t}\n/**/ \t\t}\n/**/ \t\treturn result;\n/**/ \t};\n/**/\n/**/ \t// The module cache\n/**/ \tvar installedModules = {};\n/**/\n/**/ \t// objects to store loaded and loading chunks\n/**/ \tvar installedChunks = {\n/**/ \t\t2: 0\n/**/ \t};\n/**/\n/**/ \t// The require function\n/**/ \tfunction
[7/8] airavata-django-portal git commit: AIRAVATA-2534 Setup build for common js and scss
http://git-wip-us.apache.org/repos/asf/airavata-django-portal/blob/840789b5/django_airavata/package-lock.json -- diff --git a/django_airavata/package-lock.json b/django_airavata/package-lock.json new file mode 100644 index 000..971275a --- /dev/null +++ b/django_airavata/package-lock.json @@ -0,0 +1,7897 @@ +{ + "name": "django-airavata-common", + "version": "1.0.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { +"abbrev": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.0.tgz;, + "integrity": "sha1-0FVMIlZjbi9W58LlrRg/hZQo2B8=", + "dev": true +}, +"accepts": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.4.tgz;, + "integrity": "sha1-hiRnWMfdbSGmR0/whKR0DsBesh8=", + "dev": true, + "requires": { +"mime-types": "2.1.17", +"negotiator": "0.6.1" + } +}, +"acorn": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.1.2.tgz;, + "integrity": "sha512-o96FZLJBPY1lvTuJylGA9Bk3t/GKPPJG8H0ydQQl01crzwJgspa4AEIq/pVTXigmK0PHVQhiAtn8WMBLL9D2WA==", + "dev": true +}, +"acorn-dynamic-import": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/acorn-dynamic-import/-/acorn-dynamic-import-2.0.2.tgz;, + "integrity": "sha1-x1K9IQvvZ5UBtsbLf8hPj0cVjMQ=", + "dev": true, + "requires": { +"acorn": "4.0.13" + }, + "dependencies": { +"acorn": { + "version": "4.0.13", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-4.0.13.tgz;, + "integrity": "sha1-EFSVrlNh1pe9GVyCUZLhrX8lN4c=", + "dev": true +} + } +}, +"ajv": { + "version": "5.2.3", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.2.3.tgz;, + "integrity": "sha1-wG9Zh3jETGsWGrr+NGa4GtGBTtI=", + "dev": true, + "requires": { +"co": "4.6.0", +"fast-deep-equal": "1.0.0", +"json-schema-traverse": "0.3.1", +"json-stable-stringify": "1.0.1" + } +}, +"ajv-keywords": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-2.1.0.tgz;, + "integrity": "sha1-opbhf3v658HOT34N5T0pyzIWLfA=", + "dev": true +}, +"align-text": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/align-text/-/align-text-0.1.4.tgz;, + "integrity": "sha1-DNkKVhCT810KmSVsIrcGlDP60Rc=", + "dev": true, + "requires": { +"kind-of": "3.2.2", +"longest": "1.0.1", +"repeat-string": "1.6.1" + } +}, +"alphanum-sort": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/alphanum-sort/-/alphanum-sort-1.0.2.tgz;, + "integrity": "sha1-l6ERlkmyEa0zaR2fn0hqjsn74KM=", + "dev": true +}, +"amdefine": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz;, + "integrity": "sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU=", + "dev": true +}, +"ansi-html": { + "version": "0.0.7", + "resolved": "https://registry.npmjs.org/ansi-html/-/ansi-html-0.0.7.tgz;, + "integrity": "sha1-gTWEAhliqenm/QOflA0S9WynhZ4=", + "dev": true +}, +"ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz;, + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "dev": true +}, +"ansi-styles": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz;, + "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", + "dev": true +}, +"anymatch": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-1.3.2.tgz;, + "integrity": "sha512-0XNayC8lTHQ2OI8aljNCN3sSx6hsr/1+rlcDAotXJR7C1oZZHCNsfpbKwMjRA3Uqb5tF1Rae2oloTr4xpq+WjA==", + "dev": true, + "requires": { +"micromatch": "2.3.11", +"normalize-path": "2.1.1" + } +}, +"aproba": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz;, + "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==", + "dev": true +}, +"are-we-there-yet": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.4.tgz;, + "integrity": "sha1-u13KOCu5TwXhUZQ3PRb9O6HKEQ0=", + "dev": true, + "requires": { +"delegates": "1.0.0", +"readable-stream": "2.3.3" + } +}, +"argparse": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.9.tgz;, + "integrity":
[8/8] airavata-django-portal git commit: AIRAVATA-2534 Setup build for common js and scss
AIRAVATA-2534 Setup build for common js and scss No common JS for now. The common scss is the code provided by Levi: https://codepen.io/levimcg/pen/KvNPNz Project: http://git-wip-us.apache.org/repos/asf/airavata-django-portal/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata-django-portal/commit/840789b5 Tree: http://git-wip-us.apache.org/repos/asf/airavata-django-portal/tree/840789b5 Diff: http://git-wip-us.apache.org/repos/asf/airavata-django-portal/diff/840789b5 Branch: refs/heads/master Commit: 840789b5ffe67d19493e305d57992d2dfdc67632 Parents: 3042564 Author: Marcus ChristieAuthored: Tue Sep 26 12:09:45 2017 -0400 Committer: Marcus Christie Committed: Tue Sep 26 12:11:08 2017 -0400 -- .gitignore |1 + .../apps/workspace/package-lock.json|2 +- django_airavata/package-lock.json | 7897 ++ django_airavata/package.json| 30 + django_airavata/static/common/js/index.js |0 django_airavata/static/common/scss/main.scss| 208 + django_airavata/static/css/app.css |1 - django_airavata/static/css/app.css.map |1 - django_airavata/static/css/base.css | 30 - django_airavata/static/css/main.css | 210 - django_airavata/static/css/main.css.map |7 - django_airavata/static/js/app.js|2 - django_airavata/static/js/app.js.map|1 - django_airavata/static/js/manifest.js |2 - django_airavata/static/js/manifest.js.map |1 - django_airavata/static/js/vendor.js | 12 - django_airavata/static/js/vendor.js.map |1 - django_airavata/templates/base.html |2 +- django_airavata/webpack.config.js | 91 + 19 files changed, 8229 insertions(+), 270 deletions(-) -- http://git-wip-us.apache.org/repos/asf/airavata-django-portal/blob/840789b5/.gitignore -- diff --git a/.gitignore b/.gitignore index 8b08366..f41d61c 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ db.sqlite3 settings_local.py .DS_Store node_modules +dist/ http://git-wip-us.apache.org/repos/asf/airavata-django-portal/blob/840789b5/django_airavata/apps/workspace/package-lock.json -- diff --git a/django_airavata/apps/workspace/package-lock.json b/django_airavata/apps/workspace/package-lock.json index 0b1ea16..07d2363 100644 --- a/django_airavata/apps/workspace/package-lock.json +++ b/django_airavata/apps/workspace/package-lock.json @@ -1,5 +1,5 @@ { - "name": "workspace", + "name": "django-airavata-workspace-views", "version": "1.0.0", "lockfileVersion": 1, "requires": true,
[5/8] airavata-django-portal git commit: AIRAVATA-2534 Setup build for common js and scss
http://git-wip-us.apache.org/repos/asf/airavata-django-portal/blob/840789b5/django_airavata/static/js/app.js.map -- diff --git a/django_airavata/static/js/app.js.map b/django_airavata/static/js/app.js.map deleted file mode 100644 index e814536..000 --- a/django_airavata/static/js/app.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["webpack:///static/js/app.js","webpack:///./src/dashboards/ExperimentDashboard.vue","webpack:///./src/components/DashboardItem.vue","webpack:///./src/components/admin/ApplicationDetails.vue?3777","webpack:///./src/components/admin/ApplicationInterface.vue","webpack:///./src/components/admin/NewApplication.vue?4fc7","webpack:///./src/router.js","webpack:///./src/dashboards/AdminDashboard.vue","webpack:///DashboardItem.vue","webpack:///RecentExperiment.vue","webpack:///ApplicationDetails.vue","webpack:///NewApplication.vue","webpack:///AdminDashboardHome.vue","webpack:///ExperimentDashboard.vue","webpack:///./src/main.js","webpack:///./src/utils.js","webpack:///./src/components/RecentExperiment.vue","webpack:///./src/components/admin/ApplicationDeployments.vue","webpack:///./src/dashboards/AdminDashboardHome.vue?b733","webpack:///./src/components/RecentExperiment.vue?234d","webpack:///./src/dashboards/AdminDashboardHome.vue?5980","webpack:///./src/components/Da shboardItem.vue?7632","webpack:///./src/dashboards/ExperimentDashboard.vue?d32c","webpack:///./src/components/admin/ApplicationDetails.vue?f06b","webpack:///./src/components/admin/ApplicationInterface.vue?95f0","webpack:///./src/components/admin/NewApplication.vue?5a4b","webpack:///./src/dashboards/AdminDashboard.vue?779b","webpack:///./src/components/admin/ApplicationDeployments.vue?60a7"],"names":["AiravataApp","webpackJsonpAiravataApp","module","exports","__webpack_require__","Component","injectStyle","ssrContext","__webpack_exports__","__WEBPACK_IMPORTED_MODULE_0__dashboards_AdminDashboardHome_vue__","__WEBPACK_IMPORTED_MODULE_0__dashboards_AdminDashboardHome_vue___default","n","__WEBPACK_IMPORTED_MODULE_1__components_admin_NewApplication_vue__","__WEBPACK_IMPORTED_MODULE_1__components_admin_NewApplication_vue___default","__WEBPACK_IMPORTED_MODULE_2__dashboards_ExperimentDashboard_vue__","__WEBPACK_IMPORTED_MODULE_2__dashboards_ExperimentDashboard_vue___default","__WEBPACK_IMPOR TED_MODULE_3__components_admin_ApplicationDetails_vue__","__WEBPACK_IMPORTED_MODULE_3__components_admin_ApplicationDetails_vue___default","__WEBPACK_IMPORTED_MODULE_4__components_admin_ApplicationInterface_vue__","__WEBPACK_IMPORTED_MODULE_4__components_admin_ApplicationInterface_vue___default","__WEBPACK_IMPORTED_MODULE_5__components_admin_ApplicationDeployments_vue__","__WEBPACK_IMPORTED_MODULE_5__components_admin_ApplicationDeployments_vue___default","__WEBPACK_IMPORTED_MODULE_6_vue_router__","routes","path","component","a","name","children","Object","defineProperty","value","props","data","height","__WEBPACK_IMPORTED_MODULE_0__ApplicationDetails_vue__","__WEBPACK_IMPORTED_MODULE_0__ApplicationDetails_vue___default","__WEBPACK_IMPORTED_MODULE_1__ApplicationInterface_vue__","__WEBPACK_IMPORTED_MODULE_1__ApplicationInterface_vue___default","components","ApplicationDetails","ApplicationInterface","current_active_tab","previous_active_tab","computed","tabs","tabs_active","Array","fil l","this","methods","tab_handler","tab_id","__WEBPACK_IMPORTED_MODULE_0__components_DashboardItem_vue__","__WEBPACK_IMPORTED_MODULE_0__components_DashboardItem_vue___default","applications","DashboardItem","NewApplication","mounted","fetchApplications","_this","$http","get","then","response","body","appModuleId","appModuleName","appModuleDescription","appModuleVersion","__WEBPACK_IMPORTED_MODULE_1__components_RecentExperiment_vue__","__WEBPACK_IMPORTED_MODULE_1__components_RecentExperiment_vue___default","__WEBPACK_IMPORTED_MODULE_2__utils_js__","RecentExperiment","data_returned","view_all","default_experiment_count","experiments","description","status","updated","i","views_all_click_handler","initializeApacheAiravataDashboard","dashboardName","__WEBPACK_IMPORTED_MODULE_0_vue__","el","router","__WEBPACK_IMPORTED_MODULE_5__router__","template","ExperimentsDashboard","__WEBPACK_IMPORTED_MODULE_3__dashboards_ExperimentDashboard_vue___default","AdminDashboard","__WEBPACK_IMPORTED_MODULE
[1/8] airavata-django-portal git commit: AIRAVATA-2534 Setup build for common js and scss
Repository: airavata-django-portal Updated Branches: refs/heads/master 3042564a2 -> 840789b5f http://git-wip-us.apache.org/repos/asf/airavata-django-portal/blob/840789b5/django_airavata/templates/base.html -- diff --git a/django_airavata/templates/base.html b/django_airavata/templates/base.html index b42f8d7..3dde6ba 100644 --- a/django_airavata/templates/base.html +++ b/django_airavata/templates/base.html @@ -1,7 +1,7 @@ {% load static %} - + https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css> https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css> http://git-wip-us.apache.org/repos/asf/airavata-django-portal/blob/840789b5/django_airavata/webpack.config.js -- diff --git a/django_airavata/webpack.config.js b/django_airavata/webpack.config.js new file mode 100644 index 000..9c1c644 --- /dev/null +++ b/django_airavata/webpack.config.js @@ -0,0 +1,91 @@ +var path = require('path') +var webpack = require('webpack') +const ExtractTextPlugin = require("extract-text-webpack-plugin"); + +const extractSass = new ExtractTextPlugin({ +filename: "[name].css" +}); + +module.exports = { + entry: [ + './static/common/js/index.js', + './static/common/scss/main.scss', + ], + output: { +path: path.resolve(__dirname, './static/common/dist/'), +publicPath: '/static/common/dist/', +filename: '[name].js' + }, + module: { +rules: [ + { +test: /\.vue$/, +loader: 'vue-loader', +options: { + loaders: { + } + // other vue-loader options go here +} + }, + { +test: /\.js$/, +loader: 'babel-loader', +exclude: /node_modules/ + }, + { +test: /\.(png|jpg|gif|svg)$/, +loader: 'file-loader', +options: { + name: '[name].[ext]?[hash]' +} + }, + { +test: /\.scss$/, +use: extractSass.extract({ +use: [{ +loader: "css-loader" +}, { +loader: "sass-loader" +}] +}) + } +] + }, + plugins: [ + extractSass + ], + resolve: { +alias: { + 'vue$': 'vue/dist/vue.esm.js' +} + }, + devServer: { +historyApiFallback: true, +noInfo: true + }, + performance: { +hints: false + }, + devtool: '#eval-source-map' +} + +if (process.env.NODE_ENV === 'production') { + module.exports.devtool = '#source-map' + // http://vue-loader.vuejs.org/en/workflow/production.html + module.exports.plugins = (module.exports.plugins || []).concat([ +new webpack.DefinePlugin({ + 'process.env': { +NODE_ENV: '"production"' + } +}), +new webpack.optimize.UglifyJsPlugin({ + sourceMap: true, + compress: { +warnings: false + } +}), +new webpack.LoaderOptionsPlugin({ + minimize: true +}) + ]) +}
[3/8] airavata-django-portal git commit: AIRAVATA-2534 Setup build for common js and scss
http://git-wip-us.apache.org/repos/asf/airavata-django-portal/blob/840789b5/django_airavata/static/js/vendor.js -- diff --git a/django_airavata/static/js/vendor.js b/django_airavata/static/js/vendor.js deleted file mode 100644 index 024a5f0..000 --- a/django_airavata/static/js/vendor.js +++ /dev/null @@ -1,12 +0,0 @@ -webpackJsonpAiravataApp([1],{0:function(t,e){t.exports=function(t,e,n,r,o){var i,a=t=t||{},s=typeof t.default;"object"!==s&&"function"!==s||(i=t,a=t.default);var c="function"==typeof a?a.options:a;e&&(c.render=e.render,c.staticRenderFns=e.staticRenderFns),r&&(c._scopeId=r);var u;if(o?(u=function(t){t=t||this.$vnode&$vnode.ssrContext||this.parent&$vnode&$vnode.ssrContext,t||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),n&(this,t),t&_registeredComponents&_registeredComponents.add(o)},c._ssrRegister=u):n&&(u=n),u){var f=c.functional,l=f?c.render:c.beforeCreate;f?c.render=function(t,e){return u.call(e),l(t,e)}:c.beforeCreate=l?[].concat(l,u):[u]}return{esModule:i,exports:a,options:c}}},10:function(t,e,n){"use strict";(function(t){/*! - * Vue.js v2.4.2 - * (c) 2014-2017 Evan You - * Released under the MIT License. - */ -function n(t){return void 0===t||null===t}function r(t){return void 0!==t&!==t}function o(t){return!0===t}function i(t){return!1===t}function a(t){return"string"==typeof t||"number"==typeof t||"boolean"==typeof t}function s(t){return null!==t&&"object"==typeof t}function c(t){return"[object Object]"===Do.call(t)}function u(t){return"[object RegExp]"===Do.call(t)}function f(t){var e=parseFloat(t);return e>=0&(e)===e&(t)}function l(t){return null==t?"":"object"==typeof t?JSON.stringify(t,null,2):String(t)}function p(t){var e=parseFloat(t);return isNaN(e)?t:e}function d(t,e){for(var n=Object.create(null),r=t.split(","),o=0;o-1)return t.splice(n,1)}}function v(t,e){return Bo.call(t,e)}function m(t){var e=Object.create(null);return function(n){return e[n]||(e[n]=t(n))}}function y(t,e){function n(n){var r=arguments. length;return r?r>1?t.apply(e,arguments):t.call(e,n):t.call(e)}return n._length=t.length,n}function g(t,e){e=e||0;for(var n=t.length-e,r=new Array(n);n--;)r[n]=t[n+e];return r}function b(t,e){for(var n in e)t[n]=e[n];return t}function _(t){for(var e={},n=0;n