コード例 #1
0
    def register(self, name, dir):
        name = RegPath(name).get()
        for suite in self.list_all_suites():
            if name == suite:
                raise RegistrationError("ERROR: " + name +
                                        " is already registered.")
            elif suite.startswith(name + RegPath.delimiter):
                raise RegistrationError("ERROR: " + name +
                                        " is a registered group.")
            elif name.startswith(suite + RegPath.delimiter):
                # suite starts with, to some level, an existing suite name
                raise RegistrationError("ERROR: " + suite +
                                        " is a registered suite.")
        dir = dir.rstrip('/')  # strip trailing '/'
        dir = re.sub('^\./', '', dir)  # strip leading './'
        if not dir.startswith('/'):
            # On AIX on GPFS os.path.abspath(dir) returns the path with
            # full 'fileset' prefix. Manual use of $PWD to absolutize a
            # relative path gives a cleaner result.
            dir = os.path.join(os.environ['PWD'], dir)
        title = self.get_suite_title(name, path=dir)
        title = title.split('\n')[0]  # use the first of multiple lines
        print 'REGISTER', name + ':', dir
        with open(os.path.join(self.dbpath, name), 'w') as file:
            file.write('path=' + dir + '\n')
            file.write('title=' + title + '\n')

        # create a new passphrase for the suite if necessary
        passphrase(name, user, get_hostname()).generate(dir)
コード例 #2
0
ファイル: registration.py プロジェクト: bjlittle/cylc
    def register( self, name, dir ):
        name = RegPath(name).get()
        for suite in self.list_all_suites():
            if name == suite:
                raise RegistrationError, "ERROR: " + name + " is already registered."
            elif suite.startswith( name + RegPath.delimiter ):
                raise RegistrationError, "ERROR: " + name + " is a registered group."
            elif name.startswith( suite + RegPath.delimiter ):
                # suite starts with, to some level, an existing suite name
                raise RegistrationError, "ERROR: " + suite + " is a registered suite."
        dir = dir.rstrip( '/' )  # strip trailing '/'
        dir = re.sub( '^\./', '', dir ) # strip leading './'
        if not dir.startswith( '/' ):
            # On AIX on GPFS os.path.abspath(dir) returns the path with
            # full 'fileset' prefix. Manual use of $PWD to absolutize a
            # relative path gives a cleaner result.
            dir = os.path.join( os.environ['PWD'], dir )
        title = self.get_suite_title(name, path=dir)
        title = title.split('\n')[0] # use the first of multiple lines
        print 'REGISTER', name + ':', dir
        with open( os.path.join( self.dbpath, name ), 'w' ) as file:
            file.write( 'path=' + dir + '\n' )
            file.write( 'title=' + title + '\n' )

        # create a new passphrase for the suite if necessary
        passphrase(name,user,get_hostname()).generate(dir)
コード例 #3
0
ファイル: command_prep.py プロジェクト: steoxley/cylc
 def __init__( self, suite, options ):
     prep.__init__( self, suite, options )
     # get the suite passphrase
     try:
         self.pphrase = passphrase( self.suite, self.options.owner, self.options.host,
                 verbose=options.verbose ).get( None, self.suitedir )
     except Exception, x:
         if self.options.debug:
             raise
         raise SystemExit(x)
コード例 #4
0
ファイル: task_message.py プロジェクト: raghu330/cylc
    def get_proxy( self ):
        # get passphrase here, not in __init__, because it is not needed
        # on remote task hosts if 'ssh messaging = True' (otherwise, if
        # it is needed, we will end up in this method).

        self.pphrase = passphrase( self.suite, self.owner, self.host ).get( None, None )

        import cylc_pyro_client
        return cylc_pyro_client.client( self.suite, self.pphrase,
                self.owner, self.host, self.try_timeout,
                self.port ).get_proxy( self.task_id )
コード例 #5
0
ファイル: task_message.py プロジェクト: tomgreen66/cylc
 def get_proxy( self ):
     # get passphrase here, not in __init__, because it is not needed
     # on remote task hosts if 'ssh messaging = True' (otherwise, if
     # it is needed, we will end up in this method). 
     self.pphrase = passphrase( self.suite, self.owner, self.host,
             verbose=self.verbose ).get( None, None )
     # this raises an exception on failure to connect:
     import cylc_pyro_client
     return cylc_pyro_client.client( self.suite, self.pphrase,
             self.owner, self.host, self.pyro_timeout, self.port,
             self.verbose ).get_proxy( self.task_id )
コード例 #6
0
ファイル: command_prep.py プロジェクト: dmanubens-zz/cylc
 def __init__(self, suite, options):
     prep.__init__(self, suite, options)
     # get the suite passphrase
     try:
         self.pphrase = passphrase(self.suite, self.options.owner,
                                   self.options.host).get(
                                       None, self.suitedir)
     except Exception, x:
         if cylc.flags.debug:
             raise
         raise SystemExit(x)
コード例 #7
0
    def get_proxy(self):
        # get passphrase here, not in __init__, because it is not needed
        # on remote task hosts if 'ssh messaging = True' (otherwise, if
        # it is needed, we will end up in this method).

        self.pphrase = passphrase(self.suite, self.owner,
                                  self.host).get(None, None)

        import cylc_pyro_client
        return cylc_pyro_client.client(self.suite, self.pphrase, self.owner,
                                       self.host, self.try_timeout,
                                       self.port).get_proxy(self.task_id)
コード例 #8
0
ファイル: port_scan.py プロジェクト: kaday/cylc
def load_passphrases(db):
    """Load all of the user's passphrases (back-compat for <= 6.4.1)."""
    global passphrases
    if passphrases:
        return passphrases

    # Find passphrases in all registered suite directories.
    reg = localdb(db)
    reg_suites = reg.get_list()
    for item in reg_suites:
        rg = item[0]
        di = item[1]
        try:
            p = passphrase(rg, user, get_hostname()).get(suitedir=di)
        except Exception, x:
            # Suite has no passphrase.
            if cylc.flags.debug:
                print >> sys.stderr, x
        else:
            passphrases.append(p)
コード例 #9
0
ファイル: port_scan.py プロジェクト: aosprey/cylc
def load_passphrases(db):
    """Load all of the user's passphrases (back-compat for <= 6.4.1)."""
    global passphrases
    if passphrases:
        return passphrases

    # Find passphrases in all registered suite directories.
    reg = localdb(db)
    reg_suites = reg.get_list()
    for item in reg_suites:
        rg = item[0]
        di = item[1]
        try:
            p = passphrase(rg, user, get_hostname()).get(suitedir=di)
        except Exception, x:
            # Suite has no passphrase.
            if cylc.flags.debug:
                print >> sys.stderr, x
        else:
            passphrases.append(p)
コード例 #10
0
ファイル: registration.py プロジェクト: ScottWales/cylc
        try:
            title = self.get_suite_title( name, path=dir )
        except Exception, x:
            print >> sys.stderr, 'WARNING: an error occurred parsing the suite definition:\n  ', x
            print >> sys.stderr, "Registering the suite with temporary title 'SUITE PARSE ERROR'."
            print >> sys.stderr, "You can update the title later with 'cylc db refresh'.\n"
            title = "SUITE PARSE ERROR"

        title = title.split('\n')[0] # use the first of multiple lines
        print 'REGISTER', name + ':', dir
        with open( os.path.join( self.dbpath, name ), 'w' ) as file:
            file.write( 'path=' + dir + '\n' )
            file.write( 'title=' + title + '\n' )

        # create a new passphrase for the suite if necessary
        passphrase(name,user,get_hostname()).generate(dir)

    def get_suite_data( self, suite ):
        suite = RegPath(suite).get()
        fpath = os.path.join( self.dbpath, suite )
        if not os.path.isfile( fpath ):
            raise RegistrationError, "ERROR: Suite not found " + suite
        data = {}
        with open( fpath, 'r' ) as file:
            lines = file.readlines()
        count = 0
        for line in lines:
            count += 1
            line = line.rstrip()
            try:
                key,val = line.split('=')
コード例 #11
0
        try:
            title = self.get_suite_title(name, path=dir)
        except Exception, x:
            print >> sys.stderr, 'WARNING: an error occurred parsing the suite definition:\n  ', x
            print >> sys.stderr, "Registering the suite with temporary title 'SUITE PARSE ERROR'."
            print >> sys.stderr, "You can update the title later with 'cylc db refresh'.\n"
            title = "SUITE PARSE ERROR"

        title = title.split('\n')[0]  # use the first of multiple lines
        print 'REGISTER', name + ':', dir
        with open(os.path.join(self.dbpath, name), 'w') as file:
            file.write('path=' + dir + '\n')
            file.write('title=' + title + '\n')

        # create a new passphrase for the suite if necessary
        passphrase(name, user, get_hostname()).generate(dir)

    def get_suite_data(self, suite):
        suite = RegPath(suite).get()
        fpath = os.path.join(self.dbpath, suite)
        if not os.path.isfile(fpath):
            raise RegistrationError, "ERROR: Suite not found " + suite
        data = {}
        with open(fpath, 'r') as file:
            lines = file.readlines()
        count = 0
        for line in lines:
            count += 1
            line = line.rstrip()
            try:
                key, val = line.split('=')