rackspace / php-opencloud

The PHP SDK for OpenStack clouds
developer.rackspace.com
Other
451 stars 249 forks source link

Not all Containers works for file uploads #90

Closed danielhuesken closed 11 years ago

danielhuesken commented 11 years ago

I have 2 containers in Dallas (DFW) for contaioner 'dhtest' i get the Message "Rackspace Cloud API: Container [dhtest] not found" on uploads

The secound contaioner 'testdah' works.

I have created a third contaioner 'dhtester123' and it not works to.

gecampbell commented 11 years ago

Wow, that's bizarre. I can't even speculate as to what's going on. Do you have some simple code that replicates the problem?

gecampbell commented 11 years ago

This might be caused by issue #93

gecampbell commented 11 years ago

oops, no, this is different. sorry.

danielhuesken commented 11 years ago
    try {

        $conn = new OpenCloud\Rackspace(
            'https://identity.api.rackspacecloud.com/v2.0/',
            array(
                 'username' => $job_object->job[ 'rscusername' ],
                 'apiKey' => BackWPup_Encryption::decrypt( $job_object->job[ 'rscapikey' ] )
            ));
        //set upload callback
        $conn->SetUploadProgressCallback( array( $this,'UploadProgressCallback') );
        //connect to cloud files
        $ostore = $conn->ObjectStore( 'cloudFiles' , $job_object->job[ 'rscregion' ], 'publicURL');

        $container = $ostore->Container( $job_object->job[ 'rsccontainer' ] );
        $job_object->log( sprintf(__( 'Connected to Rackspace cloud files container %s', 'backwpup' ), $container->name ) );
    }
    catch ( Exception $e ) {
        $job_object->log( E_USER_ERROR, sprintf( __( 'Rackspace Cloud API: %s', 'backwpup' ), htmlentities( $e->getMessage() ) ), $e->getFile(), $e->getLine() );

        return FALSE;
    }

    try {
        //Transfer Backup to Rackspace Cloud
        $job_object->substeps_done    = 0;
        $job_object->log( __( 'Upload to Rackspace cloud started …', 'backwpup' ), E_USER_NOTICE );

        $backupfile = $container->DataObject();
        $uploded = $backupfile->Create( array(
                                  'name'=> $job_object->job[ 'rscdir' ] . $job_object->backup_file,
                                  'content_type'=> $job_object->get_mime_type( $job_object->backup_folder . $job_object->backup_file )
                             ), $job_object->backup_folder . $job_object->backup_file );
        if ( $uploded ) {
            $job_object->substeps_todo = 1 + $job_object->backup_filesize;
            $job_object->log( __( 'Backup File transferred to RSC://', 'backwpup' ) . $job_object->job[ 'rsccontainer' ] . '/' . $job_object->job[ 'rscdir' ] . $job_object->backup_file, E_USER_NOTICE );
            if ( !empty( $job_object->job[ 'jobid' ] ) )
                BackWPup_Option::update( $job_object->job[ 'jobid' ], 'lastbackupdownloadurl', network_admin_url( 'admin.php' ) . '?page=backwpupbackups&action=downloadrsc&file=' . $job_object->job[ 'rscdir' ] . $job_object->backup_file . '&jobid=' . $job_object->job[ 'jobid' ] );
        } else {
            $job_object->log( __( 'Cannot transfer backup to Rackspace cloud.', 'backwpup' ), E_USER_ERROR );

            return FALSE;
        }
    }
    catch ( Exception $e ) {
        $job_object->log( E_USER_ERROR, sprintf( __( 'Rackspace Cloud API: %s', 'backwpup' ), htmlentities( $e->getMessage() ) ), $e->getFile(), $e->getLine() );

        return FALSE;
    }
gecampbell commented 11 years ago

Can you try this again with the code that's in the "working" branch? I'm 99.999% certain I've fixed it, but I'd like to know that it works for you.

danielhuesken commented 11 years ago

Sorry, but nit working to. But i have a new message: Container [dhtester123] https://cdn1.clouddrive.com/v1/MossoCloudFS_dfc5b03e-f19d-481f-82e1-62aca7e5c507/dhtester123 not found. or Rackspace Cloud API: Container [dhtest] https://cdn1.clouddrive.com/v1/MossoCloudFS_dfc5b03e-f19d-481f-82e1-62aca7e5c507/dhtest not found

testdah works.

gecampbell commented 11 years ago

See explanation on issue #94 - this is a duplicate of that.