Skip to content

Commit

Permalink
Added syscall socket + example usage in FileTransfer for credential r…
Browse files Browse the repository at this point in the history
…efresh (#7532)
  • Loading branch information
markcoatsworth committed Apr 2, 2020
1 parent 6113d93 commit e94b6f3
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/condor_starter.V6.1/jic_shadow.cpp
Expand Up @@ -2457,6 +2457,7 @@ JICShadow::beginFileTransfer( void )

ASSERT( filetrans->Init(job_ad, false, PRIV_USER) );
filetrans->setSecuritySession(m_filetrans_sec_session);
filetrans->setSyscallSocket(syscall_sock);
filetrans->RegisterCallback(
(FileTransferHandlerCpp)&JICShadow::transferCompleted,this );

Expand Down
14 changes: 13 additions & 1 deletion src/condor_utils/file_transfer.cpp
Expand Up @@ -47,6 +47,7 @@
#include "data_reuse.h"
#include "AWSv4-utils.h"
#include "condor_random_num.h"
#include "condor_sys.h"

#include <fstream>
#include <algorithm>
Expand Down Expand Up @@ -5408,7 +5409,6 @@ FileTransfer::InvokeFileTransferPlugin(CondorError &e, const char* source, const
return TransferPluginResult::Error;
}


// detect which plugin to invoke
char *URL = NULL;

Expand Down Expand Up @@ -5548,6 +5548,18 @@ FileTransfer::InvokeMultipleFileTransferPlugin( CondorError &e,
const std::string &plugin_path, const std::string &transfer_files_string,
const char* proxy_filename, bool do_upload,
std::vector<std::unique_ptr<ClassAd>> *result_ads ) {

// MRC test code: Demonstrate a syscall to the condor_shadow
int syscall_code = CONDOR_set_job_attr;
std::string attr_name = "RefreshOAuthCredentials";
std::string attr_value = "Do it! Do it now!";
if (m_syscall_socket->is_connected()) {
m_syscall_socket->encode();
m_syscall_socket->code(syscall_code);
m_syscall_socket->code(attr_value);
m_syscall_socket->code(attr_name);
m_syscall_socket->end_of_message();
}

ArgList plugin_args;
CondorClassAdFileIterator adFileIter;
Expand Down
4 changes: 4 additions & 0 deletions src/condor_utils/file_transfer.h
Expand Up @@ -152,6 +152,9 @@ class FileTransfer final: public Service {
*/
void setCredsDir(const std::string &cred_dir) {m_cred_dir = cred_dir;}

/** @param socket The socket used to send syscall instructions */
void setSyscallSocket(ReliSock* socket) {m_syscall_socket = socket;}

/** @param reuse_dir: The DataReuseDirectory object to utilize for data reuse
* lookups
*/
Expand Down Expand Up @@ -475,6 +478,7 @@ class FileTransfer final: public Service {
bool did_init{false};
bool simple_init{true};
ReliSock *simple_sock{nullptr};
ReliSock *m_syscall_socket{nullptr};
MyString download_filename_remaps;
bool m_use_file_catalog{true};
TransferQueueContactInfo m_xfer_queue_contact_info;
Expand Down

0 comments on commit e94b6f3

Please sign in to comment.